Creating a single player campaign with Spring

Creating a single player campaign with Spring

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
delMar
Posts: 2
Joined: 14 Oct 2015, 12:27

Creating a single player campaign with Spring

Post by delMar »

Hi all,

this is my first post on this forum, so in case this this appears in the wrong spot, I apologize.
I spent quite some time browsing this forum, the wiki and the Internet but I'm stuck currently..

As mentioned in the subject, I'd like to make a single player campaign in the style of that old BattleTech 2: The Crescent Hawks' Revenge.
This question is about overall gameflow:

The game is built around missions, narrative and management parts.

In between missions there is narrative text, some pics, background music.
You also can do squad management things like repair stuff, assign pilots to mechs or chose your next mission.

I already know that I need to load what I call "background maps" when in-between missions (simple maps that load fast and act just as background while really having the magic happen in Chili UI). The same is true for generating a main menu, which should have the following options:

a) Start new game
b) Load previous game
c) Quit

Starting a new game triggers the first narrative (the Intro), allows for squad management and then loads the first mission.
When the mission is done, I load the background map, display the narrative part, allow for squad management and then load the next mission (maybe based on which decision you make).

Here are my questions:
* Can I start the game's binary so that a game is loaded immediately, without the Select Game, Select Mission, Select Script options?
* Is there some game-config where I can define which map to load first? (that would be the startmenu map)
* How can I trigger loading another map? I need to do this at the end of a mission (load the background map) and after all the narrative/management stuff

I'm pretty sure that all these narrative and management things are doable with LUA. (I'll ask later if I get stuck again there)
I was able to find parts of what I'm looking for, however there are so many different sources of information, it easily gets too much for a greenhorn.

Thanks guys for creating that engine, I really appreciate the amount of time all of you have put into this.
If I get this working, I'd be glad to contribute to the Wiki with some kind of documentation and give back to the project that way.

// delMar
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Creating a single player campaign with Spring

Post by smoth »

delMar wrote:
  • Can I start the game's binary so that a game is loaded immediately, without the Select Game, Select Mission, Select Script options?
  • Is there some game-config where I can define which map to load first? (that would be the startmenu map)
using start scripts yes
delMar wrote:
  • How can I trigger loading another map? I need to do this at the end of a mission (load the background map) and after all the narrative/management stuff
viewtopic.php?f=86&t=32893
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Creating a single player campaign with Spring

Post by gajop »

Hey and welcome to Spring!
delMar wrote:The game is built around missions, narrative and management parts.
I'd like to point out that there are two mission editing tools: Zero K Mission Editor (don't let the name fool you, it still works with other games) and Scened. Both are mature at this point although ZeroK ME has seen more usage and should be more stable. Scened is an in-game (in-Spring) editor and also supports map editing which you might find useful. I'm the developer of Scened so if you're interested in using it I'm willing to offer you support and I do take feature requests. I also happen to be the chililobby dev and you might find that useful for your lobby.
delMar wrote: * Can I start the game's binary so that a game is loaded immediately, without the Select Game, Select Mission, Select Script options?
* Is there some game-config where I can define which map to load first? (that would be the startmenu map)
Yes, and to extend on smoth's answer, which is to use startscripts, you should also check how we did this with our Ludum Dare games: Area 17 and Zeus vs Bunnies. What we did was basically define a DefaultStartScript in the springsettings.cfg which would run whenever the user executed the "spring" executable. We also renamed the spring executable to whatever the game name was.
delMar wrote: * How can I trigger loading another map? I need to do this at the end of a mission (load the background map) and after all the narrative/management stuff
You can do this by loading a new startscript using Spring.Reload. Just specify a different map with the same game. I think funkencool's chili menu did some of these things (it should be available in the BAR repository).
delMar
Posts: 2
Joined: 14 Oct 2015, 12:27

Re: Creating a single player campaign with Spring

Post by delMar »

Thanks a lot for your replies!

I'm pretty sure I'll be able to make some progress now.

Thanks!
8611z
Posts: 169
Joined: 08 Jul 2015, 20:20

Re: Creating a single player campaign with Spring

Post by 8611z »

An alternative way is that spring.exe can take a startscript as commandline arguement.
In simplest form you can make a batch file named "Start Campaign" with content

Code: Select all

spring.exe startscript.txt
Or some small program that the player runs which then starts spring.
That is what several people did: download/file.php?mode=view&id=9295
before a way to set default startscript existed.

DefaultStartScript in springsettings.cfg is more suitable for quicker developing and testing but not for players.
springsettings.cfg stores lots of other settings, like graphics, camera, sound,... which players like to edit.
(Not everything is configurable by a GUI) It is also not so unusual that players have to edit settings file to get Spring working.
While doing so they might accidently delete your custom entry in springsettings.cfg. (For example if another player tells them "Hey try my settings, those work for sure!" and they overwrite the whole file.)

Both methodes share the same drawback: Neiher such batch-files/"launch programs" or modified springsettings.cfg can be downloaded by spring's automatic download systems.
So you have to distribute your own installer.
With that come several problems that otherwise Spring would already have handled, for example:
-Updating
-Spring runs on Linux & Windows, sometimes on Mac too. You have to make seperate installer for each OS.
-Making sure that your spring-version does not mess up the settings of other installed spring games. (if springsettings.cfg is stored in 'my documents\' folder then multiple spring installs might read or write it)
-Multiplayer, if desired. (Just copying some existing lobby into your installer might not work so good)
-...

You are right that the actual gameplay/missions/narrative etc can be done with Lua, but for actually starting the game there is imo no good way yet.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Creating a single player campaign with Spring

Post by gajop »

8611z wrote:An alternative way is that spring.exe can take a startscript as commandline arguement.
In simplest form you can make a batch file named "Start Campaign" with content

Code: Select all

spring.exe startscript.txt
Or some small program that the player runs which then starts spring.
That is what several people did: download/file.php?mode=view&id=9295
before a way to set default startscript existed.
I would advise against this (and the batch option in particular), based on our experience with Gravitas where we used it.
This requires a bit more work to keep it cross-platform: you need a .bat (batch) file for Windows, but a .sh (shell) file for Linux.
The .bat file is a non-standard way of launching games, and some users would start spring.exe directly and be confused with the default engine menu. On Windows it's not trivial to distribute hidden files like it's on Linux.
8611z wrote: DefaultStartScript in springsettings.cfg is more suitable for quicker developing and testing but not for players.
springsettings.cfg stores lots of other settings, like graphics, camera, sound,... which players like to edit.
(Not everything is configurable by a GUI) It is also not so unusual that players have to edit settings file to get Spring working.
While doing so they might accidently delete your custom entry in springsettings.cfg. (For example if another player tells them "Hey try my settings, those work for sure!" and they overwrite the whole file.)
While this might be a drawback, you can provide GUI editing for springsettings.cfg for a select number of fields. Players certainly shouldn't be editing all of the engine fields, as it's unlikely they can guess all the right values (I know I can't).
distributing
You may want to use Steam for distribution, although by the time you get to that point we'll probably have full game distribution via rapid that should include not just the game (mod) archive, but also game/map list, engine information, springsettings.cfg, and similar.
It's something we've been dicussing informally and we'll probably see happen sooner or later.
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Creating a single player campaign with Spring

Post by hokomoko »

This thread reminded me to do this:
https://github.com/spring/spring/commit ... 7b1a5b13ea

You can now just put a defaultstartscript.txt file instead of setting the cfg to whatever.
8611z
Posts: 169
Joined: 08 Jul 2015, 20:20

Re: Creating a single player campaign with Spring

Post by 8611z »

I know that different OS require different batchfiles/laucher-things, I had already listed it as disadvantage.
It is no different with DefaultStartScript/springsettings.cfg where you also need different engine versions for each OS.
Both methodes are equally flawed and imo only 'acceptable' among testers or developers. (Like on this forum or on gamejams etc)
Having lots of seperate custom installers is bad solution, and so far all seemed Frankenstein-like.
gajop wrote:You may want to use Steam for distribution, although by the time you get to that point we'll probably have full game distribution via rapid that should include not just the game (mod) archive, but also game/map list, engine information, springsettings.cfg, and similar.
It's something we've been dicussing informally and we'll probably see happen sooner or later.
Currently not even validmaps.lua or similiar files are implemented by any lobby or engine. (TASClient was doing some steps with validmaps but appearently it has now been declaread dead.)
So I do not think it will be so soon...

The question is: How to start spring.exe with correct startscript.txt so that the ingame campaign can begin?
"Downloading springsettings.cfg via rapid" or those installers, that seems pretty strange overkill when it is all about some tiny textfile.
And now matter what stuff the lobby all downloads, in the end there still needs to be a "Start The Campaign" button. Preferably in the lobby, just like lobbies currently have a "Singleplayer"-button for skirmish.
Imo one solution might be that games include a startscript (say gamedata\defaultstartscript.txt) and the lobby reads & uses that when launching singleplayer.
https://springrts.com/mantis/view.php?id=4983
hokomoko wrote:This thread reminded me to do this:
https://github.com/spring/spring/commit ... 7b1a5b13ea

You can now just put a defaultstartscript.txt file instead of setting the cfg to whatever.
The defaultstartscript.txt is next to spring.exe, outside the game .sdz archive? That solves the problem of players accidently deleting it from springsettings.cfg but how does the defaultstartscript.txt get onto players computer? Seems it still requires custom installer and only works for one game..
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Creating a single player campaign with Spring

Post by hokomoko »

The defaultstartscript.txt is next to spring.exe, outside the game .sdz archive? That solves the problem of players accidently deleting it from springsettings.cfg but how does the defaultstartscript.txt get onto players computer? Seems it still requires custom installer and only works for one game..
Yes.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Creating a single player campaign with Spring

Post by smoth »

for windows create a shortcut with the proper starting parameters
Post Reply

Return to “Game Development”