by date
Space Sim in the Torque Game Engine - Introduction
Space Sim in the Torque Game Engine - Introduction
| Name: | Rob Evans | ![]() |
|---|---|---|
| Date Posted: | Jul 04, 2007 | |
| Rating: | 4.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Rob Evans |
Blog post
This post is based upon the latest TGE at time of writing which is version 1.5.2.
After reading MANY posts, blog entries and resources on the subjects related to getting Torque Game Engine into a state ready to make a space sim, I've realised that it takes a lot of reading and effort to properly set up the engine specifically for this purpose. Moreover, many of the resources available are based upon older versions of the TGE and require a high level of perseverance in order to succeed in any changes. If you are like me and want to take the path of least resistance as often as possible, it will seem like quite a daunting task to alter the TGE this way.
With that in mind, I am writing this comprehensive guide to making a space sim using TGE 1.5.2. Hopefully it will help someone else out there to avoid all the mistakes I had to make to get where I am now!
All of the changes I make will be available via a download (possibly for a small fee) should anyone want to take the easy way out and just overwrite an install of TGE 1.5.2 with my changed files. To start with, I'm going to discuss the issues involved in making a space sim in detail and go through some of the things I learned along the way!
The main issues / ideas / tasks involved are (in no particular order):
1: Removing terrain.
2: Removing gravity.
3: Creating a star-based skybox.
4: Removing (or rather altering) the fog.
5: Creating points of reference such as floating debris, space-dust etc so that when you are flying around in your spaceship, you feel like you are actually moving!
6: Creating planets that you can fly down to from space and fly up from back into space.
7: Creating space-stations that you can dock with, and also trade at, pick up missions etc.
8: Create "sectors" of space that are "fly-anywhere" but split the universe up into larger "quadrants" that can only be accessed via jump-gates. This allows you to define a finite area of space so that you don't have to load the whole universe into memory.
9: Create an infinite universe algorithm so that objects and planets etc are generated via a mathematical function rather than by defined data, thus allowing the player to explore endlessly (unless defined data exists, then use that instead).
10: Multiplayer!!!!
11: And last, but by no means least, allow multiple servers to connect together, creating "super-jump-gates" that allow the player to jump to completely different space (which is actually a different server so that space is totally varied and players can host their own part of the universe!). This works by server admins swapping XML files containing data for where the super-jump-gates are located and the IP or DNS of the server the client will connect to upon jumping.
This is a work in progress that I will be updating regularly with each part, starting from scratch, all the way to a playable game. This is a rather large undertaking and my free time like many others, is quite limited.
Watch this blog for updates!
Update 9th July 2007 - Part 1 of the Guide - Setting up TGE and using SkySpheres
Update 10th July 2007 - Part 2 of the Guide - Setting up the Gravity Mod
After reading MANY posts, blog entries and resources on the subjects related to getting Torque Game Engine into a state ready to make a space sim, I've realised that it takes a lot of reading and effort to properly set up the engine specifically for this purpose. Moreover, many of the resources available are based upon older versions of the TGE and require a high level of perseverance in order to succeed in any changes. If you are like me and want to take the path of least resistance as often as possible, it will seem like quite a daunting task to alter the TGE this way.
With that in mind, I am writing this comprehensive guide to making a space sim using TGE 1.5.2. Hopefully it will help someone else out there to avoid all the mistakes I had to make to get where I am now!
All of the changes I make will be available via a download (possibly for a small fee) should anyone want to take the easy way out and just overwrite an install of TGE 1.5.2 with my changed files. To start with, I'm going to discuss the issues involved in making a space sim in detail and go through some of the things I learned along the way!
The main issues / ideas / tasks involved are (in no particular order):
1: Removing terrain.
2: Removing gravity.
3: Creating a star-based skybox.
4: Removing (or rather altering) the fog.
5: Creating points of reference such as floating debris, space-dust etc so that when you are flying around in your spaceship, you feel like you are actually moving!
6: Creating planets that you can fly down to from space and fly up from back into space.
7: Creating space-stations that you can dock with, and also trade at, pick up missions etc.
8: Create "sectors" of space that are "fly-anywhere" but split the universe up into larger "quadrants" that can only be accessed via jump-gates. This allows you to define a finite area of space so that you don't have to load the whole universe into memory.
9: Create an infinite universe algorithm so that objects and planets etc are generated via a mathematical function rather than by defined data, thus allowing the player to explore endlessly (unless defined data exists, then use that instead).
10: Multiplayer!!!!
11: And last, but by no means least, allow multiple servers to connect together, creating "super-jump-gates" that allow the player to jump to completely different space (which is actually a different server so that space is totally varied and players can host their own part of the universe!). This works by server admins swapping XML files containing data for where the super-jump-gates are located and the IP or DNS of the server the client will connect to upon jumping.
This is a work in progress that I will be updating regularly with each part, starting from scratch, all the way to a playable game. This is a rather large undertaking and my free time like many others, is quite limited.
Watch this blog for updates!
Update 9th July 2007 - Part 1 of the Guide - Setting up TGE and using SkySpheres
Update 10th July 2007 - Part 2 of the Guide - Setting up the Gravity Mod
Recent Blog Posts
| List: | 07/10/07 - Space Sim in the Torque Game Engine - Setting up the Gravity Mod 07/09/07 - Space Sim in the Torque Game Engine - Setting up TGE and Using Sky Spheres 07/04/07 - Space Sim in the Torque Game Engine - Introduction 07/02/07 - Creating Portals (doorways etc) in Constructor |
|---|
Submit your own resources!| Richard_H (Jul 04, 2007 at 16:39 GMT) |
| Ian Omroth Hardingham (Jul 04, 2007 at 16:51 GMT) |
| Josh Caba (Jul 04, 2007 at 17:16 GMT) |
| Johnny Hill (Jul 04, 2007 at 18:51 GMT) |
Its a very good read tech wise on how he did it :)
Klingons
This is something I threw together in Constructor, Curves and smooth lines eats a lot of brush budget so personally I build more Anime style battlecrusiers that are more angular and doesnt choke constructor as much but I thought this one would be more approriate to what type of Space Sim system David was building. The ship is just a enclosed interior and the simulation pretty much plays out around this.

