With the semester winding to a close, a friend and I are planning to use the summer to build up our game-design portfolios a bit. We have a basic theme, setting, mechanics, etc, though much of it is still being discussed and fleshed out, and no code's been written yet. However, in our most recent discussion we touched on one of the problems we may run into. Namely, special attacks and complex rules. Over the course of the game, the player will control a variety of different creatures, and between his/her own powers, and those of the varied creatures, we will need to model an equally wide variety of special attacks, and potentially complex rules.
Where we've run into trouble is determining how to do this. Simple things like damage ranges/types, armor, and the like are simple enough - even attribute damaging attacks could be written simply by adding another damage type or so on. But for effects lasting over several turns, or overlapping effects, or effects which depend on the type/race/etc of the creatures involved, etc would be far, far more complicated to model in such a static way. The way I see it, we have a few options for these more complex/dynamic parts:
- Hard-code the specials/rules
- Define the specials/rules with an external scripting language (I.E. Lua, python, etc)
- Model these rules with predicates
The first option would work, and would probably be the simplest to write initially, but maintaining and expanding would be a pain, and would result in rather deep nests of ifs/switches/etc. The second might work as well, but as we're working in C#, and hopefully deploying to the Xbox, we would have to find one which compiled with the rest of the code, or ran on the Xbox as well as a PC. Additionally, figuring out which scripts to attach and when, and in what order could also be rather tricky.
The third option I like the sound of, but to be honest I have no idea how to even begin to implement it in C# There was an
interesting discussion on this particular method over in the RPGCodex forums, but they are, if I understand from my skimming, discussing the implementation in LISP or a similar language.
Also considering a combination of the third and second - that is, a list of conditions (I.E. if attack deals fire damage, defender is a plant-like creature) and then a script to go with them (dmg*=2), though I'm not quite sure how I'd want to implement this one either....
Any thoughts or input would be very welcome.