186 points · by eggy · 4y ago · 186 comments
WASM-4 seems to be a technically limited "console" (64kb of RAM, 160x160 console), so it's even more of a niche than just doing game dev for WASM.
Even though I'm technically a millennial… but if the next gen start using Zig instead of JavaScript for everything, I'm on board.
OT: Searching for Spark2014 brings up a lot of results about the 2014 Chevrolet Spark. A shit box of a car of there ever was one.
I usually put "SPARK2014 programming" or "SPARK2014 Ada" in my searches. I used to get annoyed by all of the Apache Spark stuff that came up, but that seems to have waned a bit this past year or two.
Vermont Technical College (VTC) used SPARK2014 to program their CubeSat and the book, "Building High Integrity Applications with SPARK"[1] is a great intro to it in a nice context of practical use.
There was also an article on the AdaCore site about someone who rewrote some drone firmware in SPARK2014, which is another nice real-world application. [2]
[1] https://www.amazon.com/Building-High-Integrity-Applications-...
[2] https://blog.adacore.com/how-to-prevent-drone-crashes-using-...
[1]: https://docs.adacore.com/spark2014-docs/html/ug/en/source/la...
For private lone-hacking projects though it feels way too complex and opinionated. Here Zig definitely gets closer to what I need, though sadly it made unused variables an compiler error (curse you golang for making that popular) which is super annoying for prototyping.
If some enterprising young developer is reading this and wants to make a name for themselves, you should fork the Zig compiler and change those errors to warnings. It would be an extremely popular project.
EDIT: I'll even give you a catchy project name. Wig: Zig with Warnings
Fridays are my live streaming day and I've chosen today's topic to be the user experience of unused variable errors. I have an idea to solve this that can satisfy both parties - those who don't want to be bothered by such errors, and those who want the premise upheld that if Zig code compiles, it does not have any unused variables.
In approximately 60 minutes I'll go live on https://www.twitch.tv/andrewrok/
If the goal of not having warnings is to increase code quality, it's actually doing the opposite.
I don't understand this insistence on working around the problem by layering on tooling, instead of just fixing the problem to begin with.
Commenting out a few variables isn't always easy either. Every try to add const to a legacy C++ project - it can take days to fix all the errors resulting from adding const to something that clearly is const in usage. I don't know zig, but I wouldn't be surprised if sometimes you get into this type of situation in a large code base (does anyone have a very large code base in zig yet?)
But if you comment var A that uses var B now B is unused and you need to commnet B, but now B was using a function parameter C and this param is unused now so you need to update the function signature (I do not use Go,Zig so maybe they did not forced you to also use all the function params my experience is with linters where ehwn you comment something then more unused warnings appear)
In Zig, I find that I put a whole litany of "_ = varname;" at the bottom of my functions (starting with the function arguments) and they stay there permanently. This is NOT an improvement.
However, it's not really enough to stop me from using the language as that's an easy thing to evantually fix.
Current situation is it's not language-agnostic as movement, it's just c/rust mostly.
So wasm-4 seems to have more interesting examples than the other e.g. https://wasm4.org/docs/tutorials/snake/handling-user-input
The specifications are open and detailed [1]. Specifications like that can be daunting to consume if you want a place to start from instead of a complete overview of the landscape, but there are tutorials in pure web assembly if you want to get started.
[1]: https://webassembly.github.io/spec/core/text/instructions.ht...
Right now I am teaching a VM course on the back-half of the Wasm equation: how to build an engine for Wasm. The course is about more than Wasm, of course, so there is a lot of content about JVMs and dynamic object models, but the projects are based around Wasm.
In the future I envision university compiler courses getting divided into two halves, either as one course with two halves, or two full courses. The first course/half would be entirely frontend: parsing, semantic analysis, IR, translation, lowering--and the target would be WebAssembly. The second course/half would be all about compiling Wasm to machine code. If the second course wanted to go more in the VM/runtime direction, vs focusing on compilation, it could include the upcoming GC extension or a custom extension to have objects.
I think Wasm is the future of code formats and languages, so I'd like to move the needle here for PL implementors.
You read my mind, yes. That's why I said I have AST.
Is your course private? I'm interested.
My guess is that it is about the language tooling, but it would be nice to hear from the authors themselves.
I really enjoy the balance of safety and control in Zig. I can build using Debug mode during development, turning nearly all my bugs into crashes which are easily fixable using in-browser source-level debugging. But in Release-Small mode the result is fast and more importantly really small since there's a 64kb cartridge limit.
Another factor is the Zig Standard Library which designed to be portable and usable on freestanding targets. I can not emphasize enough how pleasant this is. For example I can just use a `std.heap.FixedBufferAllocator` to back a `std.ArrayList` with no problem.
The comptime feature of Zig also comes in handy when you have to minimize code size.
The seamless C interop furthermore improves my productivity since I can just use any C code I like. I've used a C perlin noise library in a previous game for example, saving me a lot of time.
Plus I've used Zig for the previous WASM-4 jam and just liked it so I didn't bother trying any other language.
Rust is the highest level represented. I'm guessing the level of control needed to hit the tight constraints of wasm-4 preclude anything that you wouldn't use for a microcontroller. C and c++ would work too, but what fun is that?
https://youtu.be/7ydnjX999kk?t=894
I also think that there is a correlation between the majority of participants being from Europe and Zig. At the moment almost all our meetups are in Europe.
So basically rust imposes a lot of limitations on how you can structure your program relative to something like Zig or C.
It’s still early days for Bevy but they’re making steady progress.
Independently of Bevy's progress, a parallel ECS is not a good choice for a prototype-like game project.
On the other hand, is the SNES "The Legend of Zelda: A Link to the Past" style everyone's favourite pixel art style, or is it just me? Without tricks it did 256 colours of of 4096 in Mode 7. You can't do art that's as pretty with four colours. Is it a restriction that's too harsh or are we ok with games that just aren't very pretty?
I totally get it's nicer than C, I love it too, but it's completely irresponsible to push a language without a memory safety story, in 2022, this hard.
From that relatively obvious conclusion it devolves into tedious nerdsnipes. Yes there are edge cases.
Asking as Rustecean.