[game] missions = maps with Lua (feat. demo-mission for BA)

[game] missions = maps with Lua (feat. demo-mission for BA)

Happenin' news on what is happening in the community. Content releases, new tutorials, other cool stuff.
Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

[game] missions = maps with Lua (feat. demo-mission for BA)

Post by knorke »

ramble-babble-bumble about missions
Not even my mod is in playable state, so of course neither are its missions. Pro. :roll:
But babble about my perspective on making missions.
tl;dr: it is in a map, no editor, lua evrything.

So attached some
example-mission for BA.
lol png:
Image

It is like some typical tutorial-mission: Learn to walk, to make mexes, kill some stuff.
How to start it:
download attached TutorialRoadDemo.sdz to maps\
via spring.exe: mod=BA, map=TutorialRoad, script=Player Vs AI: NullAI
via lobby: select mod&map, do not add any bots
Was made with BA 7.99 but 8.00 seems to work too.

Playing mission takes about 15min
:!: Can watch as 3min video:
:arrow: https://www.youtube.com/watch?v=UqerftFvoDY
If things look different to video then something is wrong.

It is NOT meant to be a real mission or tutorial!
It is just a demonstration of this way of creating missions!


It is quickly thrown together, it took about 2 hours, including the ugly map.
(yes map has slight graphic error, doesnt matter, it is just demo)

Of course there is some stuff missing:
For example in such tutorial-mission all unneeded buildoptions should be disabled and if instruction is given to "build mex" then the mex-icon should flash in buildmenu etc.
And the "choose ARM oder CORE" thing at start should be gone, among other things.
Thing to look at is the general idea how scripting mission from scratch without editor could work, not every detail.
This stuff can be in some mission-functions-libary but adding all that for BA testmession was outside scope ;)

Why map
-Gameplay of mission usually requires special terrain that is different to skirmish maps.
So a special map needs to be made anyway.

-If you can select a a map then you already know how to select a mission.
Not needing to select mod "Balanced Annhilation-mutatorMission XY" and then guessing which map is right one.

-For multiplayer: Changing mod requires rehosting of room.
Changing map does not.
@abma ("thats a lobby protocol restriction."): True, maybe fixable for this but not needed to fix ;) Like this works with current infrastructure.

-Maps can have descriptions, that lobbies disable.
Can be used for short briefing or how to setup teams:
"Play on team 1. Add 2 NullAIs on teams 2+3"
Somewhat useful workaround until something better is found:
http://springrts.com/phpbb/viewtopic.php?f=21&t=32225

-If played online, the replays get uploaded.
If TutorialRoad-mission was on springfiles, its replays could be viewed on replay site like games from any other map.
http://zero-k.info/Battles stores replays from (some? replays seem very old) missions too, but again needs changes to infrastructure.


Why Lua-it instead of editor?
disclaimer: It is great that some people made/are making editors. Without question more tools are always better and if players (rather than devs) are supposed to make missions then good tools are needed.


-Creating editor is lots of work.

-Think most triggers/events might be relative simple to script, so that it does not need graphical editor.
Missions are like making any other gadget, and this one would have much trivial stuff:
For example if player should get reinforments once his army has reached the landing-zone,
That is nothing complicated:
If Spring.GetUnitInCircle (x,y, radius, bla) then Spring.CreateUnit (reinforment units) end

Or example from TutorialRoad, the part where player is told to build a geo powerplant:

Code: Select all

--//geothermal//--
function startStage_Geothermal ()
	missionStage = "geothermal"
	tellPlayer ("Build kbot constructor")
	tellPlayer ("Build Geothermal!")
	walls[1].z= 1500
end

function gadget:GameFrame (frame)
..
	if missionStage == "geothermal" then checkStage_Geothermal () end
..

function checkStage_Geothermal ()
	if countUnitsInCylinder ( 150, 2000, 500, "armgeo") > 0 then
		tellPlayer ("Awesome: Much power!")
...
And all the other objectives are done in similiar way.
It is purposely not as elegant as could be because the point is:
Even with superprimitive spagetthi Lua one can make mission.

The walls[1].z= 1500 is something to prevent the player moving to far offer the map.
It is just copied from the DownCount map
Similiar there the mission-objective-console is just copied from Spring Tanks. (with some leftover stuff)

debugging
/luagaia reload = reloads mission lua without reloading the LuaRules from mod. very useful.
Also can comment out stuff, which in mission editors is more difficult. (at least in the RTS editors I've seen)

mission-Lua VS game-Lua
Game might contain wupdgets that in a mission should not run.
(Same applies to mini-games-mutators)
For example all mods have this tendency to spawn start units all over the map.
The mission does not like that, it wants to spawn its own units.
Mission will want to have its own endgame conditions or disable parts of the GUI etc.
How?

1) replace with empty file
In BA game_initial_spawn.lua spawns the start units.
So to stop that, the TutorialRoad contains LuaRules\gadgets game_initial_spawn.lua - which is simply empty file: Tada, no more start units.
Lua-it rating: meh / 10
But it works without having to edit the mod.
Still, if one has control over the mod there are other ways:

enabled = GG.gadgetName
All wupdgets in mod must do like:

Code: Select all

function gadget:GetInfo()
    return {
...
enabled = GG.enableThis
misson.sdz contains a gadget that is like:

Code: Select all

GG.enable_initial_spawn = false
GG.enable_dgun_limit = true
GG.enable_game_end = false
Works, but maybe one must watch that the layer are in correct order.
LuaGaia gadget's GG is appearently not readable from LuaRules gadgets.
(did not really test those two much)

config file read in Initialize ()
mission.sdz contains some config file like:

Code: Select all

enabledGadgets = {
["enable_initial_spawn"] = false
["enable_dgun_limit"] = true
["enable_game_end"] = false
}
wupdgets in mod read it in their Initialize() and if needed, disable themself.
That is my favorite way so far:
because the mission can also return other stuff to the wupdgets, instead of just enable=true/false.
For example ["dgun_limit"].dgunLimitRadius = 1200 or something like that.

gadgetHandler:RemoveGadget()
Never used it like that, but think with handler=true then gadget-A can disable gadget-B?

---
content for missions, gamedesign
While making the Lua-logic for mission is somewhat straight, making the content and designing mission takes ages.
Making sure that the player knows what to do (esp in tutorials) not smashing players with walls of text, designing fun gameplay, recording audio briefing is not so easy.
Maps might have to be edited many times: to add an extra hill or whatever else the mission story demands.

All that takes effort for something that the player rushes through in few minutes.
So idea might be to have very basic, bland maps (=quicker to make) and explain it by "Hello Commander. Welcome to the battlefield simulator!" 8)

In this mission player starts at end of road and first instruction is "follow the road."
Alternative imagine if more open map was used and instruction was "go to these place."
Makes it more likely that player walks wrong way. Or does not see the objective.
That is superlinear "tunnel level" style, but for tutorialmission best way imo.
If there is only one narrow road to follow then the player will eventually end up at the goal, if he reads instructions or not.
(road could be more narrow than this mission, with walls at side etc)

---
other:
Mission uses gaia Team for the enemy. That is bit limiting but otherwise it would require the player to add bots in specifique teams = too confusing.
To discuss these things see gajop's thread http://springrts.com/phpbb/viewtopic.php?f=21&t=32225
Attachments
bla.png
(653.81 KiB) Downloaded 1 time
TutorialRoadDemo.sdz
beginning of post explains how to play
(2.08 MiB) Downloaded 37 times
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by Anarchid »

Why Lua-it instead of editor?
I think every mission editor in existance can be rather easily patched to include the map terrain files, making the mission a "map".

At the very least, ZK Mission Editor can make mutators, so making it make maps should be easy. And Gajop's scened thing can actually craft terrain (though dunno about exporting that).
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by Jools »

The biggest problem with missions is not how to code them with an editor or in lua, the problem is how to launch them from a lobby or from spring. Currently there is not a single way that's supported on all lobbies, or that doesn't make users drag script files on top of other files. And that's why people don't play missions.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by PicassoCT »

Also important is having them as some sort of state machine.. so even if a phail occurs the game does not crash but simply switches state back the way you came..
o o
| /
o-o-o-o
|
o

Complex missions consist of two things, state-pipes and state hubs..
Also i did missions in lua alone and they are not easy..
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by knorke »

Anarchid wrote:I think every mission editor in existance can be rather easily patched to include the map terrain files, making the mission a "map".
Not sure why you quoted the "Lua-it" part, it seems unrelated to the map/mod question?
Putting mission-files into map (or map-mutator) is imo more logical than the currently used mod-mutators, so if changing that is so easy than maybe worth considering ;)


Jools: yes, that is currently (again ;) ) discussed in http://springrts.com/phpbb/viewtopic.php?f=21&t=32225
PicassoCT wrote:Also important is having them as some sort of state machine.. so even if a phail occurs the game does not crash but simply switches state back the way you came..
In this mission the only real way to fail is losing the Commander.
Until the very end the only way to do so is reclaiming or self-destructing Commander. (commands could be blocked of course)
And then you just get new Commander:

Code: Select all

function gadget:UnitDestroyed(unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam)
	if (unitID == playerCommanderID) then 
		tellPlayer ("The Commander died!")
		tellPlayer ("Usually that is GAME OVER!")
		tellPlayer ("In tutorial, you get new Com!")
		spawnPlayerCommander ()
	end
Also i did missions in lua alone and they are not easy..
What were the problems?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by smoth »

gundam had map specific missions included with it's official maps. KP had the same.

Counter points

Why maps
Gameplay of mission usually requires special terrain that is different to skirmish maps.
By making the mission in that map, in order to revisit that location for a different mission you will require redundant copies of the map. Sure you could include alternate map mission scripts but if you go that route, might as well support missions in game instead of map/mutator.

If you can select a a map then you already know how to select a mission.
Players are stupid, assume this. Player selects speedmetal, doesn't understand why it isn't a mission. Better to have a mission select screen that handles it for them.

-For multiplayer: Changing mod requires rehosting of room.
Changing map does not.
if you are running a mission via selecting it from a list instead of lobby/map based, you don't do any of it.
- Need the mission to be coop so you HAVE to start a room, maybe you should look at a custom lobby?
- Need persistent stats, you will need a custom lobby and autohost. ZK has this.

If played online, the replays get uploaded.
Nothing to do with maps everything to do with lobby implementation. See above

mission-Lua VS game-Lua
Game might contain wupdgets that in a mission should not run.
Can easily disable a gadget by checking for a trigger. Say you don't want research, add something in the top of the thing like if(gg.disableresearch) then kill gadget. It is stupid easy. Same thing goes for the start point code. this is a weak argument and you directly contradict it in the points below this.

content for missions, gamedesign
That is called actual work, you know the thing you always like to pretend has no value. Sure the coding part is glamorous but some of us don't mind actual work.

User was warned for this section of the post. Felony 1.
-- FLOZi
  • Audio
    • KP had this, Panda did the audio for Z's tutorials, took her like a weekend.
  • Art assets
    • Sure super hard if you are no good at it
"All that takes effort for something that the player rushes through in few minutes."
Design a better mission?



If you are going to do missions you don't hack design them, you spend weeks storyboarding, going over the plot, planning the location, getting the concept together, then you craft the mission. If done right mostly you will have to alter a few minor things. If the mission goes horribly wrong, you might scrap the mission, it happens.

When you first test the mission you use place holder art and you use the text for the audio. Once that is finalized, the art is given a final pass and the audio is recorded in timing with the text. This is all fairly standard stuff.


Not that much. Write a better more flexible gadget. Not that hard
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by Anarchid »

Not sure why you quoted the "Lua-it" part, it seems unrelated to the map/mod question?
I was just saying existant mission-maker and mission-runner software should be able to perform "map missions" easily enough without need for "doing it by hand".

Afaik ZK mission-running gadgetry directly supports disabling unnecessary game-archive gadgets/widgets, etc.

Having missions as maps strikes me as somewhat logical, though the point of having them possibly disambiguated at "module type" level is still good.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by PicassoCT »

Making them map-independent
Finding out if places were reachable..
Strange states reachable by players beeing creative
Figure scripts doing strange stuff when getting in said strange states (you never think of all of them)..
(For example waterlevel rising making formerly reachable terrain a island)

Some stuff just hanging in the midst of things.. (still didnt figure out that one)
General work-intensity (Good sound, good effects, unique units, covering stupid dead-ends with atleast a unique death text message)..

Also AI not beeing able to cope with some units handed over for missions, so AI has to be adapted exactly to missions (basically have to write a sub-AI for every single one).
Else to protect unit stands around or is sent to the front.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by zwzsg »

Map-independent mission sound insane. Unless they're not really mission, but simple objective stuff.

Yes, making sure missions can't be broken if the player goes against the flow can be very tedious.

For the specific purpose of missions, I made a special Lua AI that tries to rebuild stuff. Like if there is a Peewee at the beginning of the game, and that peewee gets destroyed, it will loop through idle factories until it finds one that is idle and that has Peewee in its buildmenu, rebuild a Peewee, wait till construction is complete, move it to where the previous Peewee was, and copy back the order queue of the previous Peewee. It's generic enough that it should work with all mod where units are built the regular way. For exemple, Kernel Panic "bug" morphing into "exploit", and "packet" dispatch, required extra special code to handle.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by knorke »

Anarchid wrote:Afaik ZK mission-running gadgetry directly supports disabling unnecessary game-archive gadgets/widgets, etc.
Yes, think that function existed.
But it only exists because somone wrote it and also wrote the Lua that the editor outputs when exporting the mission.
If I click checkboxes in some graphical menu or change some =false/true variables in a config, to me is not so important.
PicassoCT wrote:Finding out if places were reachable..
Strange states reachable by players beeing creative
Figure scripts doing strange stuff when getting in said strange states (you never think of all of them)..
(For example waterlevel rising making formerly reachable terrain a island)
Ah ok, I thought you meant problems specifique to "lua-only" missions.
These things can happen when using a graphical editor, too.
Also AI not beeing able to cope with some units handed over for missions, so AI has to be adapted exactly to missions (basically have to write a sub-AI for every single one).
Depends how complex AI behaviour is needed for mission. Imo it is possible to make interessting missions without "real" AI, too.
Special Lua-AIs like zwzsg's rebuilder-AI are imo the way to go. (and that one is reusable)
But even rebuilder-AI is quite complex, instead some scripting to make enemy units follow waypoints etc can be sufficient too.
If you want eg air transports to make an attack on players base, that does not need a full AI: Just some Spring.GiveOrderToUnit calls.
In a mission, scripting the enemies action will appear more alive and clever than any real AI will ever be and more importantly: You have excact controll what happens in mission.
Unless it is supposed to be very open-world style hm.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by gajop »

Cool stuff.
It seems you are presenting two things here: 1) map-based missions, 2) missions coded in entirely in Lua.
knorke wrote: It is quickly thrown together, it took about 2 hours, including the ugly map.
This is amazing, I wouldn't be able to do it in its entirety in 2 hours, and I'm pretty certain most other current devs would struggle to make the mark.
It's important to note that you have a ton of Spring knowledge and not just in coding, that very few people here have: e.g. I've nearly no idea how to make even a decent looking map. It's something I could potentially learn, much like coding, but it's not trivial :)

Further, I'd like to bring mission making closer to gamers, so that non-programmers would be able to make non-mediocre missions, and they should be able to do so. Most gamers should be to write the script of what you just wrote in words, and hopefully with a little bit of effort would also be able to do so in a GUI editor.
knorke wrote: -Gameplay of mission usually requires special terrain that is different to skirmish maps.
So a special map needs to be made anyway.
Often, yes, but.. it seems like people just reuse existing skirmish maps for missions. Check Issue #2 here: http://etherpad.springrts.com/p/mission_format . I'm not decided if missions should be able to contain map archives as well, or have them included optionally (currently maps are 'just' referenced). A lot of non-Spring games actually have missions as maps so the motivation could is present, but in those cases maps are always running on one game, which is a different case from Spring.
knorke wrote: -If you can select a a map then you already know how to select a mission.
Not needing to select mod "Balanced Annhilation-mutatorMission XY" and then guessing which map is right one.
I don't understand the benefit here :( You would still need to "guess" the right game, which can be non-trivial if the mission is designed for a specific version.
knorke wrote: -For multiplayer: Changing mod requires rehosting of room.
Changing map does not.
Unless it's a map for a different game (or a different game version, which is just as possible).
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by PicassoCT »

zwzsg wrote:Map-independent mission sound insane. Unless they're not really mission, but simple objective stuff.
Just because you didnt try it, doesent say it can not work. And the rewards are utterly alien.
Escort that tank you brought to raid deep behind the enemy lines - back to safety. etc.

And simple objective stuff glued together is what makes most of your singleplayer missions.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by smoth »

Well he said "sounds" which I took for him saying that it is not impossible but highly unlikely.

having the missions randomly plonked could result in issues but also some maps in spring are just not good ones to use. You are talking about accounting for a lot of different map issues. When I was working on my halloween thing, I was playing with that idea. Not effectively building the map while placing objectives can result in issues.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by SinbadEV »

I think it might be worthwhile to think of "Skirmish" as a mission... namely "kill the other guy" or what have you... so, from a player flow you would choose Game > Mission > Map > Players (but in the case of some missions the choices for Map and Players would be limited)
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by gajop »

SinbadEV wrote:I think it might be worthwhile to think of "Skirmish" as a mission
Don't think so. Let's not make up weird generalizations that will just make things ambiguous. "Skirmish" is a "default" game mode, and has nothing to do with any concrete map. "Missions" have always been directly linked to maps.
PicassoCT wrote:
zwzsg wrote:Map-independent mission sound insane. Unless they're not really mission, but simple objective stuff.
Escort that tank you brought to raid deep behind the enemy lines - back to safety. etc.
And simple objective stuff glued together is what makes most of your singleplayer missions.
Missions without maps are not missions. If they can be played on many different maps then it's just a game, or if they can be used to make other missions then they're "mission templates".

For example, something that spawns waves on enemies for tower defense-type games would be a "mission template", because you would use that existing code to script it for your specific map. On the other hand, Chickens is a perfect example of a game (or a game mode), which can work on a wide variety of maps without any special (or notable) map-specific scripting.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by Anarchid »

Mapless missions are "game modes", i'd say.

You can turn any map in ZK into lavarise, but that doesn't make lavarise a mission. Same with zombies and other quirky stuff.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by SinbadEV »

Skirmish is a "game mode" then... as are missions... I'm not thinking about "how to implement" so much as "how players will interact with the system".

If the game mode (Skirmish, BA Chicken Defence, EvoRTS Tutorial Mission One) I've selected only works on certain maps and with certain AIs then my choices will be limited once I've chosen that game mode. If you have a hierarchy that starts with all available content and ends with a specific script to execute on launch you have one "thing" with many choices on how to accomplish your task.

Maybe set it up with something like a "validcontent.lua" in every step... for example, choose a game and it's "validcontent.lua" specifies that the available game modes are Open Skirmish, Ranked Skirmish, Chickens and Campaign... if I choose Open Skirmish it's validcontent.lua says I can then choose any map while Ranked Skirmish has a validcontent.lua that says I can choose from a list of approved maps, Chicken's validcontent.lua says I can choose from a list of compatible maps (based not on a whitelist but by some identifier in the mapinfo.lua), Campaign's validcontent.lua has a list of missions I can choose from and each mission's validcontent.lua says which specific map and AI will be loaded for that match.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: (blog) missions = maps with Lua (feat. demo-mission for

Post by gajop »

SinbadEV wrote:Skirmish is a "game mode" then... as are missions...
No.
If the game mode (Skirmish, BA Chicken Defence, EvoRTS Missions)
These are equal categories (emphasis mine).
Post Reply

Return to “Community Blog”