309 karma · joined September 12, 2018
The determinism is partly possible because WebAssembly is deterministic (except for a few known cases https://github.com/WebAssembly/design/blob/main/Nondetermini...), and partly because I’m making sure to use my own trigonometric functions, and the entire game simulation is executed single threaded with a known order of execution.
If you meant to ask how does it compare to non deterministic physics engines, I’m sure they might be faster on the physics but would be slower on the rollback, and I think on most reasonably-sized games the slow rollback would dominate and so they would be slower overall. But, you wouldn’t make a rollback netcode game with that size of world anyway, at least maybe not until now, so it’s a bit of a false comparison. They’re good at their different use cases.
Maybe some people might find it interesting - I’m relaying packets from peer-to-peer using Cloudflare Realtime, which is like a one-to-many broadcast system for WebRTC. Each peer sends their input packet to Cloudflare, then Cloudflare forwards that on to the 10 other players (for example). It’s cool because (a) 10x less upload bandwidth from the peer (b) people IP addresses are not revealed to their peers and (c) Cloudflare is in 400 datacenters around the world so it adds minimal latency. Cloudflare Realtime is a really cool system that maybe more web game developers should look into!
Unfortunately, I’m paying for all the bandwidth that goes through Cloudflare Realtime and so I have perhaps over optimised on minimising bandwidth by sending only one input per packet. The other part of my equation is I’m getting my server to broadcast authoritative batches of inputs every 100ms or so via TCP, so if a packet gets lost, every peer will eventually receive the input but it might be a bit slow, and it will cause a big rollback that might be noticeable.
Reading your comment makes me think it might not be as expensive as I thought, and maybe I can play around with how long of an input period I resend for. Perhaps there is a better balance to strike between cost and reliability. So thanks for bringing this up!
Just to add to the general discussion for everyone following along - rollback netcode only sends inputs around, not state, so it doesn't really have much to send. I think I'm doing about 1.5 KB per second. When you point your mouse it sends that data in 10 bytes. There's not a lot to delta compress.
The export basically creates a page with an HTML IFRAME in it that embeds the hosted version of your game on easel.games so that all the multiplayer and leaderboards continue to work.
Thanks for your interest!
I'm making a game engine that uses rollback netcode for its multiplayer architecture. As far as I can tell, no physics engine supports incremental rollback thus far. This means the entire physics engine state has to be snapshotted every frame, which basically means it's infeasible to have large worlds with rollback netcode. I've made a physics engine which only snapshots the changes, and so now I think you can have large worlds, as long as most of the world is static. I think that's true in most cases, like when you're walking around a big spaceship for example, all the walls, tables, control panels etc don't really move. I wrote up a bit of a post to describe some of the cool things I discovered while making my own physics engine.
For the past 4 years I've been building a programming language reimagined specifically for games. It has automatic multiplayer, but also things like state, components, concurrent behaviours and reactive user interfaces baked into the language.
In all honesty though, I quite enjoyed how this article was written. Is there a listing somewhere of articles written like this, with algorithms or concepts explained using analogies to pop culture?
Ah it's always interesting to see what other people come up with, thanks for sharing!
A 2D game programming language with automatic multiplayer. Normally when you make a multiplayer game, you have to constantly think about how every bit of state is going to be synchronized. Easel bakes the multiplayer into the programming language itself, underneath all your code, so you can just code as if all players are in one shared world, like a singleplayer game, and Easel just makes your game multiplayer completely automatically. It’s intended as a fun way for beginners to learn to code - like a combination of Scratch and Roblox.
A beginner-friendly programming language for 2D games where multiplayer is automatic. Intended to be an engaging way for teenagers to learn to code by making games they can play with their friends. Like a blend of Scratch and Roblox. I've been working on this for 3 years!
A beginner-friendly programming language for 2D games where multiplayer is automatic. Intended to be an engaging way for teenagers to learn to code by making games they can play with their friends. Like a blend of Scratch and Roblox. I've been working on this for 3 years!
Maybe I'll rewind a bit, and I'm sorry if this is a long post!
I've just had a teenager who finished making a Chess game in Easel after about a month's work, his most advanced programming project so far. This teenager started in Scratch, has done some Python, but the language they have spent the most time in has been Easel. I've also had a couple of teenagers who have said things like "I suck at coding" and yet make spend months making these quite sophisticated Easel projects full of coding. These two teenagers also did a bit of Scratch but also were lost and disengaged when it came to Python. This mirrors what I've seen in Code Clubs as well, where teenagers just lost interest when shown Python.
Eventually, if someone is going to learn to code for real, they must make the transition from a visual programming language to a text-based programming language, and I know that I have seen teenagers get lost attempting to cross that gap. There are teenagers who obviously have had no trouble with this and that's great, they should go straight to Python or JavaScript or whatever is their heart's desire!
The difference between Scratch and most other programming languages is more than just visual vs text-based. Scratch is actually this cool concurrent, asynchronous, event-driven programming language. This makes it easy to write things like "wait 0.3 seconds" then "move 2 steps to the right". Most other game engines, including PyGame and Godot, instead use a frame-by-frame model. This means you often have to code things as state machines, where you pick up and put down state so that an entity can remember what it was doing next frame. That example of "wait 0.3 seconds" then "move 2 steps to the right" would require the control flow to jump up and down the codebase between state and logic, which means the shape of the code no longer mirrors the step-by-step of what it is actually doing. I think Scratch is successful not just because of its visual coding, but because its programming model allows for step-by-step logic to look like step-by-step code. There's no reason a text-based programming language couldn't also have this property.
Easel is concurrent, asynchronous, event-driven, like Scratch, which is why both Easel and Scratch code can be written in this sequential step-by-step way that you can't easily achieve in other programming languages.
Why can't you just write `await sleep(0.3s)` in other programming languages? Their issue is you can't cancel an `await`, which means it is easy for an asynchronous task to outlive its entity and so they are not safe beginner-level constructs. Scratch solves this implicitly because all scripts are part of a sprite, and when your sprite is removed, all its concurrent scripts stop. It's so intuitive that it doesn't really need to be taught. Easel has a similar thing but in text-based form - it is a hierarchical programming language and everything inside of an entity's block`{ }` gets auto-cleaned up when it dies, including all asynchronous tasks belonging to that entity. I think that's why in Easel, I've seen teenagers spinning up hundreds of asynchronous threads all the time without any problems.
All of this is to say that Easel is like halfway between Scratch and Python. It keeps a lot of the intuitive parts of Scratch's cool programming model, but in text form. My hope (and we have seen this already a few times) is that it can help more teenagers cross the gap from visual coding to "grown up" text-based programming languages.
The reason the code sample is at the top is actually because I saw a teenager talk aloud as they were reading that code and understanding it in real-time. It was super cool because that's it, that's what I've been trying to do - make a text-based programming language that is legible to beginners and not convoluted. And I'm trying to figure out whether it is possible to replicate that moment over and over again with new teenagers.
There is a lot more to it. Easel adds a lot of other stuff like a physics engine and automatic multiplayer. But this post is getting long so I will stop there. I really appreciate the thoughts. I am definitely going to be thinking about how that homepage is presenting itself and I think it is fair what you say that it doesn't look simple, and doesn't look different to any other game engine. That is very good feedback!
I'm working on a beginner-friendly online programming language for teenagers who want to learn to code. I think there is not a clear enough winner for what teenagers should do after they learn Scratch so I am trying to make it.