Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Glenjamin on Tue 17/07/2018 17:47:40

Title: Constant global variable check framework
Post by: Glenjamin on Tue 17/07/2018 17:47:40
I'm currently designing a game with many variables that change events in-game. I want to get the framework right at the start, let me know what you think.

Variable sets:


Day/night cycle seem pretty simple enough. After a certain amount of ticks, Hour += 1;. Once the hour reaches 12, hour = 0;.

I'm thinking of having a script that runs in every room, which checks the hour. The hour then determines the NPC script. Within the NPC script, it checks player-based variables, which then chooses the behavior.

This can get messy VERY quickly, so what do you think is the most efficient way of going about this?
Title: Re: Constant global variable check framework
Post by: Snarky on Tue 17/07/2018 19:04:33
It doesn't sound all that daunting, but I would suggest isolating the logic in a module (or several modules, if there are separable elements of it). Also:

Quote from: Glenjamin on Tue 17/07/2018 17:47:40
  • These behavior sets are also modified by player-based variables. Is the player liked, has the player killed someone, what is the player wearing? (All controlled by int variables)

This sounds like a job for enums!