[rspec-users] Game development: how to test interactions like an attack?

George Dinwiddie lists at iDIAcomputing.com
Thu Feb 2 12:24:17 EST 2012


On 2/2/12 4:50 AM, Romain Tribes wrote:
> Hello,
> I'm writing webgames with Rails and I want to test my code (and even TDD) but I'm really stuck figuring what to test.
> I read a lot of articles on the subject but I still don't know what to do in my case: how to start?
> For instance, a simple interaction in most game: a character attacks another one. What should be tested?
> With words, here is what I can say about an attack:
> It's an action from an attacker to a target.
> The attacker may have a weapon and the target may have an armor.
> In order to be successful, the attacker must hit the target,
> according to the combat skill of each actor and the precision of the
> weapon.
> When the target is hit, it receives damages according to the attacker
> power, the weapon damages and the resistance.
> A part of these damages may be absorbed by it's armor.
> So, what could my specs be with that? I really can't start… :(

Start with the simplest scenario you can imagine.

What would happen if the attacker had no weapon and the target had no 
armor? I can imagine scenarios with each having little skill, with each 
having great skill, and the two unbalanced scenarios where one has great 
skill and the other little.

Is it possible for the attacker to miss?

  - George

   * George Dinwiddie *                      http://blog.gdinwiddie.com
   Software Development                    http://www.idiacomputing.com
   Consultant and Coach                    http://www.agilemaryland.org

More information about the rspec-users mailing list