Isometric engine

Started by
8 comments, last by darkbard 21 years, 1 month ago
Hi guys, I'm gonna try to build my own isometric engine in C...I wrote an isometric engine in Python time ago, but it seems too slow, and now I would like a better one... I just started to study C/C++ but I got a lot of experience in programming... I would like to ask you these questions: 1) Where I can find free isometric engine to study?? 2) I built my isometric engine using layers, but I encuntered problems whit switching le player position: I got one layer for player and walls, another one for the ground and the last one with the roof...now: if my player is walking behind a tree (that is in the sae layer), how can I hide my player??And how can I hide the tree when it is behind the player?And when the player is walking at the same level of the tree??How can I menage it?? I need some tehory, not code, just to understand... I solved my problem with python, but it was a slow tecnique, and I need a better one... anyone could help me?? tnx a lot [edited by - darkbard on March 17, 2003 11:31:42 AM]
Advertisement
I don''t have any source for you, so I''ll try to answer #2.

The way to get proper "hiding" is simply to have a proper drawing order. This generally means drawing tiles from top to bottom. Since you are using layers, you would draw layer by layer first. So your tile layer would be drawn before your wall/character layer. For plain square-tile graphics, that is all you would have to do.

If you are using isometric-style graphics, you might have to take the "slant" of the graphics into account. This could cause you to draw from right-to-left rather than the more common left-to-right order.

Once you have the proper drawing order worked out, you can easily simulate hiding by using larger sprites, that cover the tiles drawn before them.
I should draw from right to left, choosing the order of the tiles of the layer: So if I see that the tree''s tile (which is in the 2nd layer) is before the player''s tile(which is in the 1st layer) I will draw the 2nd before the first??I don''t think I undestood wery well...can you explain me the right to left method whit a simple example??I have to use the layers or not??

Tnx
The tree and the character need to be on the same layer and you start drawing from the top-right. This way, if the character is behind the tree, the character will be drawn first (lower y value) then the tree (higher y value). You need to draw the sprites with the lowest y and the highest x values first.

Any object that the character needs be able to "go behind" needs to be drawn on the same layer. I recommend 3 layers:
1) Ground (floors, etc.)
2) Objects (character, NPCs, chairs, trees, etc.)
3) Overlay (Areas that the character can walk underneath)
7|-|3 p057 @b0v3 i5 c3/^7i|=i3|) 1337!100|< |=0/^ j||3|/|7
An isometric engine in python? I would be interested in seeing it if you could post screens of it

Those aren''t bugs, they''re added features
quote:Original post by JNewt
The tree and the character need to be on the same layer and you start drawing from the top-right. This way, if the character is behind the tree, the character will be drawn first (lower y value) then the tree (higher y value). You need to draw the sprites with the lowest y and the highest x values first.


Ok, I understand...I wanna ask another question:
every layer is a 2 dimensional array, right?So, how can I "move the palyer" in this array?? If the user clicks near a the tree, I change, frame by frame, the PC position in the array??That''s right?
That depends on how precise your array is...
If it''s not that precise (like 1 value in the array= 32 pixels on screen) the character would move in big chunks... (if it moves one unit in the array it suddently moves 32 pixels on the screen)
You should have the player smoothly moving over the screen.
so I can sort the objects on the screen by the Y value and so displaing them in order??
The Isometrix Project: Engines and Games - source code
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
tnx a lot, but here there is a lot of code, and I need step by setp explanation...

This topic is closed to new replies.

Advertisement