User Tools

Site Tools


hpl3:game:guides:scripters_guide

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
hpl3:game:guides:scripters_guide [2013/11/08 09:02]
ian.thomas [Specific Guidelines]
hpl3:game:guides:scripters_guide [2014/11/12 11:38]
thomas [Code Structure]
Line 64: Line 64:
 ===== Code Structure ===== ===== Code Structure =====
  
-Since a lot of people will be working on the same piece of code it is important that the same structure is maintained. This way it makes it easier for people to find what they need to do to change something. ​+Since a lot of people will be working on the same piece of code it is important that the same structure is maintained. This way it makes it easier for people to find what they need to do to change something.
  
 //Note: In the code below, spaces are used to indent, do NOT use this, use tab instead!// //Note: In the code below, spaces are used to indent, do NOT use this, use tab instead!//
- +<code c++>//​--------------------------------------------------
-<code c++> +
- +
-//​--------------------------------------------------+
  
 /*Place any global values here. These must be const variables as they will not be saved*/ /*Place any global values here. These must be const variables as they will not be saved*/
Line 79: Line 76:
 class cScrMap : iScrMap class cScrMap : iScrMap
 { {
-   //​-------------------------------------------- + //​--------------------------------------------
-    +
-   /////////////////////////////////////////​ +
-   // ============== +
-   // MAIN CALLBACKS +
-   // ============== +
-   /////////////////////////////////////////​+
  
-   //------------------------------------------------------- + //////////////////////////////////////////////////////////////////////////////////////////​ 
-    + // ============== 
-   /*OnStart, OnEnter, OnLeave, Update (avoid this), OnAction (debug only), OnPlayerDead,​ etc are here.*/ + // MAIN CALLBACKS 
-    + // ============== 
-   //------------------------------------------------------- + //{///////////////////////////////////////////////////////////////////////////////////////​
-    +
-   /////////////////////////////////////////​ +
-   // ============== +
-   // MAIN FUNCTIONS +
-   // ============== +
-   /////////////////////////////////////////​ +
-    +
-   //------------------------------------------------------- +
-    +
-   ​/*Put any variables that are used in more than one scene here.*+
-    +
-   //------------------------------------------------------- +
-    +
-   ​/*Put any functions that are used in more than one scene here.*   +
-    +
-   //------------------------------------------------------- +
-    +
-   /////////////////////////////////////////​ +
-   // ============== +
-   // SCENE X *NAME OF SCENE* +
-   // ============== +
-   /////////////////////////////////////​//// +
-  +
-   //​------------------------------------------------------- +
-    +
-   /*Put any variables that are used by many events in Scene X here.*/+
  
-   //​------------------------------------------------------- + //​-------------------------------------------------------
-    +
-   /*Put any functions that are used in more than one event in Scene X here.*/ ​  +
  
-    ​//-------------------------------------------------------+ /*OnStart, OnEnter, OnLeave, Update (avoid this), OnAction (debug only), OnPlayerDead,​ etc are here.*/
  
-    /////////////////////////////////////////​ + //​-------------------------------------------------------
-    // Scene X Event X *Name Of Event* +
-    /////////////////////////////////////////​ +
-     +
-    ​//​------------------------------------------------------- +
-     +
-    /*Put any variables that are only used in Scene X, Event X here.*/+
  
-    ​//------------------------------------------------------- + //} END MAIN CALLBACKS
-    +
-    /*Put any functionsthat are only used in Scene X, Event X here.*/ +
-     +
-    //​------------------------------------------------------- +
-     +
-    /////////////////////////////////////////​ +
-    // ============== +
-    // TERMINALS +
-    // ============== +
-    /////////////////////////////////////////​ +
-     +
-    //​------------------------------------------------------- +
-     +
-    /////////////////////////////////////////​ +
-    // Terminal *Name Of Terminal* +
-    /////////////////////////////////////////​ +
-     +
-    //​------------------------------------------------------- +
-     +
-    /*Put any variables that are only used Terminal here.*/ +
-     +
-    //​------------------------------------------------------- +
-     +
-    /*Put any functions that are only used Terminal here.*/ +
-     +
-    //​-------------------------------------------------------+
  
-}+ //////////////////////////////////////////////////////////////////////////////////////////​ 
 + // ============== 
 + // MAIN FUNCTIONS 
 + // ============== 
 + //​{///////////////////////////////////////////////////////////////////////////////////////​
  
 + //​-------------------------------------------------------
 +
 + /*Put any variables that are used in more than one scene here.*/
 +
 + //​-------------------------------------------------------
 +
 + /*Put any functions that are used in more than one scene here.*/
 +
 + //​-------------------------------------------------------
 +
 + //} END MAIN FUNCTIONS
 +
 + //////////////////////////////////////////////////////////////////////////////////////////​
 + // ==============
 + // SCENE X *NAME OF SCENE*
 + // ==============
 + //​{//////////////////////////////////////////////////////////////////////////////////////​
 +
 + /////////////////////////////////////////​
 + // Scene X GENERAL
 + //​{//////////////////////////////////////​
 +                 //​-------------------------------------------------------
 +
 + /*Put any variables that are used by many events in Scene X here.*/
 +
 + //​-------------------------------------------------------
 +
 + /*Put any functions that are used in more than one event in Scene X here.*/
 +
 + //​-------------------------------------------------------
 +                 //} END General
 +
 + /////////////////////////////////////////​
 + // Event *Name Of Event*
 + //​{//////////////////////////////////////​
 +
 + //​-------------------------------------------------------
 +
 + /*Put any variables that are only used in Scene X, Event X here.*/
 +
 + //​-------------------------------------------------------
 +
 + /*Put any functionsthat are only used in Scene X, Event X here.*/
 +
 + //​-------------------------------------------------------
 +
 + //} END Event *Name Of Event*
 +
 + //} END SCENE X
 +
 + /////////////////////////////////////////​
 + // ==============
 + // TERMINALS
 + // ==============
 + //​{//////////////////////////////////////​
 +
 + //​-------------------------------------------------------
 +
 + /////////////////////////////////////////​
 + // Terminal *Name Of Terminal*
 + //​{//////////////////////////////////////​
 +
 + //​-------------------------------------------------------
 +
 + /*Put any variables that are only used Terminal here.*/
 +
 + //​-------------------------------------------------------
 +
 + /*Put any functions that are only used Terminal here.*/
 +
 + //​-------------------------------------------------------
 +
 + //} END Terminal *Name Of Terminal*
 +
 + //} END TERMINALS
 +
 +}
 </​code>​ </​code>​
  
