A tour in the GameEngine ?

A tour in the GameEngine ?

Postby ezee » Sun Feb 23, 2014 5:04 pm

Hello .

Something is missing in this very good site , it's a ' quick ' tour in the VS engine .
It was in the roadMap , but no dev have taken in charge this task until now .
http://wiki.vega-strike.org/Development ... umentation
Documentation

Document the general function/flow of the game
Engine internals, API (development documentation)
Python bindings
...


One could ask : " How can you code an engine without knowing how it works ? " .

If some knows actually how it works , they seem to don't want to share their knowledge . Or don't take the time .
I will not complain here ( already done :lol: ) , but i will try to initiate a guided tour for those are interested .
Now that i made a documentation online , we will have this help as reference :
http://spacetechs.free.fr/VEGASTRIKEDEV ... tated.html

A particularity in the Vegastrike's game engine , is that two langages are used .
C++ for the main stuff , and python for scripting .
I will only cover here the c++ side , but we will encounter python where the wrapping
occurs .

Be ready to encounter some very strange and undocumented code , and stay grouped caus" we enter a labyrinth ! You ready ? get ... set !

START OF THE ENGINE :

Like every program , the start is located in an entry point .
This entry point is located in the file Main.cpp :
http://spacetechs.free.fr/VEGASTRIKEDEV ... tml#l00241

You will notice that the main(...) function is located at the line 241 .
That mean that 240 lines of code where executed before .
Let have a look on it :
Code: Select all
  19 #include "config.h"
   20 #include "cs_python.h"
   21 #include "audio/test.h"
   22 #if defined (HAVE_SDL)
   23 #include <SDL/SDL.h>
   24 #endif
   25 #include "cmd/role_bitmask.h"
   26 #if defined (WITH_MACOSX_BUNDLE)
   27 #import <sys/param.h>
   28 #endif
   29 #ifdef _WIN32
   30 #include <direct.h>
   31 #include <process.h>
   32 #endif
   33 #include "gfxlib.h"
   34 #include "in_kb.h"
   35 #include "lin_time.h"
   36 #include "main_loop.h"
   37 #include "config_xml.h"
   38 #include "cmd/script/mission.h"
   39 #include "audiolib.h"
   40 #include "config_xml.h"
   41 #include "vsfilesystem.h"
   42 #include "vs_globals.h"
   43 #include "gfx/animation.h"
   44 #include "cmd/unit.h"
   45 #include "gfx/cockpit.h"
   46 #include "python/init.h"
   47 #include "savegame.h"
   48 #include "force_feedback.h"
   49 #include "gfx/hud.h"
   50 #include "gldrv/winsys.h"
   51 #include "universe_util.h"
   52 #include "networking/netclient.h"
   53 #include "universe.h"
   54 #include "save_util.h"
   55 #include "gfx/masks.h"
   56 #include "cmd/music.h"
   57 #include "ship_commands.h"
   58 #include "gamemenu.h"
   59
   60
   61 #include "audio/SceneManager.h"
   62 #include "audio/TemplateManager.h"
   63 #include "audio/renderers/OpenAL/BorrowedOpenALRenderer.h"
   64
   65 #include <time.h>
   66 #if !defined(_WIN32) && !defined (__HAIKU__)
   67 #include <sys/signal.h>
   68 #endif
   69
   70 #if defined (_MSC_VER) && defined (_DEBUG)
   71 #include <crtdbg.h>
   72 #endif
   73
   74 #if defined (CG_SUPPORT)
   75 #include "cg_global.h"
   76 #endif
   77
   78 #include "options.h"


That " include " section is a good indicator about the things we will find in that file .
I can't step into each detail , so we gonna check know the globals :

Code: Select all
/*
   86  * Globals
   87  */
   88 Universe  *_Universe;
   89 TextPlane *bs_tp = NULL;
   90 char SERVER = 0;


The most important global object here is _Universe . We will visit that class later , but you are free to explore it by now !

:idea: That seem to me that it would be better to use the wiki for such a trip .
I could create specific pages for each important classes , like in details parenthesis .
Diagrams could be nice also .

If this idea is good enough for you , let me know ?

to be continued ...

( i plan to make sections :

_ RENDER ENGINE
_ AUDIO ENGINE
_ PHYSICS ENGINE
_ NETWORK ENGINE
_ GAME LOOPS
_IA )
Code: Select all
 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }

Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
 
Posts: 703
Topics: 65
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron