Sign in to follow this  
ZeHa

Multiple Platforms that overlap each other

Recommended Posts

Hello, at the moment, my Iso Engine is not too far developed and so I'm still able to think about some things. First I wanted to make "flat" landscapes where the player and enemies will always be on the same height level. Of course there would be walls etc, but the floor tiles would always be at the bottom. No I'm thinking about using different heights for making "cooler" levels, but there are two possibilities that come to my mind: 1) Every tile gets its own height information. That would be a pretty easy way to do. Collisions would be checked with additional comparing of the height levels, and if it's below some tolerance value, the player may pass (e.g. for stairs), otherwise he will stop. So I could realize levels like in Snake Rattle & Roll, and it might be just enough to add some coolness to the game. 2) The other thing would be to add multiple layers of tiles (or blocks), so that you could also add bridges or door arcs etc, which could be crossed under AND over. That would make the levels even more complex and so on, but also programming would be a little bit more complicated. In fact, I don't even know how I would implement the second possibility. I could of course make a bottom layer which acts just like in possibility 1), but then add a top layer which can contain bridges and so on. But now I would be restricted to this single additional layer, and it could be that if I wanted even more bridges on different heights, I would have to add another layer and so on. And I would always have to check collisions in both layers etc. Well to make it short, 1) would be my favourite regarding programming. But 2) would give me more freedom in my level design. So what would you choose and how would you implement 2) ? Perhaps some of you has a good idea and in the end it wouldn't be too difficult...

Share this post


Link to post
Share on other sites
I remember wrestling with this a long time ago (and also variable heights at each edge of a tile using Direct3D rendering). I ended up settling on a system with a set base tile (actually two - water underneath everything at a set level), and then any number of layers above it at fixed height offsets. I went for fixed height offsets for two reasons: it made calculating collisions and similar easier because I could just assume "player is on height X", and because it made handling occlusion a LOT easier. I never liked it in isometric games when you move behind something and can no longer see yourself or your immediate environment; it made picking up items dropped in these hidden areas or fighting there really tricky. So, if there were layers above the player I rendered transclucent (alpha-blended) layers above the player's height. It was a lot like the old Ultima 7 engine - you went into a building and the top came off the building.

I think my favourite feature of this setup was that if something really big exploded, I could remove everything above it (and 1 layer below it if I wanted - revealing water).

With hindsight, an unlimited level linked-list of heights for each tile was serious overkill. It worked well enough, but I never used more than 5-6 levels and could easily have stuck with a fixed number and simplified a LOT of calculations.

Share this post


Link to post
Share on other sites
this is actualy pretty easy to do with mutiple map layers. I mean one map forms the lower section of the level. And another map forms the upper section, with special cross over points (like portals) connecting them.

Share this post


Link to post
Share on other sites
@ Bracket: So, your height layers would be just like a building with several floors, which means that every layer has the same distance to the next one? Or, better said, there is no tile, that can belong to a layer and be located a little bit under the layer. Okay, I can imagine that pretty well. Of course the player would not notice this too much, because level design would NOT be like that, I could leave the layers mostly empty and just use them for bridges and something like that. But each tile should also support different heights, so my proposals 1) and 2) should be combined to make really interesting levels. But that would be no problem of course.

But you are also right with the fixed number of layers, I think there's no need for more than 5 and so data storage would not be a problem, it would be just 5 arrays.

Well I will think about that, in my case there would also be no need for making layers translucent or something, but it's correct that this is also a good idea in some cases (e.g. when the level design IS indeed more a "several floors in a building"-thing).

@ MSW: What do you mean with those cross points? I think it should be enough to just build a stairway from the bottom layer to the one above, and collision / height checking should do the rest? Or am I overlooking something probably?

Share this post


Link to post
Share on other sites
Layered like building floors is exactly what I did - which made sense in my old system, because buildings were very important. I don't think the layers would *have* to be evenly spaced - but I found that being able to say "layer 3 always has a vertical offset of 150" very helpful, so you simplify things a bit by doing that. Stairs (and ramps) ended up as a special case if I remember rightly - I made some tiles that started at one elevation and ended at the next. Precise location for characters on these tiles was tricky, but worthwhile after some effort.

