Game Development Community

How big of a texture do I need for a huge 2D terrain?

by John Klimek · in Torque Game Builder · 08/28/2007 (5:16 pm) · 10 replies

I've posted this on the TorqueX forums about a week ago but haven't received a response so I'm going to re-post it here since I'm not sure if I'm going to use TGB or TorqueX...

I've been trying to create my Scorched Earth clone for several years now (I'll try to figure out some stuff for a couple of weeks and then quit and then will go back, etc, etc...)

Anyways, here is a link to a previous discussion about creating deformable terrain for a 2D scorched earth clone: http://www.garagegames.com/mg/forums/result.thread.php?qt=56363

I think I understand everything about quad trees and the ideas from that thread but I have one problem:

How do I create my initial terrain bitmap?

If you've have ever played Worms (or Gunbound) then you know what I'm referring to. The terrain itself is a bunch of hills filled with a texture and then objects are placed on top of the texture, but those objects actually become a part of the texture (eg. you can destroy them).

Here is an example of what I'm talking about: http://content.answers.com/main/content/wp/en/7/72/Worms_xbox_live_hd.jpg

Do you see how the terrain is brown but has a surfboard (which is partially destroyed)? That's the effect I'm trying to achieve.

Now, I think I understand everything except the size of my main bitmap/texture that represents the entire landscape.

What I was planning on doing is creating a MASSIVE texture like 10000x5000 pixels and storing the entire terrain in there but this is obviously too big for even modern video cards. The reason I was thinking about 10000x5000 is because I want the terrain to look good even in 1920x1200 resolution (and I want the terrain to span about 3 screens wide and maybe 3 screens high).

Any help is greatly appriciated :)

#1
08/28/2007 (9:50 pm)
Remember that something that large will take up a HUGE amount of space. I recommend haveing a tile layer with a regular repeatable texture surface (if you see that worm's shot, the ground is a repeated texture with added detail) and then add another tile layer on top of it with your more detailed items.

As a rule of thumb, the larger the textures, the more memory is used up, so the computer needs to be more and more beefy. I personally wouldn't consider putting anything larger than 256x256 on the screen. Also, video cards will resize an image to a power of 2 (they dont physically resize them, but say a 100x100 image is loaded, its stored as 128x128) so you should also have them at powers of 2.

There are quite a number of threads discussing how large textures need to be.

My advice is stay as small as you can, repeat as much as you can and add detail to another layer.
#2
08/28/2007 (10:39 pm)
Thanks for the reply!

The problem with using tiles is that I want to create the terrain dynamically like this:

1) Create huge texture (5000x3000)
2) Create mountains using a repeatable texture.
3) Add grass (eg. texture) on top of mountains
4) Add tunnels (eg. another texture) inside of mountains
5) Place objects on top of terrain that will become part of the terrain

Because I'm creating the terrain with lots of different textures, I think it would be very difficult to use a tile layout.

I've also searched for "large texture" and can't seem to find any discussions about how large textures need to be. If you have any links handy can you send them my way?

Thanks again for your help!
#3
08/28/2007 (10:50 pm)
If you're creating the terrain dynamically, wouldn't it be better to use tiles anyway?

Maybe I should check out scorched earth for a better idea of what you're talking about.
#4
08/29/2007 (12:30 am)
Don't forget that the terrain is destructible...

Also, check out Worms or Gunbound. There are more of the type of game I'm trying to create...
#5
08/29/2007 (1:53 am)
So, have you figured out how to create destructible surfaces?

+ even after looking at those games, I think tiles are the way to go.
#6
08/29/2007 (2:02 am)
Well, I was going to use the alpha channel for deforming the terrain... (eg. when a bomb hit the terrain it would draw a circle with 0% alpha thereby hiding that section of the terrain)

I would also need to do per-pixel collision detection for this to work.

Can you explain the tile idea a little more? Maybe I'm not understanding :(
#7
08/29/2007 (6:17 am)
I think (think think think) worms uses something like voxels? I've played worms 2d & 3d & I'm pretty sure that's what they do.

but that's en engine that's completly different that what you've got here: it subtracts things instead of adds things. I don't believe they had large textures either, but many smaller ones.
#8
08/29/2007 (10:14 am)
"(eg. when a bomb hit the terrain it would draw a circle with 0% alpha thereby hiding that section of the terrain)"

Are you sure that will work? From what you have there, it doesn't make sense to me.
#9
08/29/2007 (11:54 am)
Quote:I think (think think think) worms uses something like voxels? I've played worms 2d & 3d & I'm pretty sure that's what they do.
According to Wikipedia, the 3D versions of Worms used voxels and/or a voxel+polygon solution, but the 2D versions (like mine) used bitmaps.

Quote:Are you sure that will work? From what you have there, it doesn't make sense to me.
Well, if I use the alpha channel of the main texture as a collision mask what wouldn't work? (sorry, I'm new at graphics programming...)
#10
09/01/2007 (4:24 pm)
You need to be able to change the alpha mask of a tile layer. I don't think TGB can do that. Maybe if you had the pro version you could do it in C++ but I don't think you can do it in torquescript alone.