I recently finished porting a game that a friend and I wrote together a few years ago from Python to Nim, and I released the initial version (0.1.0) of this port.
The game, which is titled The Last Gardener, was originally created for PyWeek 21, a week-long challenge in which submitted games must be created mostly with Python. This game used the pyglet library originally, but the Nim port uses nimgame2 instead. It's a bullet hell game in which the player has to mow lawns with a drone while avoiding bullets that are being shot by aliens. It's silly and doesn't really make any sense :p
I wanted the Nim port to behave as closely as possible to the original Python implementation for 0.1.0, which also means that I intentionally kept most of the flaws that the original PyWeek submission had. Future versions that may be released in the distant future will hopefully improve the game by ironing out these flaws, cleaning up the messy source code, and maybe add new features and levels. Porting the game was not difficult, and I had fun doing so, although I did run into a few issues along the way. The Nim port performs significantly better than the Python version with less effort on my part, so I'm really happy about that.
For now, probably the biggest issue with 0.1.0 is that the difficulty is very high, so if you do not have any experience with bullet hell games, easy difficulty is highly recommended. I don't recommend hard difficulty because it was mostly untested due to lack of time back then, and it is probably ridiculous and unfair, but you can attempt to beat it if you want.
Anyway, the source code of the game is here: https://bitbucket.org/Jjp137/last-gardener
Linux 64-bit builds are here: https://bitbucket.org/Jjp137/last-gardener/downloads
For other operating systems or architectures, you'll have to compile the game yourself, unfortunately. Instructions for doing so are in the README. Note that you need the devel version of nimgame2.
Finally, here's a screenshot. The game relies on using openly-licensed game assets from websites such as OpenGameArt as well as public domain images for the nonsensical story, so don't expect this game to be pretty. I hope you have fun, though!
That's odd. Can you revert any changes you made and show me the compiler errors? Also, what version of the Nim compiler are you using?
I tried compiling it in a Linux VM that initially didn't have Nim 1.0.4 in it and it was successful, so the error message will be very helpful in figuring out what might be going on.
last-gardener/src/pattern.nim(73, 16) Error: type mismatch: got <HSlice[system.int, system.int]>
this one can be fixed by importing random, but then this error pops up.
last-gardener/src/scenes.nim(104, 9) Error: attempting to call undeclared routine: 'initScene'
Ah, right. The version of nimgame2 you currently have is either not from the devel branch, or it was from the devel branch but is now too old.
Just run nimble install nimgame2@#devel to fix that. You'll also need to update sdl2_nim or else you'll run into this issue, so also run nimble install sdl2_nim@#head.
I should amend the README to give some hints about that.
For reference, these commits should work:
Aren't Nimble packages supposed to be libraries and other tools, such as nimterop's toast binary, that help people create code? I don't think it makes sense for a game to be in someone's ~/.nimble/bin (or equivalent), and I don't expect anyone to use this project as a library. Installing a game as a Nimble package seems strange to me since it provides no utility to other programmers.
However, does Nimble support something like requirements.txt files which are read by pip? (pip is Python's package manager.) Can the user provide the name of a text file containing a list of dependencies and have Nimble install each of them? I haven't really looked into Nimble much, but if that exists, I could at least create that. I've seen Python games whose instructions for getting the game to work include running pip install -r requirements.txt and provided that everything is listed, the game runs fine afterwards.
Or am I completely off the mark somehow?
Nimble is not just a package manager, it is also a build tool so if you want something like requirements.txt, Nimble is the way. Many binaries are distributed with Nimble since you can describe the dependencies with specific versions or ranges.
It does not have to be installed into ~/.nimble/bin, you can always just git clone and nimble build -d:release and you'll get a binary. But it's even nicer if you could just do nimble install lastgardner.
I don't think it makes sense for a game to be in someone's ~/.nimble/bin (or equivalent), and I don't expect anyone to use this project as a library.
Why not? If someone wants to play your game they may want to install it into their PATH :)
Can the user provide the name of a text file containing a list of dependencies and have Nimble install each of them?
You can specify the list in your .nimble file, like so (the commit hashes/packages are not real):
requires "foo#abcdef1234"
requires "bar#fedcba4321"
Of course, currently you need to do this manually for each dependency which sucks, but eventually Nimble will make this much easier through lock files.