It's been years, but the ultimate objective behind my system was an urban combat game. It never received enough polish to be considered finished (I seem to remember I changed job and suddenly had less time), but it was a lot of fun. :-)

Share this post


Link to post
Share on other sites
Well I just thought about another possibility, it would be to have a level consisting of "cube spaces". So not just multiple building floors, but just tons of cube-like tiles stacked on each other. I assume they did that in "Head over Heels", but I'm not quite sure. At least there are bridges and so on, and they seem to be able to be on every height level (of course "normalized" into that cube "grid").

The problem would be, that there would be lots of data to be stored, and perhaps most of those cubes would be empty. Of course I could take some other storage idea than an array, then it would not matter how many would be empty. But collision detection and such would be harder on the other hand :)

Well my levels will be very big, with scrolling and so on, so I think I'll just stick with that "building floors"-idea ;) that should fit very well to my levels.

Share this post


Link to post
Share on other sites
Okay...lets say you have a map with a building on it. And you want characters to not only explore the inside of the building, but also walk around on the roof...how do you do it?

here is one way:

the base ground level, lets say its a 100 by 100 grid of tiles with a maze of building in the center...that stuff you understand right?

Well lets add some variables to better define this map and the characters moveing around on it.

First we need a anchor to hold the map someplace in the world...so we place the map at Map_X=0, Map_Y=0...this is in addition to other routine variables used to store how large the map is (Tiles_X=100, Tiles_Y=100) pointers to the map array and graphics used to display it, flags indicateing if its visable, etc..

Next we need to give each character another variable describeing which map they are on...My_map = handle to the map structure described above...effectively you are createing a parent/child relationship with the map and all the characters on it. the characters X and Y position then is relative to the map that they are standing on...so My_real_X = My_map.Map_X + My_X and My_real_Y = My_map.Map_Y + My_Y

Okay so now we add another map representing the roof. This map only needs to be large enough to cover the building so lets say it is 10 tiles wide by 10 tiles long (Tiles_X=10, Tiles_Y=10). so we create it and place it exactly over the building in the other map...effectively the roofs Map_X=10, Map_Y=10.

so now we need "portals" allowing characters to move from one map to another. so lets create a special character or sprite that is invisable. This is just like characters, it has My_map, My_X and My_Y varaiables as well as collision info. but it acts like a switch so when characters activate it it simply redirects that characters My_map handle to point at another map...additionaly such invisable characters can move around the map if so desired and or effect other things...like placeing one in the doorway to the building that switches the roofs Am_I_visable flag off or back on if characters cross over it into/out of the dwelling.

This allows all sorts of effects...like changeing the Map_X and Map_Y location to create moveing platforms, elevators and the like. And the maps themselves can be as small or large as you like without needless memory consumption, and you arn't limiting yourself with a fixed hardcoded number of map layers.

The Tomb Raider games used a very simular approch to create thier game worlds...effectively each "tile block" had info about the height of the floor/ceiling and which of the forr walls were open/closed (along with the needed texture info and any game effects like underwater, deadly lava and such) these "tile blocks" were collected into "rooms" (or map arrays) with additional linking info between "rooms" (ie. if moveing north out of room the Lara My_room handle is switched to the linked north room...or climbing up causes lara to switch to a room above, etc..)



Share this post


Link to post
Share on other sites
Ah okay, that's a very clever idea.

So then it would mean that if I have 3 of those buildings on my level, I would have 1 base map and 3 additional maps. And it would save lots of memory :)

That's really a good idea, I will think about that. It would also be somehow cool for designing the level-editor: that way, the base map and all additional maps could be loaded and displayed in grey or with transparency, and just the tiny map that you want to edit would be displayed in full color. That would be much easier instead of having whole "floors" over the whole map.

And the thing with moving platforms and elevators of course is also very cool indeed ;)

Thanks for that idea, I think I'm going to stick with that!

Share this post


