gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > isometric - once more

#44263 - sylphaleya - Tue May 31, 2005 2:42 pm

I try to do my own flexible isometric engine. That means:

- Tiles can be exchanged on the fly
- There are multiple levels

As conclusion I can't prepare a background layer and an foreground layer at design time.

I've implemented the following:

- Switch to mode 0.
- Stitch together two tile maps (waste VRAM but I don't care) for floor
- Doors and walls and players are drawn as sprites in correct oder two allow overlapping
- Effects are drawn with a third tile map

Advantage: fast
Drawbacks: Allows only limited walls, players, ... on one screen hence hard or impossible to manage

Based on the drawbacks a was thinking of a second approach but I'm not sure if it's practicable:

- Switch to mode 4
- Stitch together floor, walls, upper floors, ...
- Use sprites for players

I've coded (-O2 with gcc, arm-code in iwram) a simple loop only copies crap into the VRAM multiple times to emulate the overdraw and transparency testint. Without doing any math inside the loop, the time needed was awfull.

So here are my questions:

- Should I stop develop such crap on this kind of hardware?
- You know a far better algorithm anyway?
- Should I switch to assembly (looks like there is far better speed, altough I always thought I can't win against a modern compiler)?

Thanks in advance for any reply

#44265 - strager - Tue May 31, 2005 3:14 pm

How do you want the tiles set up? Are they like rotated squares:
Code:

   ..   
  .  . 
 .    .
.      .
 .    .
  .  . 
   ..   


Or do you want them more flattened:
Code:

   ..   
 ..  ..
..    ..
 ..  ..
   ..   


The rotated-square method is easier, but only in modes with rotating and scaling.

The flattened look: I believe you can do a HBlank-copy on the X register:

Code:

Origional:
........
.      .
.      .
........

HBlank-ed:
   ........
  .      .
 .      .
........


Then you can do a rotate (try different values to get a constant?). Never tried it; it may never work...

#44400 - Deanonious - Wed Jun 01, 2005 10:58 am

I have often been interested in doing an Isometric Game, games like Ultima 7, Ultima Online, and the Baldur's Gate series (granted BG used a completely different type of Iso engine) are some of the best RPG's ever created. I do not think I have the skills to make one well on the GBA though, it would be awesome if someone could release a general purpose, full featured, Isometric Graphics engine for the GBA. I know I am being lazy and asking for a dream (considering I can't even find any really good Iso engines available for the PC) but it would rock if someone did, even if only for others newbs like me to learn from it.

#44474 - tepples - Thu Jun 02, 2005 3:17 am

Starcraft for PC used a standard overhead engine with isometric-looking tiles. A lot of NES games did the same. Try that until you figure out how to make a real iso engine.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#44486 - SevenString - Thu Jun 02, 2005 5:12 am

ZERG RUSH!!!

Yeah, I'm taking the same approach. Layered pre-generated tiles to simulate iso. As long as it looks and feels iso, then I'll be happy.

But dynamic tile rotation could be pretty bitchin... hmmm...
_________________
"Artificial Intelligence is no match for natural stupidity."

#44504 - sylphaleya - Thu Jun 02, 2005 11:53 am

Baldur's Gate is more or less easy (from a programmers perspective) todo beacause everything is drawn by an artist. When the player is behind an objekt you have to overlay a mask or the like.

Ultima 7 isn't iso (iso perspective) but looks similar to UO. UO allows modification of the map in realtime therefore it's the way an iso engine should work.

#44821 - Shade - Sun Jun 05, 2005 8:51 pm

sylphaleya wrote:
UO allows modification of the map in realtime therefore it's the way an iso engine should work.


Does it? As far as I can remember, the map was static and stored in the client-side...

So how does on make something similar to Final Fantasy Tactics Advance? Meaning, tiles have different tiles in the background (altitude variantions), etc? Pre-render a tileset before the battle begins?

Cheers

#44825 - strager - Sun Jun 05, 2005 9:05 pm

Shade wrote:
So how does on make something similar to Final Fantasy Tactics Advance? Meaning, tiles have different tiles in the background (altitude variantions), etc? Pre-render a tileset before the battle begins?


Yup. I don't know how the game renders the characters behind an object; maybe another, cover-up sprite? Research to be done..

#44834 - Shade - Sun Jun 05, 2005 9:46 pm

Hmm, as far as I can see in VBA + my extracted FFTA ROM, it's a second tile map with a higher -- err, lower -- err, you know what I mean -- priority. So there's a map of tiles of everything "floor", and a second map of "stuff that gets in the way" (including trees and elevated floors). How they *know* they can get away with only two maps is beyond me for now, I'll have to check that math -- as far as I can see, there could be a mount over the hill over the floor -- but then again, they probably make it so in a way that the floor would be totally ocluded in that case.

One thing I found interesting is that every tile corresponds to the junction of exactly two pieces of isometric tiles. They reuse the same tiles at different spots quite efficiently that way.

If anyone is curious, I could post some screenshots.

Cheers

#44903 - ScottLininger - Mon Jun 06, 2005 6:13 pm

Shade wrote:
If anyone is curious, I could post some screenshots.


That would be really interesting, if you wouldn't mind. There seem to be a lot of different ways to achieve isometric, each with advantages and disadvantages.

The way that I solved the problem was with metatiles that are mostly transparent. You can see what I mean at my Isometic Map Builder site.

There are certainly disadvantages to this approach, but the big advantage is that you don't have to maintain a large library of "transition" tiles between your various textures.

-Scott

#44926 - strager - Mon Jun 06, 2005 9:22 pm

Wow, Nice idea. Gotta try that in my DS game I'm making.

#44977 - Shade - Tue Jun 07, 2005 1:30 am

ScottLininger wrote:
The way that I solved the problem was with metatiles that are mostly transparent. You can see what I mean at my Isometic Map Builder site.

That *is* nice stuff, congrats. How well does it work with multiple elevations (e.g., the desk I saw in the foreground on those shots, but with multiple levels)?

Could I maybe get an account to play around with your map app? I'd love to take a look.

I'll take and post some screenshots of FFTA in a few.

Cheers

#44988 - Shade - Tue Jun 07, 2005 2:29 am

(Well, it's the first time I post any images here, since they're small I guess this should be okay... If it's any breach of policy I apologize in advance. Couldn't find anything regarding it in the FAQ.)

The in-game screenshots:
[Images not permitted - Click here to view it]
[Images not permitted - Click here to view it]

The two maps, priorities 3 and 2 respectively:
[Images not permitted - Click here to view it]
[Images not permitted - Click here to view it]

The tileset:
[Images not permitted - Click here to view it]

Hope these are useful. AFAICS, they use the "2 textures per tile" combinations you spoke of.

#44995 - MrD - Tue Jun 07, 2005 2:52 am

In the Amiga days, some games had all the visible GFX in a 'display map' and all the areas where sprites would be hidden by it in an 'occlusion map'. GBA iso i'd wager would have a visible floor-stuff BG and a covering overtop-stuff BG with a priority closer to 0. I was gonna say this earlier... but Shade beat me to it with his FFTA screenies >_<.
_________________
Not active on this forum. For Lemmings DS help see its website.

#45180 - sgeos - Wed Jun 08, 2005 10:06 am

Shade wrote:
as far as I can see, there could be a mount over the hill over the floor -- but then again, they probably make it so in a way that the floor would be totally ocluded in that case.

All you need to put on the screen is the tile on top and what is behind it. If something is behind that, you don't need to [b]draw[/i] it, but you need to keep track of what it is internally. There are algorithms to perfectly draw any(*) isometric or old school overhead RPG style structure on two background layers (forground and background). IIRC it looks something like this:
Code:
void write_tile(int p_x, int p_y, tile_t p_tile)
{
   tile_t bg_tile = get_bg_tile(p_x, p_y);
   tile_t fg_tile = get_fg_tile(p_x, p_y);

   if (BLANK_TILE == bg_tile)
      set_bg_tile(p_x, p_y, p_tile);
   else if (BLANK_TILE == fg_tile)
      set_fg_tile(p_x, p_y, p_tile);
   else
   {
      set_bg_tile(p_x, p_y, fg_tile);
      set_fg_tile(p_x, p_y, p_tile);
   }
}

Sprites are either placed over or under the forground layer. Sprites in are displayed in depth order. There are cases where sprites can not be properly displayed, but the exact circumstances escape me right not. I seem to recall stairs that decend as they move deeper into the map pose problems if you want a sprite on every step.

(*) Can not handle transparent windows.

-Brendan