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

Julian Leviston julian at leviston.net
Thu Feb 2 06:36:32 EST 2012


I always find it's very good to start simply.

Make the simplest spec you can imagine, then the next, and so on...

What is a spec? Some of this stuff might seem so obvious... for example... when you start playing your game, you expect that it'll present you with something... write a test for that. Basically any time you're doing something yourself to run your code, you should be able to spec it. That way you don't have to manually test things out.

So I've got a basic question: have you started building your game? Do you have any idea of the requirements at all?

Julian


On 02/02/2012, at 8:20 PM, 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… :(
> 
> Thanks for your help!
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list