Testing a game from a certain place in the story, after savegame-breaking change

Started by gnomix, Fri 19/08/2022 19:15:24

Previous topic - Next topic

gnomix

Hi there people.

Could someone suggest a smart way to test my game which is growing in size?

I have created a certain number of rooms, characters etc. Of course, there is an order in which things have to be done to progress in the game. The usual point&click way.
So far, I've been testing just by playing it, but I've already come to a point that it takes too long to just play it from the beginning every time.
And often, when I find I have a bug (or have just forgotten to implement some part), I have to add changes which break loading of savegames. (not so hard to break, actually)
Then, I have to start over from the beginning. Might be the beginning of a chapter, but still sounds stupid to do it every time.
I keep the information which I need to carry over between rooms in global variables as flags, which I already see is something I'll have to change soon, but currently that's how I do it.

So, can someone suggest a good way to take the game to a certain "story-point" without replaying everything before that?
Maybe creating a script to auto-play?
Using some additional tool to automatically click around? (like an automated UI-test)

There is no way this is the first time someone has come to this problem, but I haven't been able to find a similar topic on the forum so far.

Thanks already!  :)

Crimson Wizard

The typical solution is to organize your game in steps, where you can clearly define what is required for reaching each step: story variables set, characters moved to rooms, inventory given or taken, and so on. Note that I am not speaking of any player action, like walking around, or reading the dialogs, but the logical changes in the game only.

After that you will have a list of all things necessary to change from step A to step B, and so on.

Then you will be able to write a function that advances the game from start to any given step, by iterating through these steps one by one, until it reaches the required one. To clarify again, it only changes the logical state, and does not really simulate walking etc.

To give some example:

0. Game starts.
Step 1. Player have talked to character A (set boolean variable), got items B, C and D, and unlocked the door (another boolean variable, since the door may be an object in the room, and may not be accessible from anywhere).
Step 2. Player have used and depleted item B, so it has to be removed now, but solved a puzzle (set a boolean variable).
and so forth

newwaveburritos

What I've done in the past is make a debug GUI where I can manipulate the variables of the story and game progress manually.  This also gets weird and complicated and I ended up playing the game the same way every time essentially speed running the game which led to some unintended consequences when I tried playing it without keyboard shortcuts but if you're careful you can probably avoid a lot of these.  Crimson's chapter approach seems pretty logical, too.

gnomix

Quote from: Crimson Wizard on Fri 19/08/2022 19:32:12
The typical solution is to organize your game in steps, where you can clearly define what is required for reaching each step: story variables set, characters moved to rooms, inventory given or taken, and so on. Note that I am not speaking of any player action, like walking around, or reading the dialogs, but the logical changes in the game only.

After that you will have a list of all things necessary to change from step A to step B, and so on.

Then you will be able to write a function that advances the game from start to any given step, by iterating through these steps one by one, until it reaches the required one. To clarify again, it only changes the logical state, and does not really simulate walking etc.

Thanks for the quick reply. You've given me plenty to think about.  :-D

I'll try to structure some code around this idea. I guess I'll have to build some kind of directed graph of story events, and keep track of the nodes which have last been achieved. Then if I want to start from a certain point in the story, in every Load function of a room, I can re-do all the actions which the last nodes depend on, and have some impact on the current room.
This could make my global variable use a bit nicer too. Maybe. :)

Something like that, anyway. If I figure out something really practical, I'll post here.

Thanks again!  :-D


HandsFree

What I'll do is set all the flags and inventory I need to test a specific part of the game in a function and call that from game_start.
Plus I change the starting room for the player character in the editor. Or maybe that's also possible in code?
This is an example from the gateway game (it's much longer but you'll get the idea).
For a regular playthrough just comment out the testing function in game_start.
I don't remember if the game_start function used here is part of a template or not.

Code: ags

function testing(){
  ////////////////TESTING///////////////////////
  SphereInRoom = true;
  bSeenPerry = true;
  //bDeepPsych = true;
  iGoldCredit = 150;
    
  cEgo.AddInventory(iGreenBadge);
  cEgo.AddInventory(iMemo);
  cEgo.AddInventory(iBook);
  //cEgo.AddInventory(iMedallion);
  //cEgo.AddInventory(iSalamander);
  sShield = "Nemira 3";
  
  ////////////////TESTING///////////////////////  
}



Code: ags

// Called when the game starts, before the first room is loaded
function game_start() {   
  // Put the code all in a function and then just call the function. 
  // It saves cluttering up places like game_start.
  lblScore.Visible = false;
  lblScoreText.Visible = false;
  btnDataMan.Visible = false;
  bSave.Enabled = false;
  btnInvUp.Visible = false;
  btnInvDown.Visible = false;
  
  Initialize();
  //testing();
}

SMF spam blocked by CleanTalk