Difference between revisions of "Moving to Lua"

From PioneerWiki
Jump to: navigation, search
(Undo revision 3533 by Wrwewvwre (talk))
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=Goal=
+
 
 +
= Goal =
  
 
This article assumes that a development goal of Pioneer is to move as much game logic as possible out of the C++ core, and into the Lua environment. That in time, Lua will govern what happens in the game, and the engine will be left to implement how that happens. '''What, not how''' is a guiding principle.
 
This article assumes that a development goal of Pioneer is to move as much game logic as possible out of the C++ core, and into the Lua environment. That in time, Lua will govern what happens in the game, and the engine will be left to implement how that happens. '''What, not how''' is a guiding principle.
Line 5: Line 6:
 
The goal of this article, therefore, is to determine a sequence of feature development where each feature is not implemented before something upon which it depends. Each feature is defined as a heading in the next section, including a bulleted list of features which must exist beforehand, and which should exist beforehand.
 
The goal of this article, therefore, is to determine a sequence of feature development where each feature is not implemented before something upon which it depends. Each feature is defined as a heading in the next section, including a bulleted list of features which must exist beforehand, and which should exist beforehand.
  
=Features=
+
= Features =
 +
 
 +
== Lua control of hyperspace ==
  
==Lua control of hyperspace==
 
 
Instead of being a core API function, <tt>Ship.HyperspaceTo()</tt> would be a Lua function directly responsible for deciding upon the distance, fuel use, elapsed time, chance of failure and destination of a jump. This function could call a core function to initiate a jump with elapsed time and destination arguments, and the core would immediately set about destroying the current system, animating the jump and building the next one. If it decided the jump was to happen, the Lua function would deduct the relevant quantity of whichever cargo (if any).
 
Instead of being a core API function, <tt>Ship.HyperspaceTo()</tt> would be a Lua function directly responsible for deciding upon the distance, fuel use, elapsed time, chance of failure and destination of a jump. This function could call a core function to initiate a jump with elapsed time and destination arguments, and the core would immediately set about destroying the current system, animating the jump and building the next one. If it decided the jump was to happen, the Lua function would deduct the relevant quantity of whichever cargo (if any).
  
==Lua-defined cargo==
+
== Lua-defined cargo ==
 +
 
 
All cargo (and equipment) items are defined in Lua, using some sort of cargo class. The engine itself is completely agnostic as to the concept of cargo. It doesn't know or care what you have, as long as it knows how much mass there is.
 
All cargo (and equipment) items are defined in Lua, using some sort of cargo class. The engine itself is completely agnostic as to the concept of cargo. It doesn't know or care what you have, as long as it knows how much mass there is.
  
 
Depends on:
 
Depends on:
* [[#Lua control of Hyperspace]] (hyperspace requires Hydrogen)
 
* [[#Lua-based commodities market]]
 
* Presence of an UpdateCargoMass method in a ship.
 
* API to trigger a weapon effect
 
* API to spawn missiles & similar
 
  
==Arbitrary cargo==
+
*[[#Lua_control_of_Hyperspace|#Lua control of Hyperspace]] (hyperspace requires Hydrogen)
 +
*[[#Lua-based_commodities_market|#Lua-based commodities market]]
 +
*Presence of an UpdateCargoMass method in a ship.
 +
*API to trigger a weapon effect
 +
*API to spawn missiles & similar
 +
 
 +
== Arbitrary cargo ==
 +
 
 
Special items ("MacGuffins") required to complete missions or quests. Could include, for example, "5 Furies statue" or "Mycoid vaccine".
 
Special items ("MacGuffins") required to complete missions or quests. Could include, for example, "5 Furies statue" or "Mycoid vaccine".
  
 
Depends on:
 
Depends on:
* [[#Lua-defined cargo]]
 
  
==Arbitrary equipment==
+
*[[#Lua-defined_cargo|#Lua-defined cargo]]
Mission-specific equipment, such as cameras, soil samplers, radiometers, beacons, etc which must be activated or deployed as part of a mission.  
+
 
 +
== Arbitrary equipment ==
 +
 
 +
Mission-specific equipment, such as cameras, soil samplers, radiometers, beacons, etc which must be activated or deployed as part of a mission.
  
 
Depends on:
 
Depends on:
* [[#Lua-defined cargo]]
+
 
* New UI
+
*[[#Lua-defined_cargo|#Lua-defined cargo]]  
 +
*New UI

Latest revision as of 04:36, 23 July 2018

Goal

This article assumes that a development goal of Pioneer is to move as much game logic as possible out of the C++ core, and into the Lua environment. That in time, Lua will govern what happens in the game, and the engine will be left to implement how that happens. What, not how is a guiding principle.

The goal of this article, therefore, is to determine a sequence of feature development where each feature is not implemented before something upon which it depends. Each feature is defined as a heading in the next section, including a bulleted list of features which must exist beforehand, and which should exist beforehand.

Features

Lua control of hyperspace

Instead of being a core API function, Ship.HyperspaceTo() would be a Lua function directly responsible for deciding upon the distance, fuel use, elapsed time, chance of failure and destination of a jump. This function could call a core function to initiate a jump with elapsed time and destination arguments, and the core would immediately set about destroying the current system, animating the jump and building the next one. If it decided the jump was to happen, the Lua function would deduct the relevant quantity of whichever cargo (if any).

Lua-defined cargo

All cargo (and equipment) items are defined in Lua, using some sort of cargo class. The engine itself is completely agnostic as to the concept of cargo. It doesn't know or care what you have, as long as it knows how much mass there is.

Depends on:

Arbitrary cargo

Special items ("MacGuffins") required to complete missions or quests. Could include, for example, "5 Furies statue" or "Mycoid vaccine".

Depends on:

Arbitrary equipment

Mission-specific equipment, such as cameras, soil samplers, radiometers, beacons, etc which must be activated or deployed as part of a mission.

Depends on: