Author Topic: A short side-mission branch  (Read 14122 times)

0 Members and 1 Guest are viewing this topic.

Offline Rhi

A short side-mission branch
« on: October 10, 2014, 03:56:56 am »
Introduction and description

So I got interested in how all this side-mission creation works, what can be done about it and so on. Decided to go with something simple for starters.

This off-branch takes place between chapters 1 and 2, chronologically it's a week after you've destroyed the pirate base(so a week prior to Grey's message). There are a total of five different missions(well, two are a kind of varioation of each other), but you'll go through from 1 to 3 of them, depending on your choices. The longer the route, the harder it is  ;D

I've done the write up the way so that it seamlessly goes on with the main story line. Don't expect much from the write-up though, I was mostly interested in technical side of things this time. (Should've probably added a bit of Asaga and Chigara interaction, but oh well). I've tried to balance the reward so that it wouldn't majorly offset the balance, but Agamemnon mission will end up slightly to noticeably easier. To end up with latter you'd have to do quite well, to the point that Agamemnon escort would be trivial anyway :)

Captain difficulty recommended, as that's what I've tested all the missions on(that is, with AI acting somewhat dumb as of 7.1(?)). The last mission of the full route might be impossible to survive on hard mode.

Installation

1. Unzip the file into your ..\sunrider\game folder.
2. You'll have an "Asteroid Field" on galaxy map after you get the message from Admiral Grey. Clicking on it which will start the off-side branch.

Notices and thanks

Special thanks to Vaendryl for the help with making it work properly.

This should be compatible with any mods or other side-missions unless they're set to specifically conflict with this one. Sorta  ;D

If you encounter any problems or find typos or whatnot, post in the thread or drop me a message. I would like to also request an assessment of the missions' difficulty. First ones should be fairly trivial(I think),but I could've gone a bit overbroad on the later ones. Just a bit, though.

I must say, that on the whole I'm quite satisfied with the capabilties of the game as far as making new missions goes. You can do pretty much everything you'd want without altering native game files, the only thing you need is an entry point in script.rpy, but that's it. Very mod/map-friendly. Once you get the template finished, new missions could be done at a really quick pace, so anyone willing could easily make a campaign expansion if he wishes to do so(and can do all the writing).

Bit of wishful thinking at the end - would be very nice if you could export the ship placement of a skirmish battle. Numbered overlay in debug-mode helps a lot, but it still takes quite a bit more time that it could've.
« Last Edit: October 16, 2014, 12:15:41 pm by Rhi »

Offline Endershadow

Re: A short side-mission branch
« Reply #1 on: October 09, 2014, 09:54:21 pm »
You could always put the modified script file in there and just have them override it (or use my modloader).

Please be careful not to fall into any holes in reality caused by my reality hole generator. If you do fall in though, I can assure you that there will be no adverse side effects except for the following: instantaneous mutation, loss of 1 or more vital organs, turning into banana pudding, amnesia, loss/growth of 1 or more limbs, additional vital organs, loss of DNA, insanity, hallucinations, destruction of the fabric of space and time, redundancy, redundancy, a craving for apples, the ability to see shinigami, for females: an erection lasting more than 4 hours, for males: extremely painful menstrual cramps, testicular inversion, gender swapping, the urge to watch my little pony, and/or death

Offline Vaendryl

Re: A short side-mission branch
« Reply #2 on: October 09, 2014, 10:41:39 pm »
pretty sure it's possible to hook into the story by adding a jump location on the galaxy map.
haven't really tested it, but if you put on top of you file something like this:

Code: [Select]
init 1 python:
    Planet("SIDE MISSION", "start_sidemission_01", 750, 655, "start_sidemission_01")

shouldn't that work?

on the whole, I much rather see people not replace game files at all. your script file is going to get everwritten by steam's automatic updates and it makes multiple mods that much harder to cooperate.
(╯□)╯︵ uoıʇdǝɔxǝ
latest version: 7.2
RTFW
Mark 5:9

Offline Endershadow

Re: A short side-mission branch
« Reply #3 on: October 10, 2014, 12:08:05 am »
pretty sure it's possible to hook into the story by adding a jump location on the galaxy map.
haven't really tested it, but if you put on top of you file something like this:

Code: [Select]
init 1 python:
    Planet("SIDE MISSION", "start_sidemission_01", 750, 655, "start_sidemission_01")

shouldn't that work?

on the whole, I much rather see people not replace game files at all. your script file is going to get everwritten by steam's automatic updates and it makes multiple mods that much harder to cooperate.


That would work.

Please be careful not to fall into any holes in reality caused by my reality hole generator. If you do fall in though, I can assure you that there will be no adverse side effects except for the following: instantaneous mutation, loss of 1 or more vital organs, turning into banana pudding, amnesia, loss/growth of 1 or more limbs, additional vital organs, loss of DNA, insanity, hallucinations, destruction of the fabric of space and time, redundancy, redundancy, a craving for apples, the ability to see shinigami, for females: an erection lasting more than 4 hours, for males: extremely painful menstrual cramps, testicular inversion, gender swapping, the urge to watch my little pony, and/or death

Offline Zenas

Re: A short side-mission branch
« Reply #4 on: October 10, 2014, 08:16:44 am »
Editing/overwriting the original game files has its downsides, I agree. What about those of us that prefer proper integration with the existing story though? Instead of just having a planet jump. (Feel free to let me know if I misunderstand, and this would hook into the main plot regardless)

What you suggested will work for some mods, but not for some others. My opinion? I don't mind editing script.rpy as much, Sunrider is easy enough to mod anyway! ;)

The only thing that keeps bugging me about this game, and probably always will (along with a lot of other people) is the lag during combat. Shame it can't be helped. :(

Offline Rhi

Re: A short side-mission branch
« Reply #5 on: October 10, 2014, 03:41:32 am »
I did add the warpable planet exactly that way, but without an entry point in the script I won't have control over when it becomes available, right? I'd also have to first click on that location and warp to it instead of providing the explanation first and giving the option to say "we're not doing it" and henceforth player not even seeing that spot as warpable.

Was wondering if it's possible to let the game alterate its own files on meeting certain conditions after launch. Something like:

Code: [Select]
init python:
    if search('script.rpy','sidemission1_start') == 0:          # searches through the file script.rpy for the 'sidemission1_start' string and returns its line number
        addline('script.rpy','    call sidemission1_start',search('script.rpy','label chap2_start:')+1)     # adds the 'call sidemission1_start' below 'label chap2_start:' in script.rpy
        call gamerestartquery                                                                  # pops up the window notifying about game's file modification and the need to restart for changes to take place

So if there's no entry point then it gets added(and add notification about the need to restart, ofc), but if there is one, then nothing's done. I'm not a coder though and have no knowledge of python, so I don't know if it's possible to make without much sacrifices.
« Last Edit: October 10, 2014, 03:48:15 am by Rhi »

Offline Endershadow

Re: A short side-mission branch
« Reply #6 on: October 10, 2014, 04:05:54 am »
That's what shouldShowOnMap is for. Technically speaking it's possible, but it's completely infeasible at the moment.

Please be careful not to fall into any holes in reality caused by my reality hole generator. If you do fall in though, I can assure you that there will be no adverse side effects except for the following: instantaneous mutation, loss of 1 or more vital organs, turning into banana pudding, amnesia, loss/growth of 1 or more limbs, additional vital organs, loss of DNA, insanity, hallucinations, destruction of the fabric of space and time, redundancy, redundancy, a craving for apples, the ability to see shinigami, for females: an erection lasting more than 4 hours, for males: extremely painful menstrual cramps, testicular inversion, gender swapping, the urge to watch my little pony, and/or death

Offline Vaendryl

Re: A short side-mission branch
« Reply #7 on: October 10, 2014, 05:37:52 am »
the best solution is probably to chance the Planet class and the galaxy map so that you can add an evaluation as to what condition needs to be true before something shows up, such as mission4_complete == True

another way that is a bit hacky but should work is to use config.label_overrides.
you use this as a dict, so in a mod's init phase you can say something like: config.label_overrides['beachepisode'] = 'sidemission1', and in the label sidemission1 you delete this entry again en then manually jump to 'beachepisode'.

haven't quite tested this, but I think it should work.

another thing you can do is overwrite the shipmap file instead of script. it would be nice though if I could add some mod support for this like I've added mod support for extra items in 7.1a. just append a reference of you item class to store.mod_items in your mod's init and the store.rpy code will add an instance of it to the store's display list. this is, by the way, another way to hook into the game that already exists. items are very powerful and you can already easily make the player buy some relic that opens up a new warp location, for example.
(╯□)╯︵ uoıʇdǝɔxǝ
latest version: 7.2
RTFW
Mark 5:9

Offline Rhi

Re: A short side-mission branch
« Reply #8 on: October 10, 2014, 06:00:38 am »
I've not been looking into things indepth as of yet.

Anyway, I've remade it so that script.rpy doesn't need to be changed. So it's just drop the file and play now. It does feel bit awkward as far as player interaction goes, since you end up with either:

a) warping to some planet which suddenly popped up and only then figuring out why you have done that(seriously, labelling something "It's a trap" would be quite hilarious in that respect to start a mission)

