29 Jul 10

Events and handlers and stuff

So basically, the upcoming Unity version of Desktop Dungeons is running on a homebrewed, event-based system of awesome programmy proportions. This system offers several distinct advantages over what I (clumsily) implemented for the freeware.

All your edge cases are belong to us. How did I ever get my programming degree?

VALUABLE POINT ONE: Since every meaningful game event that we play through has a set of values which can be stored in association with that event, we can save “playthroughs” of individual game sessions and replay activities at our leisure. Read: player input, easy debugging!

VALUABLE POINT TWO: Instead of writing special case code for every unique combination of scenarios that get tacked on to the system during dev (think of about half a dozen conditional statements for most common occurrences), we can allow a potentially limitless number of handlers to listen out for any events that we want. For example, when the character gets poisoned, we get a health bar handler to listen out and change the input to green, while a player poison handler usurps the role of the regular regeneration handler whenever dungeon tiles are revealed. Then, without much trouble, we can add extra effects to the poison later by simply adding new handlers that listen out for it.

Those of you who have ever studied computer science formally have probably heard of event-based systems like this before, so some of this should already be ringing some bells. For people like me who kept falling asleep in class, the process has been rather challenging to get to grips with, but the net result for players is undeniable: a bigger, better and more flexible game system that’s easy to extend at any time!

Copyright © 2019 QCF Design
Powered by WordPress, theme based on one from Themelab.com