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 «Previous 1 2
#1
07/04/2007 (9:39 am)
I can't wait to see how this ends up. It could be very interesting, good luck.
#2
07/04/2007 (9:51 am)
Rob, most of the above is actually pretty straightforward in TGE. However, 6 is going to cause a lot of problems. I'd possibly consider alternative solutions to getting this.
#3
07/04/2007 (10:16 am)
Sounds great.
#4
07/04/2007 (11:51 am)
Rob In your research did you ever come across David "Lightwave Dave" aka "Fulcrum" Wyand article about using TNL to bridge multiple instances of TGE/TGEA together to create a space simulation that functions ala Star Trek.

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.

i16.photobucket.com/albums/b42/Programmerj/Starship.jpg
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.
#5
07/04/2007 (12:19 pm)
@Ian - The way I'm planning on doing it is to allow the player to fly to a certain point (where the planet is still just a large sphere) then switch to a loading cut-scene and then load a mission file with terrain and buildings to land on etc. Do you think that is viable? Any suggestions to make it "cooler"? :o)

@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.
#6
07/05/2007 (1:16 am)
I have been working on a Space game for the last 8 months with TGEA. Everything is pretty easy to do. I have also wondered how to achieve the landing on planets.

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.
#7
07/05/2007 (1:35 am)
@James - Yeah, I've always liked the freelancer approach, however I keep getting nostalgic about my Elite: First Encounters days when flying down to a planet was made to look easy and although the planet had nothing on it except some randomly generated terrain, for it's time it was awesome!
#8
07/05/2007 (1:47 am)
The problem is that people would expect this highly detailed planet when they get closer... That just uses too much video ram. I guess you can use a blur effect as you get closer (and change the FOV).
#9
07/05/2007 (1:49 am)
Indeed... I think the freelancer approach is best. It also adds a bit of extra tension if you are in trouble and need to land fast, you've got to get to a docking ring first!
#10
07/05/2007 (1:52 am)
Marvel at my pathetic attempt at space stations! Noobs of the art world unite! LOL

v2.wastedwebspace.co.uk/gamedev/shot1.png
v2.wastedwebspace.co.uk/gamedev/shot2.png
#11
07/05/2007 (6:29 am)
Some trade lanes ala Freelancer:

v2.wastedwebspace.co.uk/gamedev/shot3.png
v2.wastedwebspace.co.uk/gamedev/shot4.png
v2.wastedwebspace.co.uk/gamedev/shot5.png
#12
07/05/2007 (6:30 am)
Does anyone have any ideas how best to create a sort of wormhole effect when travelling through the trade lanes? If you've ever played freelancer you'll know what I mean! Sort of a tube around the inside of the lane rings that has a speedy feel to the travel.
#13
07/05/2007 (7:52 am)
For the warp effect use a tube and animate the texture coordinates.

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.
#14
07/05/2007 (8:35 am)
Awesome idea... how do I animate the texture co-ords? LOL. Don't worry, I'll take a look around the forums for it... I'm not lazy... honest :o)
#15
07/05/2007 (8:38 am)
It's a little harder than just making a tube and using an animated texture... Esp in a server-client based game. You dont want the others to see it so it neds to be client side.
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...
#16
07/05/2007 (8:44 am)
Hey James...

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.

v2.wastedwebspace.co.uk/gamedev/freelancer1.png
I haven't tested big maps yet, however, what are the general issues? Why is TGEA better for this?
#17
07/05/2007 (9:12 am)
I still have Freelancer installed on my PC.. And have been looking at alot of space games lately.

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 ;)
#18
07/05/2007 (9:15 am)
:) It's not going to be easy... that I know for sure. The other issue I want to address is having large planets like this:

v2.wastedwebspace.co.uk/gamedev/freelancer2.png
If I try to make anything that big in Torque Constructor it fails. Should I be making planets with dts files?
#19
07/05/2007 (9:37 am)
Yep... dts is the way to go... But again, there's problems with that too because of its size.
Word of advice... Scale down EVERY before you start. That will make ALOT of headaches go away.
#20
07/05/2007 (9:39 am)
James, where are you at with your game? Are there any screenshots available? Thanks for the scale tip!
Page «Previous 1 2