About coding possibilities


Hi guys! Out of curiosity, and for future reference, has anyone ever attempted, or are there any Choice of Games stories that have successfully incorporated an inventory into the game?
Also, is it possible in a game to go back on yourself? For instance, if a game included a page when you’re in a living room and a page when you’re in a dining room, would it be possible to go from the living room to the dining room and then back to the living room again?


All these things are certainly possible: “Trial of the Demon Hunter” and “Life of a Wizard” both have inventory systems, IIRC. Making persistent locations you can go back to is pretty simple with *goto commands.


Okay, thank you :-bd


Perfectly possible and commonly done, I believe. My game involves investigation, so you can explore rooms or homes or whatever, requires free navigation of the scene. Like Cataphrak said, it’s all about the *goto commands. There’s also a framework for an inventory system floating around on the forum too, could be on the wiki as well…


What *I* want to know in coding possibilities is if it’s possible to have a randomly generated story, randomly genrated worlds, random events, a combat system and a levelling system with stats in.

Pretty lofty expectations and hopes. :stuck_out_tongue:


It’s possible to make the world procedurally generated, maybe, if you have a generator fixed with your game, but I doubt it’s possible to create random events and a random story.


That does sound good. The only worry I have about the *goto commands is that (as far as I know) all the information would have to be on the same page, since I think that all the scripted pages have to be done in a certain order, which would mean that if you wanted a game where the locations you went to had no particular order, it’d all have to be on the same page… Which sounds like it’d get pretty crowded :stuck_out_tongue:
And yeah, random variables would be awesome :slight_smile:


There is a Rand command in Choicescript so if you give each number a scene or text you could make random scenes etc, it would be a lot of work but you can


Yes, random events are possible. And procedurally/randomly generated locations are also possible.


Something like that would be way more work than it would be worth, in my opinion. Certainly possible, but really taxing and time-consuming.


@Saracenar Fair enough. There are better ways to create replayability.


Although I would really like random encounters and a combat system though. Maybe a dungeon option, with random generation. A randomly generated story sounds good but… downright ludicrous. I can’t even imagine the time and effort needed to code a whole randomly generated story that’s long enough, it would take painfully long and just would be cool, but to make it a long game, it’s going to take years, not to mention the difficulty in creativity used to decide like a MILLION factors to make the game flow, even randomly. Maybe someday, someone could try though.


In Blackraven, the breakfast, lunch and weather are random each day (the weather also changes according to the season). Also, the start to each day changes randomly too, meaning each playthrough has subtly different text.


What Kaosorer_6 has proposed is definitely possible, and with the new gosub_scene command, loading issues can be reduced.


@andmywhy Wow! That sounds great!


*gosub_scene is actually horrible in terms of loading, it loads the entire scene you specify (even if you’re only running five lines of code) and then jumps to the label and on the next *return loads (or restores?) the entire scene back. So you tend to get a very noticeable and annoying loading bar when using it as standard, though Dan did point out that if you compile the game or package it as an app(?), the load times won’t then be so noticeable.

Not to trash the command (it is very useful after all) I’m just pointing out (from experience) that it isn’t actually quite as seamless as *gosub is, and it will often throw up a loading bar for a second or two depending on the size of the scene your referencing (though again this can reportedly be avoided if you package the game).


@CJW, while I have read about those concerns in another thread, it still may be preferable to use if you have several gosubs in a single scene (in Blackraven, the yard scene, each day there are many activities you can choose from, all of which are quite lengthy). Being able to have a small central scene, and gosub_scene to different medium files could be more preferable to loading one large file at the beginning.

I haven’t amended Blackraven with gosub_scene yet - as Sam said, he has a 40k word file and has few problems. My Blackraven scene is about the same size and as it is, isn’t a problem. If the file gets too much bigger, which is likely, then I may start investigating.


Oh yeah, if you’re loading huge parts of the story via *gosub_scene it’ll be great, for organisation if nothing else. But when using *gosub_scene for calling really short (but often reused routines) like an inventory system or level up routine for example -particularly in the middle of a normal page - the loading bar (and time) can be annoying. But as said before, it does seem like packaging or compiling helps alot - so it’s not a huge concern.

Anyway, sorry I’m not trying to trash the use of the command here, I just wanted to make that people didn’t take you saying “loading issues can be reduced” in a literal sense (i.e. it loads everything lightning fast).


That’s a good point, well said. :slight_smile:


Agreed 0.0