Archived

This topic is now archived and is closed to further replies.

darkbard

Isometric engine

Recommended Posts

darkbard    122
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]

Share this post


Link to post
Share on other sites
Xiol    122
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.

Share this post


Link to post
Share on other sites
darkbard    122
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

Share this post


Link to post
Share on other sites
JNewt    122
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)

Share this post


Link to post
Share on other sites
NicolasX    108
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

Share this post


Link to post
Share on other sites
darkbard    122
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?

Share this post


Link to post
Share on other sites
Andos    124
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.

Share this post


Link to post
Share on other sites