Ok it's been about a week since the last post, and I've improved on quite a bit of stuff.
- Implemented an event-driven communication system for game objects
- Instead of trying to directly access another object's data or continuously check a condition each frame, objects can now send "events" through a central event dispatching system. Objects can register with the EventManager to receive notifications for specific types of events like "Event_Game_ActorCreated" or "Event_UI_MenuOpened". Each frame, the EventManager stores events in a queue and dispatches them in the order they were added.
- Revamped the input handling system
- Keyboard and mouse states are now recorded in handler classes. This allows more advanced state information to be recorded that the native java handler doesn't support(or I don't understand how to use), such as distinguishing between operations that require a key to be held down versus just pressed once. My input handlers store the key states as boolean values in a int array (since keycodes are ints). Each frame it updates and the advanced state of the key is stored in a separate array of enum KeyState, which has PRESSED, RELEASED, and ONCE, where a key is ONCE only the first frame it is pressed. This is useful, for example, if pressing a key opens a menu; you want to make sure the menu only opens once even if you hold the key down, otherwise it would keep opening and closing non-stop
- character movement is much smoother now with this system
- Added a really simple and poorly designed dialogue system, but hey the text scrolls! :D

- Added some awesome translucent in-game menus. Escape brings up the system menu with save, load, exit, etc (only the resume button does anything right now but its easily extensible). T opens the game info menu with player stats, inventory, and skills.
- Improved the map editor
- I made it so that the editor only draws to the visible area in the scroll panel (I'm at a loss as to why that's not already a feature) so I can create HUGE maps now with barely any lag. Even a 999,999,999 x 999,999,999 map ;). But if I try to fill everything with tiles it freezes at around 2000x2000, though I'm not sure if I could fill it manually or not. Anyways that's big enough since the game will connect multiple maps.
- The tiles are also sorted now! There's a new panel that allows you to select the type of tile you want to paint, like terrain or trees or characters or whatever. It's not complete but the implementation is there.

- Now for some random details.
- I reorganized the class structure for renderable things, so stuff like Character extends a Sprite class which encapsulates the drawing information.
- I also took the big enums like GameState and EventType and made them their own classes cause it was really annoying to have to make the static reference every time.
If you haven't noticed this post was much more detailed than the rest. I started keeping a change log so I'll remember what I did for each update. Still no combat system, I'll have to get working on that sometime lol.
No comments:
Post a Comment