Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: dbuske on Fri 06/05/2011 17:20:13

Title: Testing rooms
Post by: dbuske on Fri 06/05/2011 17:20:13
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.
Title: Re: Testing rooms
Post by: monkey0506 on Fri 06/05/2011 17:56:27
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.
Title: Re: Testing rooms
Post by: Wyz on Fri 06/05/2011 18:44:58
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:

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.
Title: Re: Testing rooms
Post by: Snarky on Fri 06/05/2011 19:11:54
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.   
Title: Re: Testing rooms
Post by: monkey0506 on Fri 06/05/2011 19:39:51
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.
Title: Re: Testing rooms
Post by: dbuske on Fri 06/05/2011 19:54:34
Thanks for the replies. Very helpful.