Link to post
Share on other sites
Yes indeed. The maps need not be exclusively limited to floors though...say you want a huge building with a L shaped layout. instead of haveing one huge map of 1200 by 1200 tiles with the vast majority of them being empty. You could slice it up into two maps that cover only the area the building occupies with invisable "portals" allowing characters to move seemlessly between the two (and with some clever programing you could automate this in the map editor)...in fact useing the same amount of memory as that one single huge map you could have a building with a dozen or so floors and basements.

and displaying such maps isn't difficult, its basicly checking if rectangles (the screen, and map) collide...you know how big the screen is, and how big each map is, all you then need to do is check the screen_X and screen_Y location against each Map_X and Map_Y...

additionaly you could give each map a hieght offset like you might do with tiles, layering info describeing the order in which maps are to be drawn, and even group maps together under a parent with its own X and Y world anchor (ie. make that huge L shaped building with all its floors move around like a floating fortress) or even with some clever programing seemlessly load/unload maps inorder to create a huge seemless game world.

Share this post


Link to post
Share on other sites
Yeah, that's really cool. I'm especially looking forward to elevators and such :)

Of course drawing would be no problem because I'm using the graphic card's Z-buffer to automatically sort every tile. So I'd just have to wander through every array step by step and display everything that's on screen.

I wonder if there is any game that is massively using this isometric stuff, where the levels not only are extremely wide in horizontal ways, but also vertically? I haven't played too much games during the last years so perhaps I overlooked some really good stuff... but those isometric games that I know are mostly not designed like this, most of them just use stacked cubes and no bridges or something. Perhaps you've got some recommendations?

Btw, have you made (and of course finished) any isometric games so far? I'd really like to check them out if so ;)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Two games that worth mentioning is ufo and head over heels. Both use a simple 3d grid to store its levels. You can have less map levels if you use a height variable within each title. So each level can have objects with various heights. This means a hillside can have 4 terraces inside a single level, with 3 leveles this gives 12 possible levels for standing on and 3 of those are possible levels for placing bridges or building floors. (think of it as a mix between the classic stacks and a true 3d map)

Share this post


Link to post
Share on other sites
Well I decided now to do it like this:

A level conists of several platforms (number is unlimited), which all consist of several tiles.

A tile can have any height I want, but it is a solid block and can't be "underwalked".

If there should be a need for a tile-area that CAN be underwalked, it will be designed as a seperate platform and is, of course, able to have different heighted tiles as well.

The platforms are connected by portals, which can be any regular tile, and this can point up to 4 platforms (depending on the direction). Of course, every portal has to have a direct neighbor portal, which points back to the "coming from"-platform. Perhaps I'll make a difference for "teleporter"-tiles, those won't need a neighbor but still a matching counterpart.

Platforms can act as lifts, that way I can make a big building with a lift inside, that can bring the player to the roof top. It could be e.g. only 1 tile, but this would have to be a portal to its surrounding tiles. And when collision between a player and a portal is checked, of course it must be also checked if the destination platform is at the same height. Because it could be that the lift is on the roof top and then of course the player should not be able to enter that lift platform :)

If I want the player to be able to enter the floors of a skyscraper, I think I'll make the floors as seperate platforms but when the player enters it, only that platform will be shown and everything around will be black. That way I won't have to deal with transparency or something (and I wouldn't even want it, because I don't think that look would fit to the game's look) and the only thing I would have to do is give those special platforms a "solo flag" or something.

I think that's the most flexible and also most "natural" approach. And it really will save memory (at least in my level style). Thanks again to MSW ;) and also to the other answers of course ;) perhaps I'll be able to present a tech demo sometime in the near future ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by ZeHa
Btw, have you made (and of course finished) any isometric games so far? I'd really like to check them out if so ;)


My current main project (arcadish shooter) is 2D, but not isometric. And my other project (Turn Basied Stratigy RPG) will prolly be 3D useing my own engine (which is kinda Tomb Rader-ish). However, both are useing the same basic principals I described.



Share this post


Link to post
Share on other sites
Quote:
Two games that worth mentioning is ufo and head over heels.


I agree, this is the best solution - each cell can actualy contain many overlapped tiles, like a sandwitch; when you walk across the map, you can simply check the cell right next to your character to see if it has tiles of the same height. If not, you may either be blocked or fall/slide.

I think you can create very complex and beautiful maps using this method.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this