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

Matt Wynne matt at mattwynne.net
Thu Feb 2 05:45:22 EST 2012

On 2 Feb 2012, at 09:50, 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… :(

Have you started to design a domain model for this? Could we see a picture?


Freelance programmer & coach
Author, http://pragprog.com/book/hwcuc/the-cucumber-book
Founder, http://www.relishapp.com/
Twitter, https://twitter.com/mattwynne

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120202/e8b98be3/attachment-0001.html>

More information about the rspec-users mailing list