June 19, 2019

MRPG #1 - Turn based RPG combat and GUI improvements

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

Old GUI animated gif - Text only

New Combat GUI

New GUI animated gif - Sprites, health bars, etc.

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

Generated using git log.

© Ole Herman Schumacher Elgesem 2019

Powered by Hugo & Kiss.