Game Development Community

dev|Pro Game Development Curriculum

Space Sim in the Torque Game Engine - Introduction

by Rob Evans · 07/04/2007 (8:51 am) · 31 comments

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
Page«First 1 2 Next»
#21
07/05/2007 (9:46 am)
There are VERY early alpha screenshots here. Mainly been working the "insides" which doesn't really produce pretty screenshots... But I'm about 95% feature complete. So the screenshots looks weak and does not represent the final product at all.

If you're interested, there's a vacancy for a person that knows Constructor ;-)
#22
07/05/2007 (9:57 am)
Your game looks excellent! Makes me think I shouldn't bother trying to make mine! LOL.

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!
#23
07/05/2007 (10:17 am)
There's always room for Space Games! The genre has been neglected... At the moment there's only X3 that is any good... And they put the bar right up there.

Seen Infinity too... Very nice!
#24
07/05/2007 (2:11 pm)
This is way to neat. I look forward to seeing a completed mod on this. If you do charge a fee I would be willing to pay as I need something like this for my larger project.


I need more developers...
#25
07/05/2007 (3:08 pm)
Hey Rob,

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
#26
07/05/2007 (3:50 pm)
Here's how I suggested doing sectors in space...

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
#27
07/06/2007 (1:00 am)
Im really glad the responses about Space Games are this good. Just confirms that there's room for something great.
#28
07/06/2007 (3:08 am)
Indeed, thank you everyone for your enthusiastic responses
#29
07/06/2007 (4:50 am)
I can only encourage you Rod (edited - damn'it :/).
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? ;)
#30
07/06/2007 (3:06 pm)
Greetings!

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
#31
07/09/2007 (9:29 am)
Hmm... I like the displacement idea. Easy to implement I think.
Page«First 1 2 Next»