Show HN: Angeldust – a fast and efficient video game
716 pointsWebsite: http://angeldu.st
My single server hosts 250+K active players in one giant, dynamic fantasy world. Angeldust's game server is pervasively multithreaded, implementing John Carmack's dream of processing an immutable world state each tick.
Both world handling and network traffic routing uses any number of threads. For networking, a typical game session only uses ~3Kbps of bandwidth, enabling decent play even over 2G/EDGE networks.
The client is programmed in C++ with bits of C, Objective-C, Java and PHP. It runs really well on very low-end and obsolete hardware, all the way up to modern systems with fast GPUs.
Angeldust works perfectly on Windows XP+, even without hardware OpenGL; Mac OS X 10.6+, even on the first 2006 32-bit Intel GMA945 MacBook1,1; Linux 64-bit glibc 2.17+; Android v2.2.3+, supporting Bluetooth game controllers; and iOS 6+, though iTunes App Store forces iOS 8+ (any way around this?).
I live stream weekly on YouTube and Twitch, even right now! Come ask me your development questions! I often see developers playing together with their kids.
YouTube channel: https://www.youtube.com/AngeldustLive
One more thing: the Angeldust website ( https://angeldu.st ) uses plain HTML and CSS to offer interactive, game-related actions. It's fully functional even without JavaScript enabled.
Comments (193) 42 threads
I'm developing a game myself, and figuring out a good method of multithreading it took a lot of work. While I am content with the results, I wouldn't say I arrived at a good solution.
It sounds like you went with a purely functional approach? Did you rebuild the entire gamestate each tick, or keep a list of changes you needed to make to the relevant data?
https://news.ycombinator.com/item?id=15036591 was the previous HN thread about it.
The Angeldust game world is tracked in an "active chunk set". A chunk is a 2D part of the world, 32x32x64 in-game blocks (meters). The active chunk set tracks only the chunks that contain, or are near, players. This chunk set is processed in parallel on any number of threads/cores configured in the server settings file.
Angeldust tracks two states for the data contained in each chunk, kind of like an array of size 2. Each tick, one state in the array is the immutable "read"-state and the other is the mutable "write"-state. Every tick these states ping-pong between the roles.
During processing the server processes the read state and copies over unchanged entity/world data by simply pushing pointers to that data into std::vector<>s in the write state. For things that did change I push a new pointer into the write state and clear up the old pointer in the next tick. Pushing pointers saves memory bandwidth since you don't have to copy all entity data for every tick. And still you can guarantee that the "read"-state will be unmodified so that other CPUs/cores/threads can freely access all of the data and pointers.
On the livestream I discussed a few cases where I do use (largely uncontested) mutexes for data synchronization: for friend chat and private chat I do a lookup of destination hero pointers in the "hero map" and then lock/unlock the hero's mutex for pushing chat messages into a vector.
Does this make sense? Let me know if I should elaborate. I will probably take a nap now, but I'll answer you (and others) tomorrow.
I'll also do another livestream tomorrow, because I feel everyone on HN has very useful questions, feedback and ideas.
For the write state, you're absolutely right that entities will need to transition between chunks. The server looks up the destination in the "active chunk set" I mentioned and then uses per-chunk std::vector<>s guarded by a mutex to push "migrating" entities. This requires a mutex since multiple CPUs/cores/threads/chunks can be pushing entities to the same destination chunk. These mutexes largely have zero to little contention.
Does that answer your question in an acceptable way?
Continue this thread — 5 replies
Kudos for this extremely well polished project. This is the dream many of us have but can't or won't embark upon. This is very inspirational.
I lived with my parents during this time and could save up money as a buffer. Thanks to that support I could financially bridge these past years of development without worrying too much. Also: keeping expenses as low as possible. My product is old school and so are my computers.
Great choices, fantastic execution.
You're going to go far. Keep it up!
I've been really lucky to be able to successfully fulfill my childhood dream by making this game. But like Freddie Mercury sung: it's [not always] been a bed of roses or a pleasure cruise. I've sacrificed progress in other areas of my life to see this through to the end. I hope to catch up there starting as early as next year. Nonetheless I definitely wouldn't be the same without having taken on this adventure. I've grown so much as a developer, an entertainer and even as a person by creating Angeldust.
Continue this thread — 1 reply
Steam: https://store.steampowered.com/app/488440/Angeldust/
Android: https://play.google.com/store/apps/details?id=nl.metagaming....
iOS: https://apps.apple.com/us/app/angeldust/id687448635
PS. The author mentioned it was free on Android fyi, because it only has the "Cartoon"-engine currently. If i'm not mistaken.
And if any of you can get me in touch with John Carmack that'd be very awesome ;)!
I don't see that connection as an issue with the game or your post. It certainly isn't doing anyone any harm, despite what others suggested in earlier comments.
That said... I'm 21 years old, and I still associate "angel dust" with PCP. The name is still used by popular rappers including Mac Miller [0] and Run the Jewels [1]. It is still defined as PCP in 6 of the top 7 results, vs 5 of the top 7 for "sherm" and 0.3/7 for "wet" on Urban Dictionary [2,8,9]. Angel dust is the most common synonym for PCP on Urban Dictionary [10]. The name "angel dust" was used to refer to PCP in a 2011 episode of Its Always Sunny in Philadelphia [3]. The name is still in common parlance on Reddit [4,5,6]. However, the drug seems to have experienced a decline in popularity, accounting for less than 0.1% of all documented hallucinogenic drug use in the United States in 2017 [7] - suggesting that the term "angel dust" is not well known simply because the drug isn't commonly used, and not because the term has been abandoned.
I just don't want anyone to get into trouble thinking that they can use the phrase "Angel Dust" without it being seen as a reference to hard drugs by the general public.
I am also surprised that this association is being rejected, considering that the creator of the game is going by "Frank Lucas" [11], which is the name of a famous drug trafficker [12].
[0]: https://www.youtube.com/watch?v=rIQqzTNRmoc
[1]: https://www.youtube.com/watch?v=R_esHn4X03U
[2]: https://www.urbandictionary.com/define.php?term=Angel%20Dust
[3]: https://itsalwayssunny.fandom.com/wiki/The_Gang_Goes_to_the_...
[4]: https://www.reddit.com/r/PCP/comments/ba1754/two_dimes_of_pc...
[5]: https://www.reddit.com/r/Drugs/comments/5tru38/what_is_angel...
[6]: https://www.reddit.com/r/serialpodcast/comments/2qove1/how_l...
[7]: https://www.drugabuse.gov/drugs-abuse/hallucinogens
[8]: https://www.urbandictionary.com/define.php?term=sherm
[9]: https://www.urbandictionary.com/define.php?term=Wet
[10]: https://www.urbandictionary.com/define.php?term=PCP
[11]: https://angeldu.st/en/game#play-now-button-3
[12]: https://en.wikipedia.org/wiki/Frank_Lucas
My name was inspired by a Gilfoyle line in Silicon Valley, which references Magick:
https://getyarn.io/yarn-clip/9481dd82-17de-4791-b110-0e58434...
(Since you’re on HN there is a good chance you’re familiar with the show - but if you’re not, the Gilfoyle character is a self-proclaimed LaVeyan Satanist)
All comments shown.
Couldn't load more comments. Check your connection and try again.