Number 6. isnt really that hard it depends on how bad you want to simulate a actual planetfall, I much prefer old roddenbery methods if you approach a planet you go into a standard orbit and just teleport down. plus you can beam down anything you need even personal vehicles if you have then in your ship inventory.
I got more stuff but work is keeping me so so busy its kinda sad to me I would much prefer to do this all the time instead of knocking out tile patterns LOL. but my bills were coming a lot faster then my dreams heh.
Edited on Jul 04, 2007 19:00 GMT
| Rob Evans (Jul 04, 2007 at 19:19 GMT) |
@Johnny - Thanks for that link... hadn't seen that before and should come in VERY handy! In terms of the transition to planets, doing it roddenbery style is actually a pretty good idea - I'll probably fall back to this if I can't get a satisfactory result in my planned way.
And dude, I know what you mean about the bills! I wish I could spend all day on my projects... we'd all benefit from a much more creative society if none of us had to work... but hey, maybe I can get my employer to sponsor my project! LOL.
| James Laker (BurNinG) (Jul 05, 2007 at 08:16 GMT) |
There are different ways, depending on what you want exactly.
The first will be using a little video clip that plays when you enter a trigger around the Planet.
Dont forget to think about what the other players see... Do you just dissapear, fade away, have cool effect?
In my own game (Solar Battles) the gameplay excludes it, but the spawning effect uses the explosion code with a DTS. It works very good.
Another effect you can use is by changing FOV (Also done with a trigger before loading the Planet, Base or whatever you plan on using the planet for.
In Freelancer you needed to use Landing Gates. This worked very well in my opninion. So when you get too close to planet you will die (after being warned that the gravity is getting hold of you or something like that).
No. 1 - 3 can be done in less than 5min.
| Rob Evans (Jul 05, 2007 at 08:35 GMT) |
| James Laker (BurNinG) (Jul 05, 2007 at 08:47 GMT) |
| Rob Evans (Jul 05, 2007 at 08:49 GMT) |
| Rob Evans (Jul 05, 2007 at 08:52 GMT) |


Edited on Jul 05, 2007 10:40 GMT
| Rob Evans (Jul 05, 2007 at 13:29 GMT) |



Edited on Jul 05, 2007 13:30 GMT
| Rob Evans (Jul 05, 2007 at 13:30 GMT) |
Edited on Jul 05, 2007 13:31 GMT
| Andy Hawkins (Jul 05, 2007 at 14:52 GMT) |
I'll be watching the progress of this mod. I need this sort of thing for my game.
Regarding the screenshots - if you feel they are noobish, don't worry. There are so few good space sims, that people can forgive the graphics, as long as the game play is there.
| Rob Evans (Jul 05, 2007 at 15:35 GMT) |
| James Laker (BurNinG) (Jul 05, 2007 at 15:38 GMT) |
When do you start showing it?
Where is your Ship position going to be in the world when you warp? Have you tested big maps? I know there's no terrain, but have you actually tried flying 4 hours in a direction? I remember having some problems with that and TGE (the main reason for me moving to TGEA)
I like your stations btw...
| Rob Evans (Jul 05, 2007 at 15:44 GMT) |
Yeah it would definitely have to be client-side. The warp tunnels in the trade lanes basically appear when a player flies into a ring from either direction.
Here is an image of freelancer with a ship going through a trade lane. You fly into a ring, then the computer takes over flight and speeds you to the other end.

I haven't tested big maps yet, however, what are the general issues? Why is TGEA better for this?
Edited on Jul 05, 2007 15:45 GMT
| James Laker (BurNinG) (Jul 05, 2007 at 16:12 GMT) |
The problem with a Spacegames, Torque and one big world would be the loading for one, since all the datablocks needs to be loaded before the game. I would suggest having only part of the worlds, and swtiching maps from going from system to system...
Im not sure what the actual problem is when using stock Torque. Just test it and you'll see jittering. This is because of precision problems and (guessing here) interpolation.. I know had problems when moving too far away but that problem went away when I used TGEA.
There are limitations when using (stock) Torque for Spacegames you'll only find as you go along. It's not as easy as changing a skybox, changing gravity, and adding flying vehicles. But these problems you'll find is in other Space games too sometimes. But dont let that stop you, I strongly believe that the Space Game Genre should and can be taken over by indies ;)
| Rob Evans (Jul 05, 2007 at 16:15 GMT) |

If I try to make anything that big in Torque Constructor it fails. Should I be making planets with dts files?
| James Laker (BurNinG) (Jul 05, 2007 at 16:37 GMT) |
Word of advice... Scale down EVERY before you start. That will make ALOT of headaches go away.
| Rob Evans (Jul 05, 2007 at 16:39 GMT) |
| James Laker (BurNinG) (Jul 05, 2007 at 16:46 GMT) |
If you're interested, there's a vacancy for a person that knows Constructor ;-)
| Rob Evans (Jul 05, 2007 at 16:57 GMT) |
I wouldn't say I "know" constructor! But I'm happy to give you anything you think might help. I've literally only just made those space stations but they're not even properly textured.
Have you seen this game:
fl-tw.com/Infinity/infinity_combat_proto.php
It's damn amazing what he's put together. Apparently, there's only one developer although he has help on the art side! Still... graphically it's beyond anything I've seen before, even beats eve!
| James Laker (BurNinG) (Jul 05, 2007 at 17:17 GMT) |
Seen Infinity too... Very nice!
| Donald \"Yadot\" Harris (Jul 05, 2007 at 21:11 GMT) |
I need more developers...
| Johnny Hill (Jul 05, 2007 at 22:08 GMT) |
Here is more good info, plus Mike released a nice bit of code for creating a sky sphere. and in one of his post he mention how he refined it to make a renderable sphere for planets.
Kuiper
EDIT: NVM heh I seen your post at the end
Edited on Jul 05, 2007 22:11 GMT
| Andy Hawkins (Jul 05, 2007 at 22:50 GMT) |
To deal with 10,000 unit limits you could scale everything down and then break space into sectors. This would be ideal for scanners anyway. You would need to place items all around in sectors further than 10,000 so you could see them, then as you approach a boundary, displace everything by 10,000 minus your distance from the boundary. Keep track of the displacement and divide by 10,000 would yield the sector you are currently in, giving you a frame of reference for all objects in space, and your position relative to them all.
When looking at how Freelancer does it, there is a noticeable jerk when you jump into a new sector which would seem to be when everything gets instanced.
Here some more space game links on GG pages...
www.garagegames.com/mg/forums/result.thread.php?qt=21656
www.garagegames.com/mg/forums/result.thread.php?qt=27366
www.garagegames.com/mg/forums/result.thread.php?qt=25020
www.garagegames.com/mg/forums/result.thread.php?qt=33660
www.garagegames.com/mg/forums/result.thread.php?qt=62522
| James Laker (BurNinG) (Jul 06, 2007 at 08:00 GMT) |
| Rob Evans (Jul 06, 2007 at 10:08 GMT) |
| Stephan (viKKing) Bondier (Jul 06, 2007 at 11:50 GMT) |
I would have prepared the stars/systems/debris generation in the beginning to avoid missing something at a later stage though.
I would like to recommend two free space games for inspiration purpose:
Beyond the Red Line, based upon the new Battlestar Galactica TV show and this Wing Commander sequel, I don't think I have to present it, do I? ;)
Edited on Jul 06, 2007 11:50 GMT
| David \"Fulcrum\" Wyand (Jul 06, 2007 at 22:06 GMT) |
I'm impressed that someone still remembers my ancient .plan. Hopefully some day soon I'll be able to provide an update to it. I'm still working on my idea, although at a snails pace it seems. I've also switched over to Python for the backend server. :o)
The issues with travelling great distances in any game engine usually have to do with floating point instability. The further you move from the origin the greater the error. There's a good description and possible solution in Game Programming Gems 4 chapter 2.3: Solving Accuracy Problems in Large World Coordinates.
It essentially comes down to keeping track of a sector and a point within the sector for every object. The trick of renormalizing the coordinate system can work on the client, but you still need to track everything within a unified coordinate system on the server (assuming a multiplayer game).
- LightWave Dave
| Rob Evans (Jul 09, 2007 at 16:29 GMT) |
You must be a member and be logged in to either append comments or rate this resource.



4.0 out of 5


