• entries
31
27
• views
26241

# Rogue restart

615 views

I'm looking towards a redesign, big re factor. I've moved onto keeping aspects of the game into their own systems. It's made the way I handle actions/events quite a mess. I'll have to butcher it to handle the abilities I have planned.

The current system, events, specifically key presses are checked to call the action that's assigned to them. Any time an action succeeds I set a flag to simulate a turn. Then simulate the turn, applying ai, remove dead things, gain levels...etc

game onKeyPress case : key = p bool simulateTurn = pickupItem(...) simulateTurn if true
This is further complicated by an actionState that I used for multiple state actions. Using item in the inventory used to take two steps; choose to 'u'se an item, and choose the item to use. The system that morph out of that right now uses a always on cursor to the item in the inventory you want to use. Now pressing 'u' automatically tries to use that item.

game onKeyPress if (actionState == idle) check player moving check pickup check drop check eat ... if (droppingItem) choose item to drop write to console if (eatingItem) choose item to eat write to console if (drinkingItem) choose item to drink apply potion effects write to console ...
Most of it is redundant, just like that. The change to the inventory removed a little bit of the redundancy and I feel speeds up inventory use quite a lot. I want to keep things fluent as possible.

I'll be using a simple interface to derive systems from, and contain all logic and state to these systems. The interface will basically just need to be over-ridden and used to dispatch to the specific actions that system handles.

system virtual bool onKeyPress(...)
Then the logic of the game will be separated into these systems;
item systemdungeon systemcreature system
Unfortunately, for my sake, I'm going to restart this project. Taking whats still reusable and glueing it to the new system skeleton. I'm hoping that similar to starting this project after the last should go rather quickly. It'll make things easier for me in the long run. It's getting a little complicated to do these re-factorings any more. Unfortunately what I had designed before is not allowing what I want to do.

So ill leave you with a little snippet of what I had going before all this came to fruition. I have reimplemented all my items, with the new concepts already. Added a drop system similar to Diablo 2's drop class system. Drop classes contain lists of items that can drop and the chances for those items. Then things like creatures or chests are assigned a drop class. Got creatures and basic AI up and running.

There are no comments to display.

## Create an account

Register a new account