Changes between Version 1 and Version 2 of MissionLifetime
- Timestamp:
- 11/25/10 18:12:11 (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MissionLifetime
v1 v2 1 = Mission Lifetime = 2 3 == Creation == 4 1 5 Every time that the player lands on a planet, several "potential" missions are created and stored in a global table named availableMissions. 2 6 … … 13 17 14 18 Notice that the availableMissions are being Created by the "Create" function that I tried to explain before. At this point the mission is just the missionTable, there is no c++ representation (or even knowledge) of this mission. Once the player lands on a new planet, the availableMissions array is reinitialized, removing all references to the missionTables which the Lua garbage collector will later free. 19 20 == Acceptance == 15 21 16 22 If the player clicks on one of the "Accept" buttons, the Button will run this string: … … 35 41 }}} 36 42 43 == Life == 44 37 45 Every tick after this, the player will check if that mission has completed by calling it's Update function. If the Mission has completed, then the Mission object on the heap is deleted. The Mission destructor should destroy the missionTable by removing it from Lua's global registry. 46 47 == Saving and Loading == 38 48 39 49 Whenever the game is saved (whenever the player leaves a planet), the mission is converted into an XML Node and saved in the saved-games.xml file. This required a conversion between arbitrary lua tables and XML that was only written recently. The converter doesn't produce the most beautiful XML code, but the goal here is to make it easy for modders to create creative missions and not to create pretty XML tables. The XML converter also can't handle lua functions as first class objects.