GitHub is running a game jam for the month of October, and I’ve decided to at least try, and hopefully use it as an excuse to blog more, too. The theme is “hacking/modding/augmenting”, so I’ve tentatively decided to work on a homage to an old online LEGO game, “Spybotics: The Nightfall Incident”. It’s a fairly standard turn-based strategy game, but the health of your units isn’t based on some innate pool, but rather on how many tiles they’ve moved—each tile you move gives you one health point and leaves behind a trail occupying that tile. Thus, you can use it to block enemies (or yourself), but you also have to keep in mind that your trail leaves you open to attack. There’s a limit to the length of trail you can have—after that limit, moving will delete the end of your trail.
This is a project I’ve tried before with re/hack. Where I got bogged down there was (1) the start of college and (2) trying to recreate the game too faithfully—the world map and graphics more work than I anticipated. This time around, I’m planning on trying using Rust and ncurses, building an ASCII version of the game.
First challenge of the jam: mouse movement event support in ncurses. I
found this gist which explains how to do it in C, and it was
fairly trivial to port to Rust + ncurses-rs. Then I tried to get it
working with a window as well. (In ncurses, a window is a subregion of
the screen that you can render to and update independently.) After a
lot of digging, it turns out that mouse movement events aren’t
correctly reported with
wgetch (which polls a particular window for
input events)—you can only poll the root window (
getch. Once I got that out of the way, I’m happy to report that
mouse movement events work just fine.
Follow along at my repository.