Jump to content

  • Log In with Google      Sign In   
  • Create Account

Diagonal Movement Problem - Please Help


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 23 September 1999 - 05:09 AM

Hi,

this is my tile ploting code:

int MapX, MapY, i, j;
int X_Overlap, Y_Overlap;

MapX = x;
MapY = y;
X_Overlap = 22;
Y_Overlap = 22;

for(i=0; i<22; i++)
{
for(j=0; j<11; j++)
{
masked_blit(data[MAP[0][MAPx+j][MAPy+i].tileimage].dat, display, 0, 0, 2*X_Overlap*j+(X_Overlap)*(i & 1), +Y_Overlap*i, TILESIZE, TILESIZE);
MapX++;
}
MapX=x;
MapY++;
}

the problem is that when i move the map in diagonals (NE, NW, SE, SW), the tiles do not redraw in the right places when on odd rows, if i move diagonal again to an even row, they sort themselves out.

N, W, S, E all work ok.

please help


Sponsor:

#2 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 September 1999 - 11:05 PM

From your code, I assume you are using isometric tiles? While ease to visualize, it is simply inefficient.

I personally started out with isometric tiles (and isometric blitting) for my engine, but ultimately decided to blit square tiles from a square map and then simply transform isometric coordinates to the 2D square map, when reading map data for collision detection etc....

/NJ

/NJ


#3 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 20 September 1999 - 07:34 AM

Niels, are you saying that the isometric look of your game is done through the artwork, and that the tiles you blit are square with no transparent clipping to make up for the 'diamond' isometric tiles? Can you give me a sample of some of your artwork, or a URL where I could see one or two of your tiles?

#4 Dino   Members   -  Reputation: 172

Like
Likes
Like

Posted 20 September 1999 - 08:57 AM

Square tile maps that look isometric aren't new. Starcraft does just that. All of it's graphics are squares that are drawn so that they look isometric.

------------------
Dino M. Gambone
http://www.xyphus.com/users/dino

Good judgement is gained through experience. Experience, however, is gained through bad judgement.




#5 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 September 1999 - 02:39 AM

Sphet: Yes, that is exactly what I am saying... I'll post some screenshots on "some" site sometime soon. Right now the game is on hold due to lack of motivation (The multiplayer part is 90+% done, though, so I might do a multiplayer-only sharware release, who knows !!)...

/NJ


#6 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 September 1999 - 11:46 AM

The screenshots are now at
http://home.worldonline.dk/~noshit

If you've got a slow connection, try:
http://home.worldonline.dk/~noshit/scrshots.html

(The first page takes ages to load, sorry)

/NJ


#7 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 21 September 1999 - 03:15 PM

Hey, could ya send me the code for that too, looks good by the way!

benjones@hotmail.com


#8 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 21 September 1999 - 03:19 PM

Niels
Could ya send me the code and explain how do ya do it?

benjones@hotmail.com


#9 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 21 September 1999 - 04:40 PM

Yo, Niels. I saw your game and it looks amazing. I made an isometric engine and then changed to a rectangle tile engine since there easier to work with for an Real-time strategy game.

I noticed that in the screenshot the minimap and map is a diamond shape, and you said that use used a normal rectangle engine and just blted rectangle tiles with isometric drawing. How did you make the diamond map?

Also, if you used an normal rectangle tile engine wouldn't you be wasting alot of array space.
eg.
this is the array of the map -
1 = used tiles
0 = black(not used tiles)
{ 0 0 0 0 1 1 0 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 1 1 1 1 1 1 0 0
0 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 0
0 0 1 1 1 1 1 1 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
}

This is if you used a "NORMAL" rectangle tile engine.
Did you blt the tiles in a special way?
Could you please tell me, if you did blt the tiles in a special way how???

Thanks alot,


email - datisme@notme.com
Da_KiD


#10 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 September 1999 - 09:47 PM

DAPsycho:

Eh, how I do what exactly? The tile rendering makes little sense out of context, and no, I'm not going to distribute the full source, sorry... If what you are asking for is the actual mapping formulas, I'll try to post them tonight...

Da_Kid:

Yes, there's a certain waste of space, but all things considered, we are talking <1K here....

The only 2 special things about the tiling are these:

1) Odd rows are offset by half a tile to compensate for the differences in isometric/square mapping. (If I remember, I'll post a drawing of this on the site tonight).
2) There's an isometric "collision map" behind the square tile map.

/NJ

(What is it with you guys and the "Da"-word anyway? =) )...



#11 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 22 September 1999 - 06:37 AM

Niels,

The screen shots look good. What is the screen resolution, bitdepth and average tile size you use? Also, the artwork looks nice - is it done in a 3d program, and if so, what sort of camera settings / angle are you using the maintain the isometrics. The 1-bit alpha-channel as collision detection works really well. Your scheme must be similiar to StarCraft, where you can't build things too close to overhangs since the ground tiles are all blitted with no transperency. Good job.


#12 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 September 1999 - 07:59 AM

Thank you very much!

It's running 640x480 16-bit (the pic's are jpeg'ed so the colors are a bit screwed up here and there).

Tiles are 42x24 pixels (Rendered, and then cut out using image composer (ANo1 )...

I'm not sure what you mean by "The 1-bit alpha-channel as collision detection works really well" ?? I use bounding spheres for colision detection between entities and an isometric grid for the map collisions.

Your are partly correct about the "overhangs". The engine supports both. (The walls visible on one of the desert screen shots are rendered with transparency. The indoor walls are not.)




#13 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 September 1999 - 09:33 AM

Hey, it's me again.

Ok now I understand how use did the diamond map, but why did u say u offseted on odd rows, isn't that only done on staggered isometric maps???
_
Are the tiles |_| rectangles?? and if they are why would you need to offset the odd rows??

Are u using a true rectangle engine or a isometric engine?? Right now it seems like your using a staggered isometric map.


Thanks ,

Da_KiD

Da_KiD is standing for Billy_Da_KiD, hehehe
Da is slang for Tha in Canada and America


#14 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 September 1999 - 11:12 AM

Hehe, I just checked - the offset thing was an experiment I did at some point. The tiles ARE square and placed exactly above and beside each other (Phew, I must be way too long since I looked at that code, damn!)...

The engine IS isometric. All coords internally are 3D (x,y,z) and then mapped to 2D (x,y) using isometric mapping. It's just the ground map thats a bit special (performance reasons exclusively)..

--

Da is slang for tha? (which is slang for the) Yes, I figured that much !!

Am I the only one slightly annoyed with the inability to read previous posts while writing an answer? (Yeah, I know open another browser, but really?)..

/NJ


#15 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 September 1999 - 12:20 PM

Hey, me AGAIN!

You said u mapped the tiles like a regular tile engine, but everything has 3d(x,y,z) coordinates and u map everything besides the tiles in isometric coords 2d(x,y), could u give me an example of the code to map isometric units or objects?? plz

Thanks alot,
Later,

Da_KiD


#16 Dave Astle   Senior Staff   -  Reputation: 2307

Like
Likes
Like

Posted 23 September 1999 - 03:50 AM

Niels: About not being able to read previous posts, the latest version of UBB addresses that. I'll hopefully be able to upgrade to it tonight.

#17 Niels   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 September 1999 - 05:09 AM

Great, thanxx !!

Now that we are at it , I think there's a bug in the ASP code on you main page that -sometimes- cause an ASP115 error (yup, that's the generic MS error code). Some times it just cause the browser to hang... (A wild guess would be an uninitialized variable )

/NJ





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS