Advertisement

isometric depth (a lá simcity 3000)

Started by August 22, 2000 02:39 PM
6 comments, last by lenne 24 years, 4 months ago
hi all. I have a problem are driving me insane. I have tried to solve it for months. I want to make an online community-game with shockwave. Every member gets an house they can place in a city. The way the city is dispayed is much like it is in simcity 2000/3000. Here is a image of what i am trying to achieve: http://www.maxline.se/lenne/city.gif (12kb) I want to store information about how the houses are placed in a array in a textfile on the server. Every square on the ground is a place in the array The problem is that i can´t figger out how to read the array with information about where the diffrent houses are so that the sprites are placed in the right order (e.g on the right place on the z-axis.) I can do the kind of city that is shown on the image, the problem accures when the houses differ in size (see the next image) An exemple: http://www.maxline.se/lenne/boxes_wrog.gif (6kb) First I tried to read the array from the first index ( array(0) ) to the last, placing the houses on the ground whan I reached the bottom corner of the house. This gave this result: This wasn´t what I wanted, as you can se some of the boxes are placed wrong. And if I tried to draw the house when I reached the upper corner the result was still wrong but in a diffrent way. I have tried many other solutions since then without any luck. I don´t know how to take the size of the house i mind when i read the array. Has anybody got any experiense with this kind of problem? I really need help. thanks, Robert, sweden.
Here is how I do it.

If "Type" was the identifyer for a house then "Data" could be used to point to an array that defines the house. The reason this works is when you scan the cell data for your map and come to a house (or any other structure) it finds the info for that house and draws it.


struct tagCell {
BYTE Type; //grass, road, water...
BYTE Data;
}Cell[16][16];

struct tagHouse {
//whatever is needed to define the house
}*Houses;


BTW: Nice graphic
Advertisement
It looks like you have a problem with your multi-block spaning building representations. It seems your using a single graphic to represent a building which span multiple isometric primitive blocks. The graphic errors are related to how you draw the them, as you can see only the multi-block spanning buildings show any graphic anonmally. You proably sort the buildings based upon their closest leading edge, and scan from back to front blitting them in that order. What you need to do is break down those multi-block spanning buildings into sub-units which can blit independently from each other. So each block of a long building is blited indepedently so you dont overwrite your previous depth sorted blitted buildings like you are doing now. Good Luck.

-ddn
Draw back to front, left to right.
I might be a bit of topic here, but that screenshot looked sweet.

What sort of things are you trying to do with this project? I''m sure people here would be interested in hearing more (I am, at least).

-Toby Goldstone / toby.goldstone@btinternet.com
-Toby Goldstone / toby_goldstone@hotmail.com

Hi, first i want to say that "ddn" has understood my problem completly. He recommends that I split up the houses into small peices, and since I want all kinds of sizes on the structures I would have to make a pice for each square on the ground.

That means I have to split up the houses on the first image into 12 squares, that a lot of squares and that gives my problems with creating, size and manegment of the graphics.

There must be some other solution, I doubt they did like that in SimCity 3000. I have noticed that all the houses in Simcity are square, all their side are equally long. Maby that has got something to do with it. They must also had the same problem i "Ages of empire 2" but I dont know if all the houses have got equally long sides.

To answer Toby Goldstone i would like to say that I this is going to be a major project of mine. If I can solve my problem that is

You will be able to interact with the other citizens and you will be able to go into your house (and others). The inside view will also be isomtric. You will be able to buy diffrent things for your house, kind of like "the Sims".

regards,

Robert
Advertisement
I think this would solve your problem (I haven't tested it, I just think it works ):

Loop through the tiles, top to bottom, left to right, and draw the buildings. However, draw bigger buildings when you encounter their _bottom_ tile, not the top one.

If this doesn't work, try some kind of Z-Buffer.

-Jussi

Edited by - Selkrank on August 24, 2000 3:35:09 AM
You can split the houses up in game. With each house assoicate a the blit coordinates which corespond to an isometric primitive. Using an inital masking blit with a solid transparent color you can clip out the exact isometiric primitive, then blit that to screen with color key. All this can be encapuslated so all you have to do is provide an arbitary bitmap. There is a high overhead in the number of preprocessing blits, so if you can spare it i suggest making all the isometric primitves once and store them away at the start of the game, and use them instead of redoing the overhead blits. Good Luck.

-ddn

This topic is closed to new replies.

Advertisement