It seems I'm in over my head, as usual


#1

As is annoyingly typical of my projects, it’s not thirty minutes in and it looks like I’ve committed myself to doing something incredibly tricky. Here’s to hoping you can help me out.

My game is about modern warfare in a fictional world, taking place in a jungle, so vaguely Vietnam-esque. The protagonist is the leader of a squad of four other soldiers, codenamed Rome, Knives, Shiver, and Ember. The game also runs on four skills, Close Combat, Sniping, Demolitions, and Communications. Each of the four soldiers specializes in one skill (Rome is Close Combat, Knives is Demolitions, Shiver is Sniping, Ember is Communications). The player can choose to specialize in whichever, and can also choose an area of weakness in exchange for a sub-specialty (how this works out is that the skills are at 2 by default, your specialty is bumped to 4, your area of weakness is knocked down to 1 and your sub-specialty is brought up to 3 or alternatively you can select the same skill multiple times to have 5/2/2/1, or 3/3/2/2). Different situations will call upon different skills and will have different danger levels. So far, pretty standard, right? Characters and skills have been in every choice of game made to date.

So here’s an example of the kind of choice that’s giving me trouble, which may or may not make it into the finished game. The village where you’re supposed to meet your contact has recently been seized by the Makazai, a guerilla army who were unrelated to your mission before they decided to hold your contact ransom. Assuming diplomacy fails or the player just decides to forego the diplomatic route entirely and open fire, they’ll need to assign their squad to different tasks. There are three tasks in this battle. First, someone needs to provide cover fire from a distance, which is a Sniping job with danger level of 3. Someone else needs to extract the contact, which is a Close Combat job with a danger level of 6. Finally, someone needs to destroy the Makazai jeeps so that they can’t pursue, a Demolitions job with a danger level of 5. The player is not privvy to the danger levels in advance, that’s just in code.

The equation for determining wounds to your squad mates is ((S1-S2-S3-S4-S5)+D)/N (and incidentally, each squad mate dies after taking four wounds), where the various S’ are the skill levels of the squad mates involved (the vast majority of these will be zero most of the time, since you’ll typically be splitting your squad up), D is the danger level of the task, and N is the number of soldiers in the fight. As an example, let’s say that the player has 4 in Close Combat, and he and Rome are extracting the contact. That’d make the equation ((4-4-0-0-0)+6)/2, which comes out to -1, so we ignore it. On the other hand, if we send Knives and Ember, two soldiers with a Close Combat of only 2, it comes out to ((2-2-0-0-0)+6)/2, which is 1, so each of them take one wound.

Now, if you send Knives alone, she’ll *die*, because her total skill is 4 short of the danger level and each soldier has only four wounds. If you fail a task, different things need to happen depending on what task was failed. For example, if the covering fire task is failed, then every other soldier randomly takes 0-2 extra wounds from Makazai fire, if the demolitions task is failed than Makazai jeeps will be chasing you in the next vignette, and if the extraction task fails, your contact is killed and you must find the facility you’re supposed to be blowing up without his help, making a later vignette significantly more difficult.

So, that’s a pretty workable system and all (though the specific encounter seems a bit too easy even for the first battle, considering there’s only going to be, like, four battles total), but I have no idea how to program it into ChoiceScript. The choice needs to look like:

Which role do you assign Rome?

*choice
#Extraction
You assign Rome to extract the hostage.

*goto shiver_choice_1
#Covering fire
You assign Rome to cover the team from a distance.

*goto shiver_choice_1
#Jeep demolition
You assign Rome to destroy the Makazai jeeps.

*goto shiver_choice_1

Then, once all five assignments are made, we get the results, which need to be different based on whether Rome takes no wounds, takes at least one wound but does not die, or is killed in the battle.

So, to recap, I need:

  1. A way of calculating how many wounds are taken for a specific task,
  2. A way of calculating whether or not a particular task had any surviving soldiers assigned to it, and
  3. A way to tell whether a particular soldier took a wound or died in the last battle specifically, so I can write different messages for them

Everything else is going to require a barrel of variables, but it’s all pretty straightforward.


#2

I’m probably not someone who codes most elegantly and probably can’t explain it every well, but here’s what I’ll do.

I would have create variables for each of the soldiers’ health. It would look like this in the mygame.js:

,rome_health: 4
,kinves_health: 4
,shiver_health: 4
,ember_health: 4

For example, Knives failed a task and gets two points of wound. I would add the line:

*set knives_health -2

So now, she has 2 wounds left.

Later, Knives gets two more points of wounds. She’s now dead. knives_health will now be at 0

Later, there you need to calculate which soldier is alive. What I’ll do is to use the *if command.

*if knives_health = 0
Rome, Shiver, Ember and you move on.

*if knives_health = >0
The five of you move on.

*if knives_health = <4
You attend to Knives’s wounds.

However, the problem is this is that you can have many combinations of survivors and casualties. You can do it the hard way of making branches for all of them, but I’m sure the better coders here will have a more feasible solution so don’t take my word for it.


#3

First, I’d recommend slimming down your ideas a bit. While these ideas are awesome, the complexity of them may lead to an abandoned project. A project of a smaller scale which is actually finished would be much better than a project with much more grandiose ideas which never gets done. That said, I’d say the best way of what your contemplating would be splitting ‘Goals’ (such as getting the contact back) into ‘Tasks’ which are each done by one individual.

So you’d have one person assigned to the Sniper Task which would then run a check against their skill which would make another Task more difficult/easier, then that task would resolve which might affect another, and so forth. Tasks could also be left blank, which would affect other tasks also.

Eh, I’m not sure I’m coming across clearly, so lets have a practical example:
Goal: Rescue the contact
Scene Write Up: The contact is captured… blah blah blah… (*if diplo_attempted) Diplomacy has failed… (*else) You’re not going to try to contact the scum… Near their location, you plan your assault… There are two good sniper place… There are jeeps which must be taken out… ect.
Tasks:
-Sniper_1 to 3
-Extractor_1 to 4
-Demo_1 to 4
The actual selection of people to tasks would go something like:
You decide that you must have someone to extract the contact and someone to plant the charges. You may also want a couple of snipers to provide assistance.
How many people will you have go in and extract the contact?
*choice # of people
*choice of who actual goes (This would probably be best done by a number of multi choices, based on how many people go.)
*if surviving/unassigend team members < 1: You realize that would leave no one to plant the demolitions on the cars. *goto choosing the number of people for the extraction
*choice ‘Who will plant the demolitions?’
*choice ‘How many people will accompany them’ (0 to 3)
*if surviving/unassigend team members > 0: You put everyone else on sniper duty.

Then it run a log complex set of *ifs which would determine how things went. For example:
*if sniper_1 != "none" *set test_difficulty 4 *set skill_test sniper_1&"_sniping" *if {skill_test} > test_difficulty ${Sniper_1} shoots someone running up on ${Extractor_1}. *set runner_on_extractors "dead" *goto person_running_up_on_extractors *if {skill_test} < 2 ${Sniper_1} shoots someone running up on ${Extractor_1}, but misses *set runner_on_extractors "aware" *goto person_running_up_on_extractors *else ${Sniper_1} sees someone running up on ${Extractor_1}, but can't line a shot up. *set runner_on_extractors "alive" *goto person_running_up_on_extractors *label person_running_up_on_extractors *if runner_on_extractors = "dead" *goto next_task_test *set test_difficulty 3 *if runner_on_extractors = "aware" *set test_difficulty + 1 *lets assumed extractor_2 to 4 don't do anything *set skill_test extractor_2&"_cqc" *if {skill_test} > test_difficulty ...

That doesn’t touch on health, but @ScarletGeisha covered the general idea of how most people seem to think it works best. I hope that helps give you an idea of how to cover such a large undertaking. Also, in case you haven’t, you’ll want to take a look at (http://www.choiceofgames.com/make-your-own-games/choicescript-advanced/). Also @lordirishdas was working on a game with a similar idea (http://www.choiceofgames.com/forum/discussion/161/ghost-in-the-libraryin-progress/p1) that you may want to take at least a peak at.


#4

So, this is actually an entirely separate problem, but it’s with the same game, so I figure I may as well dump it here. Whenever I try to run mygame.js, I get an error that says “SceneNavigator is not defined.” As a band-aid solution, I can just rely on *goto_scene instead of *finish, but I’m afraid things might go really bonkers once I start renaming the vignette files.


#5

Have you listed your viginette files under the " nav = new SceneNavigator([ " line?


#6

Well, I can’t open mygame.js. So, no.


#7

You can open it with Notepad.


#8

Oh, so you can. That solves the problem then, thank you very much!

EDIT: However, now I have another question. The mygame.js file has the list of default stats, do I need to fiddle with those? I’ve just been editing choicescript_stats so far and it’s worked so far. Is this going to go wrong at some point later?


#9

Yes, you will need to make changes to them. Whatever stats you plan for choicescript_stats, you will need to reflect it in mygame.js

Remember that they will need to be input twice, both under stats and debug_stats.


#10

Alright, excellent. One more thing, does anyone know where I can host an incomplete demo of the game? I have the first chapter finished and I’d like to show it off and get feedback while I work through making the encounter system work for the village battle in chapter two.


#11

Many people have been using webs.com, which is free. However, they have a seven-day wait period for their HTML-only sites, which is what you’d want for a ChoiceScript game. So, you could run over, register a HTML only site, then work on your game for a week more and post it…


#12

What exactly will I need to upload to make my game work?


#13

Also, recently this bit of code has returned me an error and I’m not sure why:

*fake_choice
*selectable_if (ember < 4) #Ember
*selectable_if (knives < 4) #Knives
*selectable_if (shiver < 4) #Shiver
*selectable_if (rome < 4) #Rome
#Myself

The selectable_if bit is what’s returning an error report. The code is intended to show your teammates as grayed out if they’re dead (in fact, the whole reason I put this choice in there was to test this, as (spoiler alert!) it doesn’t matter who you put on point while traveling to the village, because the Makazai will not attack).

The indentation isn’t showing up properly, but all the lines but the first are indented with two spaces. Does anyone know how I can make code blocks on this forum?


#14

You will need to upload everything in the Web folder, includings the contents in the Icon and Mygame folders. However, you won’t be able to upload .htaccess. Don’t worry, it’s not necessary.


#15

Just an fyi for the ‘.htaccess’ you actually don’t want to load it up, even if you decide to use another web hosting service. It screws (at least some of) them up.


#16

For the error, try a normal choice. I don’t think *selectable_if works for fake choices.


#17

Okay, new problem. Is there anyway to check if two different variables are at a certain level? For example, there is a conversation in the current vignette I’m writing, and it’s possible for one of the two characters who have it to be dead at the time, so I need a way to make sure the conversation will only be displayed if both of them are alive.


#18

*if (ember >0) and (knives >0)
Knives and Ember stand right behind you
“Hey guys, what do you think of this”
etc etc.