From: Jean-Philippe <jpm...@fr...> - 2011-08-04 12:49:36
|
Welcome, Rod. > I am currently exploring using Speed Dreams as the basis of a > simulator, and as part of this need to be able to get current location > information from the game instance and send it to an external device > e.g. a tablet PC. As I am new to Speed Dreams I am currently messing > around with the code, almost blindly but would appreciate information > on where I could find the relevant part of the source code or > variables? If anyone knows where I should look please let me know. Not sure about what you mean by "location" ... If it is the position (coordinates) of a car on the track, you can explore the C structures in src/interfaces/raceman.h and src/interfaces/car.h First, you should start from the RmInfo structure : the race engine (in src/raceengine) owns 1 only instance of it : 'ReInfo', and this instance (or its sub-objects) is used to communicate with the modules of the game (like the physics or graphics engines). The data describing each racing car (position and many other things) can be found by digging in the 's' field of ReInfo (tSituation type). We currently use src/modules/simu/simu v2.1 as our official physics engine (the car physics is currently being setup for this simu version). The graphics engine is in src/modules/graphic/ssggraph. To be short about how the game mainly works in-race (see src/raceengine/raceupdate.cpp) : * the race engine loops as long as the race is not finished or the user does not stop it ; * in each loop, the race engine sequentially calls (more or less directly) : - R times the rbDrive function of each racing 'driver', which is an instance of a 'robot' (see src/drivers/usr* , simplix* and kilo*, and human for the human player with the wheel/joystick/keyboard in hands) - S times the update function of the physics engine - once the update function of the graphics engine (giving 1 frame) * R and S mainly depend on the current CPU load, in order to let the user feel like it is real-time ; of course, this can become false when the CPU is overwhelmed by too rich graphics or too many drivers. Feel free for asking more details. Cheers, Jean-Philippe. |