Thoughts / ideas on time passing and other things I'll n.t.k

Ok not sure if this should be here or in the getting started board but it’s something I know I’m going to have a lot of problems with… The main one is getting started.

I want my game to progress throughout the day, not necessarily at the same pace though since as far as I’m aware it would be controlled by the number of turns, actually question 1, is it? or are there other ways? My first thoughts are that I should determine the time by how long is spent (in turns) in a room then add extra time for certain events that get triggered… Am I on the (a) right track here? It’s not something I’ll have to think about just yet but I’ll want to take things into account as I build up the map and eventually npc’s to interact with (I have the map and some of the characters planned, I just need to figure how to make it all fit together right)

Question 2 is a bit of a simpler one, I read somewhere in the help that the no of restores and possibly no of saves isn’t saved between sessions, I’m wondering what is saved and what isn’t… For example I have items that use rand functions to change properties as characters interact with them but since I’m using randomize() that would be different each play through. I guess what I’m asking is does it save the state of the game at save (loc, property values, where everything is etc) Or does it save the method used to get there (n,w,pick lock, jump fence and take out guard with inflatable boomerang etc…). Obviously the latter would randomize certain results and could throw the game out of sync if left and restored later.

Lastly… is it wierd to ‘not get’ nested objects and functions in general? I think the word puts me off or something… Don’t answer the last one I just couldn’t think of another question and I will get them and how to use them properly :slight_smile:

It’s worth reading Mike’s essay on time in IF at the start of the subtime.t extension. The extension itself is a good default choice for a time implementation in TADS 3.

It is fairly trivial to save the # of saves.

SaveCounter: PreSaveObject
    execute() {
        libGlobal.saveCount++;
    }
;

modify libGlobal
    saveCount = 0
;

The number of restores can’t be saved in the general case, since the player could always close the interpreter, open it again, and restore from an earlier save.

You can track it per session by using a transient object, since transient stuff survives restore, restart, and undo.

TADS 3 runs in a virtual machine, and you can think of saves as a snapshot of that machine’s memory. It does what you suggest in your first example: it records the exact state of everything in the game. It doesn’t know what the player might have done to get there.

If you want that information, you can start a command log (with >record) and replay it (with >replay). But randomness tends to wreak havoc with this as you expect.

Phew and thank you! You’ve just saved me from procrastinative reading with yay more (I’m serious haha)

… It’s not so much that I was after keeping track of the number of saves or restores since as you say, someone could save, check path 1 doesn’t lead to instant doom then restore to see if path 2 leads somewhere better (something I personally detest but meh, leave people to it - a game should be a game that you follow not a “which choice is best / give better results”) it was more I was worried that it wouldn’t remember the state the player was up to… Does that include say if I wrote out a script for an npc to follow (go for lunch at 12, wander and talk to lunch lady, go outside, throw leftovers at flying pidgeon… which then in turn poops) and I was outside and 2 turns away from being pooped on… Is that script saved at the position it’s saved in or would restoring it save me from pidgeon poop? (There’s probably a better or easier way of asking that) like would it save what’s about to happen as well as the state?

Thanks for the links, I’ll have look at subtime.t I’ve been fretting thinking over stuff like “if it takes so many moves to do this but then they could do this or look at everything or choose not to look at anything, or if they do spend time here will they miss this or that might happen too early and so on…” I haven’t read it yet so I might still have to think about all that some more but thanks for that… do I just include that with my source files I take it or can I add it into one of the header (or my own, I remember you saying that you make your own header to include extra files actually)

I’ve just read through subtime.t and it sounds promising, it’s got me thinking though… Which is daunting in itself

I’m after events to happen at certain times whether the player makes them or not but then I’d like certain events to tie into the time, would I be able to use that to (this is where describing words fail me yet again) note relative time so as I’m not tied to events happening. Like have a time that an event would occur when the player gets there but then have events that would occur naturally up to that point but at approximate times (One thought was creating a subclass - the daunting thoguht I had, like one that would be irrespective of the player)

It’s (going to be) pretty much a free roam game with events that take place depending on the actions the player chooses, the idea being that if you do ‘a’, ‘b’, ‘c’ then you’ll make ‘g’ and ‘h’ though you might choose to wander off and do ‘d’, ‘e’ or ‘f’ or something/someone could change how the story plays out completely preventing you from making ‘g’ and ‘h’ because of something you did or didn’t do during ‘a’,‘b’ and ‘c’ (like taking too long or stopping somewhere on the way, or something you picked up) I know this may sound like a horrendous task to write but I have (most ish) the storylines written down already it’s just the writing it (in IF) part I have to do. I’m just wondering if you think it’s doable with subtime?

[rant]On a side note: Schrodinger’s thought experiment was Einsteins concept, Schrodinger just added a cat and put it to the man :smiley:[/rant]

The script is saved in its current position. If the player restores that save file later, the script will continue to run from the same point. If the player restores an earlier save file, from before the script started, then the script won’t have started and nothing will happen until the player triggers it again.

You just add it as an additional source file to your project. Headers are not involved in this case.

For this I would try combining subtime.t with Eric Eve’s scenes.t extension.

The idea is that you use scenes to trigger narrative events when a certain condition is true. When a scene starts, you can use it to cause a clock event, which updates the time if the player happens to check. And that clock event may make new scenes available, if those scenes are set to start after a certain time.

That’s excelent, thanks again bcressey, I can definately use them. I’m not planning on giving the player a watch at the moment (ooh I could… It wouldn’t be just a watch if I did though) but I could always call the checks to find what approx time it is and use that to decide when certain things happen (while pondering on turns I’d thought of using daemons but that’d be impossible to implement).

Scenes will definately be extremely handy since I could use that to drive the story forward dependant on what the player does and use subtime to decide which events are still open and which have ended too so double win

That’s what I hoped you say… Actually I wanted you to say you’d get pooped on but it means the same to me, btw nobodies actually getting pooped on :slight_smile:

Last one since I successfully distracted myself last night, to make a small bathroom as a nested room, what’s my best bet?

bathroom: Openable, Booth, (possibly something else?)

That’s as far as I’ve got on it, the actual coding bit should be easy, I’m just struggling to think of what to put it as… Oh can you have a nested room inside a nested room? Like could I put a shower in there that you could get in and out of?

Nested rooms are meant for cases where the player is still “in” the outer room, and it still makes sense to interact with objects located there.

For example, when the player is on a stage or inside a ticket booth, he should still be able to see the chairs in the audience or watch the crowd.

It’s probably going to be more trouble than it’s worth for a bathroom, and conceptually it would only make sense for one of those portable toilets in public places. Even there I would probably do it as a separate room and maybe implement some sense-passing for sounds.

A rule of thumb for nested rooms is never to use them if you can avoid it. They’re a useful tool for simulating certain environments but they’re hard to implement thoroughly and they can be a rich source of bugs.

So I’m not stupid for thinking they seem awkward. I was originally going to make it a seperate room but I played shades last week and thought the effect was good plus it made me think about travel messages and such… My mind may have been clouded over the last few weeks anyhow. I can make it work as a seperate room I may just have to add in a sense connector :slight_smile: