Development:Missions

From VsWiki
Revision as of 03:35, 21 March 2005 by 202.50.187.13 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Wiki Home | FAQ | Manual | Database | HowTos | Development | MODs | Links

EDITING MISSIONS

Introduction

Vega Strike has a powerful missions scripting interface that allows you to nearly modify Vega Strike at whatever level you choose, from the AI scripts (and the physics thereof) to the missions... to the overall plot and goal of the game.

Basic XML integration

First let me start by explaining how to run a python class... in this case we start with the prebuild "privateer.py" script to run our mission. Open up mission/explore_universe.mission First come the variables that designate how the mission should normally start. By normally I mean if they don't have any save game present.

Variables Section

It loads Crucible/Cephid_17.system as the star system (which is in XML and stores all present planets) After this, comes the actors in the mission, the flightgroups of fighters. If a mission has more than one player, then each player is the leader (first ship) in each respective flightgroup.

Notice that so far there are a lot of values you don't see for long in the default vegastrike game. Credits, System, first flightgroup fighter, difficulty--these are all initial values but can change.... since there is specified a savegame. The savegame makes the mission more of a campaign type mission where things may be saved to disk and reloaded at a later point. If no savegame variable is specified (this is where the autosave goes) then the mission will not save and will be a one time play mission.

<mission>
	<settings>
		<origin  planet="earth" x="0000" y="100" z="000.0"/>
	</settings>

	<variables>
<!--		<var name="continuousterrain" value="continuousterrain.txt"/>-->
		<var name="credits" value="13500"/>
		<var name="defaultplayer" value="blue"/>
		<var name="mission_name" value="Privateer Mission" />
		<var name="difficulty" value=".05"/><!--starting difficulty-->
		<var name="system" value="Crucible/Cephid_17" />
		<var name="description" value="Like, as if." />
		<var name="savegame" value="explore_universe_difficulty" />
	</variables>


Flightgroup Section

The rot flag is ignored, and the position specifies the x,y,z coords of the Shlimazel flightgroup, which is of type llama.begin.

        <flightgroups>
                <flightgroup name="Shlimazel" faction="privateer" type="llama.begin"
                                  ainame="default" waves="1" nr_ships="1">
			<pos x="-95124024.543917" y="412089916.256812" 
                             z="-110779667.398050"/>  
			<rot x="180.0" y="180.0" z="180.0"/>
			<order order="tmptarget" target="omikron"/>
			<order priority="0" order="superiority" target="enemy"/>
			<order priority="1" order="bomber" target="omikron"/>
			<order priority="2" order="escort" target="blue"/>
		</flightgroup>
        </flightgroups>

Python Section

Future note: If you wanted to add a campaign to the privateer mission you would most likely modify privateer.py to have a campaign module get loaded.... so you wouldn't necessarily need to modify explore_universe.mission just to add a campaign... lets dig further into the meat of the scripting.

If a mission has python tags...then it is a python mission and may have some embedded python in it. In this case the python makes a new python object of type privateer in the privateer.py module in the modules/ directory.


	<python>
                from privateer import privateer
                my_obj=privateer(8000,40000,500,3,2,.6,.25,.1,400000,2000)
	</python>
<!--	<module name="director">
		<import name="privateer"/>
		<script name="initgame">
			<exec module="privateer" name="init">
			<const type="float" value="8000.0"/><!-- significant distance-->
			<const type="float" value="40000.0"/><!-- detection distance-->
			<const type="float" value="500.0"/><!-- generation distance -->
			<const type="int" value="3"/> <!-- min ships -->
			<const type="int" value="2"/><!--gen ships-->
			<const type="float" value="0.6"/><!--fighter prob-->
			<const type="float" value="0.25"/><!--enemy prob-->
			<const type="float" value="0.02"/><!--capship prob-->
			<const type="float" value="400000.0"/><!--Max diff credits-->
			<const type="float" value="2000.0"/><!--capship distance-->
			</exec>
		</script>
		<script name="gameloop">
			<exec module="privateer" name="loop"/>
		</script>
		<script name="initstarsystem">
			<exec name="initstarsystem" module="privateer" />
		</script>

	</module>-->
</mission>

You have to be careful about newlines, etc in the XML, but it shoudl usually work just dandy. You notice that the mission may pass in arguments to the privateer module that can make slight changes in teh gameplay. This allows many cargo missions to use the same module in order to change the parameters of the cargo missions. In this case the values I have selected appear to work relatively well.

Python Inheritance In Missions

Python Inheritance with AI Scripts

Suppery about python-Vegastrike class relationships

Python - Vega Strike Bindings

Writing Add On Adventures

Conclusion

See also

Wiki Home | FAQ | Manual | Database | HowTos | Development | MODs | Links