or

b) launching the cut-scene right after clicking on planet the instead of going into the "warp-to" planet view

Actually had to resort to creating 2 planets in order not to replay introduction in case the player wanted to delay the mission, but not to refuse it(in order to make upgrades, for example). Besides that, everything seems to be working for now.

Oh, one thing, are there any possible issue with using try/except to determine if variable is defined in the init phase? Looks bit stupid, but I couldn't think of anything else to go with when I'm not changing any other files (would get a crash due to variable undefined upon planet creation if I put my own variable to the show_up condition).
« Last Edit: October 10, 2014, 06:03:22 am by Rhi »

Offline Vaendryl

Re: A short side-mission branch
« Reply #9 on: October 10, 2014, 06:17:22 am »
 try/except would work, but you should be careful you're not accidentally wrapping too much, like jumping to places as something could go wrong later on and you'd never know what's going wrong. I think it's better (as a rule of thumb) to use hasattr().  the syntax if you want to test for a global variable is
Code: [Select]
if hasattr(store,'variable'):
(╯□)╯︵ uoıʇdǝɔxǝ
latest version: 7.2
RTFW
Mark 5:9

Offline Rhi

Re: A short side-mission branch
« Reply #10 on: October 10, 2014, 07:14:53 am »
So these 2 bits should be equivalent as far as determining the existance of variable goes, right? I've checked on that quickly and it does work, indeed.

