Testing rooms

Started by dbuske, Fri 06/05/2011 17:20:13

Previous topic - Next topic

dbuske

Is there a way to test rooms without having to walk through every room each time?
If it is not possible, maybe this is perfect for a module.
What if your blessings come through raindrops
What if your healing comes through tears...

monkey0506

You could use the Debug function, but it wouldn't instanciate room or global variables with real in-game values, so you might have to deal with that yourself.

Wyz

The trick is to keep track of the game state. The way I do this usually is make functions that change the game state to a certain point in the story. It really helps to keep things organized, and prevents bugs.
When I write the story of a game I divide everything in acts and scenes. For each act I will create a function that set each variable and room/inventory/character in the correct state. For scenes I create functions that set all variables/rooms/inventory/characters changed since. Usually the scene function put the game into the state after some cut-scene has happened, so I can skip that as well.
For debugging if I want to test scene 5 of the second act I will call:
Code: ags

Act2()
Scene1();
Scene2();
Scene3();
Scene4();


I will only need these functions for debugging and skipping portions in the game but usually I call the Act functions anyways to make sure no variables slipped up. I's a bit more work I guess, but it helps speed up testing very much.
Life is like an adventure without the pixel hunts.

Snarky

That sounds like a smart approach, and I think I'll try that for the game I'm working on at the moment, where I'm just starting to deal with the story progression logic. (My first step was to create an enum for the various sections of the game and a variable to keep track of the current state.)

I have to point out that this approach basically assumes a linear game structure, though. not that it mightn't be useful for a nonlinear game too.   

monkey0506

Well another way of keeping track of the game state might be to make use of my Stack module, which allows you to store any data type (including custom struct types, with some specialized custom serialization functions), and doesn't have any maximum size, so you can essentially store any/all data you need. The current version is not as optimized as it could be, but I could work on it if someone needed it to run faster.

This approach (whether with or without my module :P) would probably be the simplest for non-linear gameplay.

dbuske

Thanks for the replies. Very helpful.
What if your blessings come through raindrops
What if your healing comes through tears...

SMF spam blocked by CleanTalk