Recently, I’ve done a lot of work on my unnamed game project, MRPG, so I thought I’d share some of it. The game is turn based, open source, written in python, with a focus on the combat system, and inspired by famous JRPGs such as Final Fantasy and Pokémon. It’s been a while since I posted about it.
GUI
A lot of improvements were made to the GUI version of the game. Following what is happening in battle is a lot more intuitive, as you have to click through the battle events one by one. Sprites and animated health and mana bars were also added.
Old Combat GUI
New Combat GUI
Combat system
I rewrote a lot of the combat system to use game events to a much larger extent. These game events can be things like damage dealt, effect applied, creature killed, etc. A key aspect of the event system is that they can be generated and then resolved (applied) in 2 separate steps. This gives a lot of flexibility in ordering, as well as how to present them in the GUI. The main advantages are:
- GUI user experience is a lot better now, since events wait for the user to click (enter)
- General code quality and maintainability is better
- Some edge case bugs in combat were fixed
- It’s significantly easier to write automated tests for the new combat system
- Adding new features is easier
Internally, these events are generated using python generators. To enforce correct ordering in combat, the code assumes that events are resolved before the next one is requested. This means that the generators hold some internal state, instead of having to keep variables for what has happened and what will happen in normal variables. Adding features or making changes to the combat system is intuitive, as the generators look like sequential code.
Changelog
- Added basic creature sprites
- Added skill hints in GUI version
- Cleaned up GUI refresh code
- True strike now has priority, and is used before other moves
- Animated health and mana bars
- Removed CRLF line endings
- Removed old battle GUI and scaled new one
- Whitespace
- Added new battle GUI
- Fireball now has a custom burn message
- Added variable in resolve() for convenience
- Added punctuation to all in-game messages
- Stat modifiers are now applied immediately
- Moved some menu code to gui module
- Renamed outputter to printer for clarity
- Renamed function update_text to refresh_gui
- Made terminal version work again with new events
- The next enemy in an adventure now spawns after reading
- Refactored progress battle and adventure code
- In-game events are now resolved as you click enter through messages
- Ensure that creatures pick a skill once per turn
- Renamed Event apply() to resolve()
- Removed applier code, which is no longer used
- Made the header and stats hidden when printing output
- Replaced magic constants with named variables/functions
- Made outputter index a local variable
- Added –parallel option to yapf commands
- Reduced size of scrolling text in GUI to 3 lines
- Moved GUI text outputter to bottom of screen
- Menu is now hidden while printing output in GUI
- Added pre-commit hook to run yapf and tests
- Added make check/test command
- Added tests for speed and effects
- Ran yapf to format python source code
- Added terminal command to Makefile
- Removed extra newlines in battle output
- Added yapf commands to Makefile
- Ran yapf to format all python source code
- Added battle test
- Cleaned up battle turns and event generators, fixing effects
- Added combined events
- Removed internal output pause events
- Simplified window resizing
- Made default resolution smaller
- Made fullscreen work on OS X
- Stopped using fixed aspect ratio
- Stopped using default window resize
- Fixed window resizing
- Cleaned up State and text display
- Removed Unneccessary Output class
- Fixed window resizing
- Fixed resolution problems on mac