Changes between Initial Version and Version 1 of Finding_Your_Way_Around


Ignore:
Timestamp:
Feb 23, 2008, 4:18:59 AM (16 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Finding_Your_Way_Around

    v1 v1  
     1= Getting the source =
     2
     3All the files used in Pyrogenesis and game data are all stored via version control. For anyone not familiar with version control, it's a system that keeps us all up to date and allows us to work together (even work on the same file) by keeping track of multiple versions of a shared file.
     4
     5It keeps track off all changes and provides a more powerful alternative to keeping backup files by storing every version put back in. This allows us to undo any mistakes. To use source control we need to download a client such as:
     6
     7''TortoiseSVN'' ... the easy-to-use Windows-Explorer-integrated frontend to our Subversion repository.  This can be downloaded from here http://tortoisesvn.tigris.org/
     8
     9For information about how to acquire, configure, and use TortoiseSVN, check out the [wiki:TortoiseSVN_Guide TortoiseSVN Guide].
     10
     11= Important notes for Visual Studio version 6 and .net 2002 users =
     12
     13Pyrogenesis uses a standardised compiler so anyone using not using version Microsoft studio.net 2003 or 2005 should Upgrade by download the Microsoft C++ tool kit 2003 from the Microsoft website using the link below. The example installation details are for Studio 2002.
     14
     15http://www.microsoft.com/downloads/details.aspx?!FamilyId=272BE09D-40BB-49FD-9CB0-4BFA122FA91B&displaylang=en
     16
     17This can either be installed over the current studio installation.
     18I.e. change the installation path to "C:\Program Files\Microsoft Visual Studio .NET\Vc7" this will then over write the relevant files.
     19A more cautious way is installing to another directory and manually copying the bin/lib/include across into the relevant Vc7 directories. After backing up the bin/lib/include directories so you can put things back if all goes wrong.
     20It might also be possible to install the Toolkit into a different directory and then use the options dialog for adding/changing include/lib/binary directories (this way you could switch back to your old buggy compiler, would you ever want to).
     21
     22In addition the following file may be needed so it should be downloaded and extracted into the lib directory.
     23http://wildfiregames.com/~code/libraries/msvclibs.zip
     24
     25= Notes for Visual Studio 2005 users =
     26Users of [http://lab.msdn.microsoft.com/express/visualc/default.aspx VC++ 2005 Express Edition] will probably need to download and install the [http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ Platform SDK], and add its ''include'' and ''lib'' directories to the appropriate lists. (Beta 2 seems to be missing the global include/lib directory configuration screen, so you have to add it to the project properties instead.)
     27
     28= Finding your way around =
     29
     30There are 4 main directories in the repository:
     31
     32 * Source    : The source code for the main game and tools, as you would expect.
     33 * Build     : Tools and workspaces required to build the source.
     34 * Binaries  : This contains a working game exe, DLLs and Tools.
     35 * Libraries : These are the libraries used in the product.
     36
     37All these are covered in more depth below.
     38
     39== binaries ==
     40
     41This is where everything that will eventually be released to the end user ends up. This is the only part that an artist or designer needs. It contains all the tools, data and of course the main game exe. This is where the any executables are compiled to.
     42
     43The main game can be run from pyrogenesis.exe and the scenario editor from Atlas.bat (which invokes pyrogenesis.exe -editor). These both can be found in the Binaries\System\ directory. So to play the latest build it should be possible to just click on the ps.exe file.
     44
     45{{{
     46  data
     47    config
     48        Contains the system.cfg, this is used to setup the engine
     49        Contains Hot key set up. Ect.
     50    mods
     51        This is where the game/s lies containing all the game data.
     52        The main game lies in the "official" directory
     53        Each directory or zip will contain a different game
     54    profiles
     55        Each profile contains that particular player's saved games, config settings,
     56        and user statistics.
     57    screenshots
     58        Screenshots taken by the player, grouped by game type.
     59    tools
     60        Data for external tools
     61    logs
     62        Error reports generated by Prometheus.
     63    system
     64        Binaries (the main game engine, Scenario Editor, and other tools such as xmbcleanup)
     65        and relevant DLLs
     66}}}
     67
     68== build ==
     69
     70This is where the workspaces are generated so we can start work.
     71This is done by going into the workspace directory and running the  update-workspaces.bat file this then creates all visual studio workspaces for Vc6, Vc7 and Vc2003. So depending on which editor your using enter the relevant directory and a workspace will have been created for your editor. Studio 6 & 2002 users should read the note below.
     72
     73{{{
     74  premake               
     75    This useful little tool generates the Make files for different formats (i.e Vstudio, Linux) this
     76    is usefull to us to create different workspaces for different compilers for when new files are
     77    added. Note: this defines all compile settings; they are automatically translated to each IDE�s format. More info : http://premake.sourceforge.net/
     78  workspaces
     79    This is where the workspaces are generated. Run ''update workspaces'' batch.
     80    Relevant directories for editors then appear.
     81  xmbcleanup
     82    XMBCleanup is a utility that gets rid of extra XMBs so only the latest one for each XML exists
     83   (it needs to create a new one each time the file is modified to ensure it's new).
     84  bin
     85    contains pearl dll to run pearl scripts
     86  errorlist     
     87    A tool for regenerating the error.h file (list of error codes and exception types)
     88  linefix
     89    fixes line breaks in files (from unix/windows to whatever you're running). Avoid if possible (it reduces the usability of the SVN change information, since the entire file is considered modified)
     90}}}
     91
     92== libraries ==
     93
     94These are the third-party libraries currently stored in the repository; they are not necessarily used in the final game.
     95Here are some descriptions of the libraries and where it can be downloaded from.
     96
     97{{{
     98  Devil
     99    Graphics format Reader
     100    Developer's Image Library (DevIL) is a programmer's library to develop applications with very
     101    powerful image loading capabilities, yet is easy for a developer to learn and use. Ultimate
     102    control of images is left to the developer, so unnecessary conversions, etc. are not performed.
     103    DevIL utilises a simple, yet powerful, syntax. DevIL can load, save, convert, manipulate, filter
     104    and display a wide variety of image formats.
     105    More info : http://openil.sourceforge.net/
     106       
     107  SpiderMonkey
     108    Mozilla's Javascript engine.
     109    SpiderMonkey is the code-name for the Mozilla's C implementation of JavaScript.
     110    This is used for scripting though out the game.
     111    More info : http://www.mozilla.org/js/spidermonkey/
     112}}}
     113
     114{{{
     115  OpenAL       
     116    Platform independent audio driver, equivalent to OpenGL in audio terms.
     117    OpenAL is a cross-platform 3D audio API appropriate for use with gaming applications and many
     118    other types of audio applications
     119    More info : http://www.openal.org/
     120}}}
     121
     122{{{
     123  Vorbis       
     124    Audio Driver plays .ogg files which is a free alternative version of MP3s
     125    Ogg Vorbis is a completely open, patent-free, professional audio encoding and streaming
     126    technology with all the benefits of Open Source
     127    More info :  http://www.vorbis.com/
     128}}}
     129
     130{{{
     131  Boost
     132    The Boost web site provides free peer-reviewed portable C++ source libraries. The emphasis is on
     133    libraries which work well with the C++ Standard Library
     134    More info :  http://www.boost.org/
     135}}}
     136
     137{{{
     138  Xerces
     139    XML Reader (eXtensible Markup Language) simple text format  for storing information
     140    Xerces (named after the Xerces Blue butterfly) provides world-class XML parsing and generation.
     141    Fully-validating parsers are available for both Java and C++, implementing the W3C XML and DOM
     142    (Level 1 and 2) standards, as well as the de facto SAX (version 2) standard. The parsers are
     143    highly modular and configurable. Initial support for XML Schema (draft W3C standard) is also
     144    provided.
     145    More info : http://xml.apache.org/
     146}}}
     147
     148{{{
     149  OpenGL
     150    OpenGL is an API for 2D and 3D graphics applications. OpenGL fosters innovation and speeds
     151    application development by incorporating a broad set of rendering, texture mapping, special
     152    effects, and other powerful visualization functions. Developers can leverage the power of OpenGL
     153    across all popular desktop and workstation platforms, ensuring wide application deployment.
     154    More info : http://www.opengl.org/
     155}}}
     156
     157{{{
     158  SDL
     159    Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level
     160    access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
     161    More info : http://www.libsdl.org/
     162}}}
     163
     164''Other Libs''
     165[description minimal because they are mostly self-explanatory]
     166 * libjpg: Jpeg Reader
     167 * libpng: Png Reader (portable nework graphics) graphic format
     168 * Zlib:        Zip archive Reader.
     169 * Dbghelp: Microsoft's debug support functions.
     170 * Misc:        Contains the OGL extensions.
     171 * DirectX: minimal part of SDK needed to compile (used by wsdl)
     172
     173== source ==
     174
     175The source can be broken down into the following sub directories
     176
     177 * Graphics:    ???
     178 * Renderer:    ??? Break this down
     179 * Gui:         Graphic user Interface
     180 * i18n:                Text Localization.
     181 * Lib:         System Specific code, utilities and low-level resource code
     182 * Maths:       Relevant 3d Math functions
     183 * Ps:          The �engine core�
     184 * Scripting:   Scripting Engine
     185 * Simulation:  Game Simulation main work�.
     186 * Sound:       Audio
     187
     188= Tools =
     189These are separate stand alone tools not part of the main code. These are used to build the project files into something useable by the engine, these can be then placed in the binaries\mods directory
     190 * Ape:         Tool for Building particle systems
     191 * Arch Builder:        Builds Archived Project
     192 * Auto Builder:        Build Project
     193 * Font Builder:        Builds Font Texture
     194 * I18n:                Language Importing.
     195 * pmdexp:      Export Meshes to PMD format
     196 * !ScEd:               Scenario Editor
     197 * textureconv: Texture Conversion to DDS format
     198
     199= Main Classes =
     200
     201== CWorld ==
     202- Owns the map and all entities
     203
     204- Sends the visible map terrain and entities to the renderer
     205
     206== CMap ==
     207- Owns the terrain and the tile attributes
     208
     209- Loads the map from a scenario file
     210
     211- Stores the map into a scenario file
     212
     213== CSimulation ==
     214Each frame, CSimulation goes through CWorld and updates the state of all world objects according to the elapsed time. CSimulation will know which clients in an MP game are entitled to which information, so that a "map-hacked" client will see as little as possible and to ensure minimal bandwidth usage
     215
     216== CPlayer ==
     217Represents a player. Either human or computer, local or networked.
     218
     219- Containing player-specific information such as name, score, color etc.
     220
     221- Validating command messages on the server.
     222
     223- Knowing the entities owned by the player
     224
     225== CGame ==
     226The CGame is the representation of the game itself.
     227It is the container that holds the rules, resources and attributes of the game.
     228
     229== CSessionManager ==
     230The central nexus of network message handling. Contains the entry point called from the main thread. CMessageSocket's are registered with a corresponding message handler function which is used to handle the incoming messages. Messages are passed through CSessionManager from the socket code via the relevant message handler to CSimulation where they are queued to be simulated.
     231
     232== Graphics ==
     233
     234=== CRender: ===
     235This is the class that maintains lists of objects to be rendered, and handles all the OGL calls to display them, etc.
     236=== IRenderableObject: ===
     237Base class for renderable objects.
     238==== CTerrain: ====
     239Terrain heightmap and rendering functions.
     240==== CModel: ====
     241Animated model, made out of multiple meshes and joints.
     242==== CMesh: ====
     243Mesh class to hold geometry, normals and textures.
     244==== CParticleSystem: ====
     245A single particle system.
     246==== CSprite: ====
     247Sprites can be any size, and may be composed of multiple textures.
     248=== CParticleManager: ===
     249Manager class for all the particle systems.
     250=== CTexture: ===
     251A texture as represented in OpenGL. Width and height are powers of 2.
     252=== CCamera: ===
     253Simple class to encapsulate camera.
     254=== CImageLoader: ===
     255Loads various formats (PNG, JPG, BMP, TGA, etc).
     256=== CLight: ===
     257Directional lights, just specify a color and direction.
     258=== CMaterial: ===
     259Set material properties for meshes.
     260=== CSelection: ===
     261Get the index of the object which is selected when the user clicks on a point on the screen.
     262=== CFont: ===
     263Holds the description of a font, and used by renderer for outputting text.
     264 
     265= Engine Summary =
     266
     267This is basically the Main function a few twists and turns aside.
     268
     269MICROLOG()
     270logs current activity, which is displayed after a crash.
     271oglCheck()
     272{{{
     273        reports any errors that have occurred in OpenGL since the last call.
     274}}}
     275
     276'''INIT'''
     277
     278I18n::!LoadLanguage(NULL);      //Loads The Relevant Language Pack
     279
     280!InitVfs(argc?argv[0]:NULL);    // Vfs creates a Virtual File System
     281// Protecting the system & allowing access to archived files
     282
     283CConsole()                      //Create Console (also see !InitPs)
     284
     285SDL_Init();                     //See SDL library
     286
     287!InitScripting();       //Init the script engine & init the //induvidual scripts
     288
     289!InitConfig(argc, argv);        //Load Config Files "config/system.cfg"
     290{{{
     291                                //and Parse Commandline Arguments
     292}}}
     293
     294new CGUI;               //Init GUI system
     295
     296!InitPs();              //This seems to be a miscellaneous set up.
     297{{{
     298                        //Setup Console font
     299                        //setup language
     300                        //load hot keys
     301                //Set up Some GUI stuff
     302}}}
     303
     304!InitRenderer();        //Create the following And set up lights
     305?       new CTextureManager;    //Containers for art resources,
     306{{{
     307        new CMaterialManager;   //with caching and on-demand loading
     308        new CmeshManager;               //where appropriate
     309        new CSkeletonAnimManager;
     310        new CObjectManager;
     311        new CUnitManager;
     312        new CbaseEntityCollection;
     313}}}
     314
     315new CPathfindEngine;            //Interface to Path Find Engine
     316new CSelectedEntities;          //Selected Entities
     317new CMouseoverEntities;         //Mouse over Entities
     318new CSessionManager;            //Network Object
     319new CGameAttributes;            //Contains The Players info Names etc.
     320{{{
     321                                //and Number of players
     322}}}
     323
     324
     325//Add Handlers
     326//These allow an object to receive message from the system I.e. Key presses, similar to the way the windows message loop works.
     327in_add_handler(game_view_handler);
     328in_add_handler(interactInputHandler);
     329in_add_handler(conInputHandler);
     330in_add_handler(hotkeyInputHandler);
     331in_add_handler(gui_handler);
     332in_add_handler(handler);
     333
     334
     335g_GUI.!SendEventToAll("load");  //tell all GUI objects to load up
     336!RenderNoCull();        //Forces engine to load up anything that�s needed
     337{{{
     338                        //By drawing everything
     339}}}
     340
     341'''MAIN LOOP "Frame()"'''
     342
     343!MusicPlayer.update();          //Call vorbis Music Library
     344
     345in_get_events();                        //Read Keyboard/Mouse events
     346
     347g_SessionManager.Poll();        //Call Networking Code
     348
     349g_GUI.!TickObjects();           //Call GUI Code
     350
     351
     352g_Game->Update(!TimeSinceLastFrame);
     353// Update all Entities and Perform Game simulation
     354
     355if (!g_FixedFrameTiming)
     356g_Game->!GetView()->Update(float(!TimeSinceLastFrame));
     357{{{
     358                // Update Camera position view
     359}}}
     360
     361//update for Mouse and selected Entities
     362g_Mouseover.update( !TimeSinceLastFrame );     
     363g_Selection.update();
     364
     365
     366snd_update(pos, dir, up) ? g_Game->!GetView()->!GetCamera();    // SOUND
     367{{{
     368        // Pass camera position to Open AL for 3d positional Sound
     369}}}
     370
     371g_Console->Update(!TimeSinceLastFrame); // Call Console Code
     372
     373Render();                       // Render Screen and display (see below)
     374SDL_GL_SwapBuffers();
     375
     376'''RENDER'''
     377
     378g_Renderer.!BeginFrame();
     379{{{
     380        // calculate coefficients for terrain and unit lighting
     381}}}
     382m_ShadowBound.!SetEmpty(); //clear shaddows
     383
     384g_Game->!GetView()->Render();   //Create List of polys to draw.
     385CGameView::!RenderTerrain(m_pWorld->!GetTerrain());
     386CGameView::!RenderModels(m_pWorld->!GetUnitManager());
     387
     388g_Renderer.!FlushFrame();       //DO ACUTAL RENDER
     389�       g_TransparencyRenderer.Sort();
     390!RenderShadowMap();     //Create Shaddow Map
     391{{{
     392        glClear()
     393}}}
     394!RenderPatches();               //Acutally render Patches
     395!RenderModels();                //Acutally render Models
     396
     397!ApplyShadowMap();              //Render Shaddows onto ground
     398g_PlayerRenderer.Render();
     399g_TransparencyRenderer.Render();
     400//Render any Defered Tranparencys
     401
     402//Clear all lists
     403g_TransparencyRenderer.Clear();
     404g_PlayerRenderer.Clear();
     405{{{
     406        CPatchRData::ClearSubmissions();
     407        CModelRData::ClearSubmissions();
     408}}}
     409
     410g_Mouseover.renderSelectionOutlines();
     411g_Selection.renderSelectionOutlines();
     412
     413// overlay mode //Front end stuff.
     414glOrtho(0.f, (float)g_xres, 0.f, (float)g_yres, -1.f, 1000.f);
     415g_GUI.Draw();
     416CFont font("console");
     417font.Bind();
     418g_Console->Render();
     419g_Mouseover.renderOverlays();
     420g_Selection.renderOverlays();
     421cursor_draw(g_CursorName);
     422g_Renderer.!EndFrame();
     423
     424= Useful Features for Testing =
     425
     426== Starting the Game in a Window ==
     427
     428Edit the binaries/config/system.cfg file and modify the "windowed" property to true. You can also modify "xres" and "yres" to change the window size.
     429
     430== Using the Console ==
     431
     432Press the ~ key to toggle the console. This allows you to view various debug output that has been written by scripts using console.write or from C++ using Console->!InsertMessage. It also lets you enter !JavaScript expressions to be evaluated. To do this, start a like with ":" to run an expression, or "?" to run it and print the output. For example, `:new Entity("hele_infantry_spearman_b", new Vector3D(0,0,0))` will create a Hoplite at the left corner of the map, and `?1+1` will write 2. One useful variable is `selection`, the array of currently selected units. For example, type `:selection[0].actions.attack.melee.damage *= 2` to double the selected unit's attack. One useful function is `startPlacing(type)`, which will create a cursor for placing a unit of the given type. You can find most of the available functions in !ScriptGlue.cpp. You are also free to use variables, loops, etc in the console.
     433
     434== Logging and Debugging Functions ==
     435
     436Can someone list the most common ones?
     437
     438'''Tip:''' To log information from a function called very frequently, like a rendering function, while not flooding the console or logs, one trick is to simply put an if(rand()<RAND_MAX/10) before the print statement so that it will only print 10% of the time.