Code: [Select]
    if not hasattr(store,'SQBranch1_intro'): SQBranch1_intro = True

    #try: SQBranch1_intro
    #except: SQBranch1_intro = True

Also, this is somewhat off, but since we're in it already.. I was thinking about having more control over how AI performs in a particular battle. Right now after you get all the ryders and necessary upgrades it's really just "player vs cannon-fodder" case. So unless the player gets overwhelmed by the sheer numbers (of missiles spammed  ;D), he won't really be having any issues munching through all the enemies thrown at him. Would be nice if modder could set something like target priority and weapon priority for enemy ships. Rough example of what I mean:

Code: [Select]
# This would be somewhere in the mission_loop label

for ship2 in enemy_ships:
     ship2.preferredtarget = ''           #drop the previous preferrences
     ship2.preferredwtype = ''           #if left blank AI just goes the usual routine

for ship1 in player_ships:
    if ship1.hp <= ship1.max_hp / 2:                                            #search for easy kills and go for them
        for ship2 in enemy_ships: ship2.preferredtarget = ship1       #could also add absolute hp check so that 45% seraphim feels more juicy than 40% sunrider, for example

for ship2 in enemy_ships:
    if ship2.preferred target = '':                                                     #unless there's already a juicy target found
        if ship2 = MissileFrigate: ship2.preferredtarget = seraphim      #Sola gotta love those missiles, right?
        if ship2 = PactSniper: ship2.preferredtarget = seraphim          #And she's also a famous bullet-dodger
        if ship2.stype = 'Ryder': ship2.preferredtarget = liberty           #Ryders go on to confess to Chigara
        if ship2.stype = 'Battleship': ship2.preferredtarget = sunrider   #Battleships are like "go pvp"
        if ship2.rockets >= 1:                                                           #Big ship warrants big torp
            ship2.preferredtarget = sunrider
            ship2.preferredwtype = 'Rocket'
         

