choices for a player in a game - scripting rules?

Started by gypsysnail, Tue 12/01/2010 15:33:19

Previous topic - Next topic

gypsysnail

Hello, I'm back for a bit and just have a question. At the moment I am developing a large scale game and it will involve, at the start of the game, for the player to choose a few things to do throughout the game. So I am imagining an important and probably very difficult programming sequence will be needed for this aspect?.... If so... will the programming rule be like an (if) type of rule? 'if this subject is chosen, then this sequence will be.......' and an object would appear in that room later in the game in accordance to that selected choice of 'subject'?

Another question while at this, is the player will have a choice to choose from 2 main characters in the form of female or male at the start, and will this be a complicated programming sequence too? I just need to prepare myself. I am starting a programming course this year so that should help, but I am pretty hopeless at the logical stuff at this stage. I'm better at the art stuff but I really need to learn the programming myself as I am doing it on my own (cant afford to hire a programmer at this point in time, though I probably will ask you guys for help often as the game creation progresses this year)........ let me know if I have not explained the above properly, it might seem confusing to you because I don't want to say what the game is about at this stage, cos of copyright issues and its too early in its development stage.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

monkey0506

Well based on your description it's a bit difficult to say exactly what level of programming knowledge would be needed to get what you're looking for. However if you want to have events like "if this subject is chosen then turn on this object later when the player is in that room" you might want to take a look at the OtherRoom module by SteveMcCrea. That would allow you to set from the initial room whether objects, hotspots, regions, walkable areas, etc. in other rooms should be on or off. If you have any character-related settings those can be set without the need for a module since characters are game-wide.

As for the player character selection that should be fairly straight-forward. You have to have one player set in the editor as the player character to start the game. Let's just say you have it set to cMale. Then in the very first room you would display some type of menu (whether via a GUI or just using room hotspots) asking the player which character they want to use. If they choose cMale then all you would have to do is perhaps confirm their response. If they choose cFemale then you would just need to call:

Code: ags
  cFemale.SetAsPlayer();


Followed by whatever message you may want to display to the user (if you want to do confirmation, make sure you do it first before calling this code ;)).

Beyond that if you get to a point where you have more specific questions we're always willing to help where we can. I recommend going through the scripting tutorial in the manual. It's very useful when you're starting out learning about programming in AGS.

Helme

That doesn't sound very difficult to me, but like lots of work. You can handle that with global variables.
Whereever you want that the decision matters, you have to check the variables- something like that:

Code: ags

function room_Load(){
if (Decision1==0){oChainsaw.Visible=false;}
if (Decision1==1){oChainsaw.Visible=true;}
}


If you only want to check one var it's not that much work, but if you have several, that depend on another it will mean lots of work.

Crimson Wizard

In my opinion this isn't a question of programming, but rather of logic. If you will be able to keep the logical threads in head (or better written somewhere, like in some design documentation), making a game won't be that difficult.

Also note that when Helme sais "if you have several, that depend on another it will mean lots of work" it does not mean "it will be so hard you better not try"  ;), it just means you will have to do lots of planning and typing.

Apart from these points, toggling/doing something depending on previous decisions is basic of games and easily solved using "if" statements as in Helme's example above.

gypsysnail

Oh thank you guys! That boosts my confidence more. Yep definitely you are right, a lot of work but it sounds like it could be easy and with your help (credits to those that help of course!) I'll build a great game.

So I am thinking the character selection for the whole time of the game should be easy. So at start, a gui is needed for the player to select the character, with a response of saying "u sure u want to play john (male)" and confirm a yes so that the character is male for the whole game with no switch overs during the game, thats possible yes?

Subjects for each room based on the 'if (decision)' scripting rule sounds good! I will turn to u guys for help on that one I believe. A few subjects will be selected - a maximum of 4 choices will have to be chosen from about 15 to 20 choices. That will be a lot of work I gather but easy? :)
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

hedgefield

Yes I'd say global variables are the way to go to keep track of the state your character/game is in. I recommend making a flowchart or something first if you plan on having lots of choices in the game, because if you try to remember it all in your head I can guarantee you things will get jumbled real quickly.

I've always wondered how the hell Bioware keeps track of all the descision variables involved in a game like Mass Effect...

gypsysnail

Thanks Largopredator, for the flowchart idea! Thats a very good idea and I will adopt that one. It sounds like the best way to organise and remember all the decisions.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

SMF spam blocked by CleanTalk