It is currently Sun Dec 16, 2018 12:36 am

All times are UTC + 9:30 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: An (un)modest request for terrain graphics
PostPosted: Mon Feb 18, 2008 11:28 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
I mentioned this to Kosh earlier, and he thought it would probably be best for me to bring this up in the graphics department.

This concern is only for normal non-Property terrain btw, I don't think the property sprite sheets have gotten long enough or varied enough for them to be this problematic.

The issue with terrain right now is that their indexes aren't of much use for drawing. Most terrain can utilize one style for display, or could utilize eleven styles for display depending on adjacent terrain, and the terrain graphics are all organized on one single line. So rather than using the terrain indexes for drawing, the code ends up having to use nearly arbitrary coordinates to determine where to find the correct terrain graphics from the sprite sheet (see the 'adding terrain' guide I made in programming for more information). Right now this is problematic because it makes drawing terrain more difficult than it has to be imo.

So the idea I mentioned to Kosh is to break up each different type of terrain into their own rows, with styles being organized in lines for each terrain.

Right now the terrain sprite sheet is like this:

PWMR1R2R3R4R5F6...

And I want to know if anyone's willing to organize the sprite sheet like this:

P
W
M
R1R2R3R4R5...
B1B2
SB1SB2
...

And so on.

I realize that this ends up wasting a lot of space on the sprite sheet, but it will make the terrain drawing code considerably more efficient. Right now it's almost something like this:
Code:
if(it is this terrain type)
{
    g.drawImage(spritesheet, style * 16 + some number, 32)
}
else if(it is this other terrain type)
{
    g.drawImage(spritesheet, style * 16 + some other number, 32)
}
else if(it is this other other terrain type)
{
    g.drawImage(spritesheet, style * 16 + some other other number, 32)
}
...


With the space wasting sprite sheet that organizes each terrain and their styles by row and column, I can (theoretically) take all that code and reduce it to this one line:
Code:
g.drawImage(spritesheet, style * 16, terrain index * 32)


Of course this is not an easy task; based on my own count there are approximately 25 different types of terrain (I'm adding in Sea Pipes, Sea Pipe Seams and Destroyed Sea Pipe Seams into this count). So I won't demand for this task to be done, but this matter is fairly important to me.

For those who want to see the terrain type indexes I've working with:
Code:
package cwsource;

public final class TerrType
{

   //MAX TERRAIN COUNT
   public static final int MAX_TERRAIN_TYPES = 26;
   
   //BASIC TERRAIN
   public static final int PLAINS = 0;
   public static final int WOOD = 1;
   public static final int MOUNTAIN = 2;
   public static final int ROAD = 3;
   public static final int BRIDGE = 4;
   public static final int RIVER = 5;
   public static final int SEA = 6;
   public static final int REEF = 7;
   public static final int SHOAL = 8;

   //PROPERTIES
   public static final int HQ = 9;
   public static final int CITY = 10;
   public static final int BASE = 11;
   public static final int AIRPORT = 12;
   public static final int PORT = 13;
   public static final int COM_TOWER = 14;
   public static final int PIPE_STATION = 17;
   
   //EVERYTHING ELSE
   public static final int PIPE = 15;
   public static final int SILO = 16;
   public static final int PIPE_SEAM = 18;
   public static final int DEST_SEAM = 19;   
   public static final int SUS_BRIDGE = 20;
   public static final int WALL = 21;
   public static final int DEST_WALL = 22;
   
   public static final int SEA_PIPE = 23;
   public static final int SP_SEAM = 24;
   public static final int DEST_SPS = 25;   
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 1:04 pm 
Offline
User avatar

Joined: Thu Sep 21, 2006 6:48 am
Posts: 3681
Location: Location, Location
Actually, you're assuming the style terrain numbers aren't arbitrary as well.

Maybe they aren't. I need to check.

But if they are not, I think that
Code:
_____
  |
|-+-|
__|__
+ standalone tile covers all of the eventualities.

_________________
"I got this [dragon tattoo] while a teenager. I met the greatest girl in the world and now I'm married. Problem is, she's afraid of dragons. I've started getting it removed. Will take years."


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 2:42 pm 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
Not quite. I don't mean arbitrary as in the numbers are completely wacky and have no possible pattern, but the way one searches for terrain graphics across the terrain.gif sprite sheet is not uniform.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 8:49 pm 
Offline
User avatar

Joined: Tue Oct 03, 2006 6:00 am
Posts: 320
Location: Scotland
like this?

Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 12:47 am 
Offline
User avatar

Joined: Sun Apr 01, 2007 3:14 am
Posts: 2228
Location: DE
I can have this done easy by tonight. IDrawv3 ftw.

EDIT: Changed my mind and did it already. It's missing some tiles like sea pipes but I can't find them in the graphics folder and don't care enough to download them so someone more interested in having them can put them in.

Image

Hmmm. I don't remember why there are two mines and don't know why half the properties are AWDS and the other half are funny looking but I'll worry about that later because I need to go eat right now.

_________________
urusan wrote:
Do what Fugue said


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 2:38 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
Yeah that's what I'm talking about, thanks guys :3

Fugue's in particular is interesting since it's nearly managed to fit every type of terrain on one sheet rather than just the non-property non-HQ ones (but thanks anyway Johnston). I have the images for Sea Pipes on my end, I'll append them to Fugue's picture later and maybe rearrange them to be exactly in the order of the terrain indexes :3


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 4:10 am 
Offline
User avatar

Joined: Thu Jun 22, 2006 11:25 pm
Posts: 3903
Location: United Kingdom
Hmm, it seems the old sprites for a lot of things are still being used. I'll fix them up to better versions, most notably the neutral props.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 19, 2008 4:57 am 
Offline
User avatar

Joined: Sun Apr 01, 2007 3:14 am
Posts: 2228
Location: DE
I literally just used all the sprites in the current CW download.

_________________
urusan wrote:
Do what Fugue said


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 9:30 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Blue Moon by Trent © 2007
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group