I realize that's not a small thing to ask for(and AI probably uses something similar in his threat calculations anyway), but having such easy-to-use overrides will greatly enhance modder's ability to customize missions and their difficulty to the point where you could probably script an actual fleet battle where Sunrider and co is performing auxiliary functions.

Offline Vaendryl

Re: A short side-mission branch
« Reply #11 on: October 10, 2014, 11:56:24 am »
I prefer to use hasattr if possible. if testing for a label you can use the renpy built-in   renpy.has_label()

I loathed the thought of having to adjust preferences for each individual enemy ship like that so I made the AI as generalist as possible. no matter if it's a pact support, the legion, a missile frigate, an ironhog or a mook... they ALL use the exact same code. the same priority calculations, damage estimation etc
the one thing you can do is set the hate on a player ship manually.   if you set something like   sunrider.hate += 5000   the player is going to feel the effect rather strongly.
(╯□)╯︵ uoıʇdǝɔxǝ
latest version: 7.2
RTFW
Mark 5:9

Offline Endershadow

Re: A short side-mission branch
« Reply #12 on: October 10, 2014, 12:28:06 pm »
another way that is a bit hacky but should work is to use config.label_overrides.
you use this as a dict, so in a mod's init phase you can say something like: config.label_overrides['beachepisode'] = 'sidemission1', and in the label sidemission1 you delete this entry again en then manually jump to 'beachepisode'.

This will be really useful for my mod that I've been working on for how long? 3-5 months?

Please be careful not to fall into any holes in reality caused by my reality hole generator. If you do fall in though, I can assure you that there will be no adverse side effects except for the following: instantaneous mutation, loss of 1 or more vital organs, turning into banana pudding, amnesia, loss/growth of 1 or more limbs, additional vital organs, loss of DNA, insanity, hallucinations, destruction of the fabric of space and time, redundancy, redundancy, a craving for apples, the ability to see shinigami, for females: an erection lasting more than 4 hours, for males: extremely painful menstrual cramps, testicular inversion, gender swapping, the urge to watch my little pony, and/or death

Offline Rhi

Re: A short side-mission branch
« Reply #13 on: October 10, 2014, 01:10:27 pm »
I loathed the thought of having to adjust preferences for each individual enemy ship like that so I made the AI as generalist as possible. no matter if it's a pact support, the legion, a missile frigate, an ironhog or a mook... they ALL use the exact same code. the same priority calculations, damage estimation etc
the one thing you can do is set the hate on a player ship manually.   if you set something like   sunrider.hate += 5000   the player is going to feel the effect rather strongly.

Well, yeah, normally it would make sense to have generalized AI, but in the later stages that's what leads to the white-and-black difficulty situation. Hate adjustment is too global, you end up having everyone shooting the designated target, which either leads to overkill or just makes player able to tank it all by getting this target out of the harm's way.

Right now you can force a lot of things on the player, but all that would be either hard-coded(=rather arbitrary) or not particularly linked to what's going on in battle itself. So you can't really initiate a torpedo attack on sunrider by the just arrived pair of battleships and then script events depending on the outcome, instead you have to either [jump the battleships, pray they shoot torpedos instead of moving two hexes and shooting lasers, check for sunrider's HP/battleships rockets count and assume it got that much of a change due to torpedos hitting] or [jump in battleships and then inform player that he just ate both torpedos while playing through necessary CGs], leaving him no option to counter that.

So, as far as setting up in-battle events goes and for precision control of battle development such overrides would be very useful. I guess events could still be done in some circumvented way, but putting pressure on player at select multiple targets would be really neat to have.

Offline Rhi

Re: A short side-mission branch
« Reply #14 on: October 10, 2014, 01:14:47 pm »
Oh, actually, what's just crossed my mind. The battle_loop label is looped on every combat action, right? Is there a way to get the info on what ship is taking action this exact loop iteration? If so, it would be possible to pump the hate up, conduct the action, then drop it down to previous level for the emulation of the same effect as target preferrence.

 

262 Guests, 1 User