doukutsu-rs - a remake of Cave Story engine written in Rust

Jan 2, 2021 at 3:51 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Sep 13, 2020
Posts: 9
doukutsu-rs is a thing I spent last 3 months of my free time on, since I was quite active around CSMC and decided to learn Rust...

The current goal of the project is to build a Cave Story engine that lets you build portable mods (via Lua API, instead of hacking the executable or engine sources) and enhance it with some additional features over vanilla.

GitHub repo:
Discord community:
YT playlist:
Builds: (check the Discord server)

Features implemented at time of writing:
  • Vanilla is playable up to Sand Zone.
  • Mostly complete implementation of TSC.
  • Full touchscreen support on Android.
  • Has an early version of the Lua API.
  • Multiplayer ready - while no networked multiplayer is implemented yet, the engine is designed to be deterministic across computers regardless of delays and the NPCs, bullets and other objects are aware of multiple players.
  • A simplistic lighting engine (for now it works more or less like the one in Switch release, but it's more visually appealing and is a subject to future improvements) and shader effects.
  • Frame rate independency/motion interpolation - the engine's rendering is decoupled from the game loop - if a frame is being rendered between two game ticks the positions of objects on screen are linearly interpolated, resulting in very smooth motion at original speed, regardless of display's refresh rate (just watch one of videos in playlist linked above, the game runs at 60fps framerate and 50tps speed).
  • Some support for Cave Story+ data files, although it's not really my focus.
Is it an another decompilation?

It's not even meant to be one. But since the project is meant to be a possible replacement for binary patched Doukutsu.exe/CSE2 - I want to be accurate in game logic, so some reverse engineering was involved.
  • The rendering, trivial to do or badly implemented parts have a completely custom implementation, written using no or little (eg. to figure out the sprite positions or what properties do they set) original code as reference.
  • The more complex parts that are quite hard to reverse engineer accurately in a "black box way" (physics, NPC/boss AI) were based on code reverse engineered from original executable (linux/windows freeware or CSE2 if the code ended up being too buggy or I was too tired to analyze that shit - thank you for anyone involved in it). Since it was a manual job there's still many bugs resulting from typos, wrong understanding of decompiler output and other things.
  • (Partial) support for Switch CS+ data files involved no code reverse engineering due to huge legal uncertainities and after all was still easy enough to implement using "black-box reverse engineering" way - just by looking at data files and playing the game itself. However, I still don't know if the implementation is correct and I don't really care - it's not the goal of the project and extracting the data requires a hacked console and some effort.
(I think that the project's "legality" might be compared to NXEngine, which both uses original implementations for many things and decompiled code for complex parts - and is still fine after years)
Jan 2, 2021 at 7:06 PM
Based Member
"Life begins and ends with Nu."
Join Date: Dec 31, 2011
Location: United States
Posts: 2315
Age: 27
Hey, this is really cool. I just watched one of the videos of the engine, and those visual effects look amazing. Both the lighting from the items and in the shack, as well as the blurry effect from the water were really cool. It's really interesting what dynamic you have with 2 players there, it can cause the game to function in weird ways that Pixel never intended, like one of the players going offscreen, or that moment where one of the Quotes hangs back at the entrance to the reservoir while Toroko spawns, and is able to approach from behind to trigger that cutscene of her running away. I know that in the Switch 2-Player mode, they handle moments like that by having one of the other players change positions, like having the other player spawn to your position when you get the pendant. There are so many factors to consider during boss fights and such, and it's interesting seeing what happens in the Balrog fight when he grabs you, causing the players to get merged or something.

Nice project here, I hope this ends up coming farther along and doesn't face any big obstacles.
Jan 17, 2021 at 8:30 PM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 4, 2018
Posts: 15
rip nxengine
Jan 24, 2021 at 7:23 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Sep 11, 2014
Location: Out of Nowhere
Posts: 95
This looks really good! With the future of CSE2 still up in the air for the time being, this looks like it could be a great alternative to that and NXEngine once it's fully working. Not sure if I'd be able to help out with this at all, but I'm really excited to see where this project goes!