-**Note1:​**\\+**Note1:** \\
 It is OK if terminals use variables that are scene or event specific! It is OK if terminals use variables that are scene or event specific!
  
-**Note2:​**\\+**Note2:** \\ 
 +Have snuck in some { and } to make code folding for sections possible. 
 + 
 +**Note3:** \\
 Remember to always separate functions with a comment line, like this: Remember to always separate functions with a comment line, like this:
  
-<code c++> +<code c++>void Func1()
-void Func1()+
 { {
  
Line 183: Line 197:
  
 } }
- 
 </​code>​ </​code>​
 +
 +==== Naming Conventions ====
 +
 +A few naming conventions for map scripting and level building:
 +
 +=== Areas ===
 +
 +Name trigger areas in the level Trigger_xxxx to make them easier to find.
 +
 +=== Sequences ===
 +
 +Name sequence functions in your map script Seq_xxxx
  
 ===== Design ===== ===== Design =====
Line 266: Line 291:
  
 i.e. it's unlikely we'd show an extract from the middle, unless it's critical to the protagonist'​s current plans e.g. the instruction manual for a device he's interested in or something. i.e. it's unlikely we'd show an extract from the middle, unless it's critical to the protagonist'​s current plans e.g. the instruction manual for a device he's interested in or something.
- 
-=== Helper Functions === 
- 
-  * Helper functions should use degrees, not radians 
  
 ==== Further information ==== ==== Further information ====
hpl3/game/guides/scripters_guide.txt · Last modified: 2015/09/25 11:10 by jens