The Daily Click ::. Forums ::. Klik Coding Help ::. 3D isometric to 2D mmf coordinates conversion.
 

Post Reply  Post Oekaki 
 

Posted By Message

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
4th March, 2006 at 01:04:09 -

Hello TDC!

I've made this little demo that converts 3D coordinates into MMF's 2D coordinate for a smooth isometric movement.
I though some of you would like it since isometrics are always a challenge.

Have a look:
http://www3.sympatico.ca/pysavard/MMF/IsoWorld.cca

One problem I have though is that the movement is a bit shaky. If someone has a solution to make it move more smoothly, I would really appreciate.

I normally post that kind of stuff over at CT forum, but I though I give it a go in here.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
4th March, 2006 at 10:55:48 -

YOu don't need the Isometric Extension for that young man.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
4th March, 2006 at 17:15:29 -

Oh right, I forgot to remove it.
Fixed.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
4th March, 2006 at 17:57:36 -

Ah well...

I don't think it is too great.

The movement is indeed shaky, while isometric movement is really simple. It's just 1 up , 2 to the side (x) with every step you take. Always that ratio.

I have an (not yet finished) Isometric Engine too. It does also not use the Isometric Object, but it can do more. It can detect over which isometric coordinate the mouse is. It can translate screen to isometric coordinates and vice versa. It can rotate the playfield in 4 directions. It can load scenery from a file and even has z-values (heights of objects). But it's not done yet. I want the engine to be able to create mountains. The flat environments are just so boring. That's why I did not release it yet. I think I will when it's done but I'm taking things easy.

And this: I don't get the point of this?

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
7th March, 2006 at 03:20:39 -

Robbert,

The way you suggest is good if you are going to have a character that moves in only four or eight directions along the ground plane.
My goal is to give objects the possibly to translate in smooth 360 directions, and some others to fly upwards and downwards.
This is why I want to calculate my movements in 3D coordinates first, and then convert those movements into the usual 1:2 isometric layout.

I'm also working out my own 3D collision routine that will work with a 3D array of cubes. I intend to eventually add collision detection with other types of blocks, slopes and cylinders. I might even make a height map to produce bumps on the ground.

Thanks for the feedback. I'm glad to see we both have similar goals and challenges.

Image Edited by the Author.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
7th March, 2006 at 16:44:36 -

ah i see. the 360 movement will not be easy. but i can't remember to have seen it in many isometric games? i mean, isnt isometric always about 4 or 8 directions and where the object changes from direction, you see a "turn" animation? well, that's my idea. I wouldn't know why i would use 360 degrees. maybe you can expain what for?

And i am also curious about your way of how to do the height map... I mean I can make a height map in an INI file or something like this:

0-0-0-0
0-3-6-3
0-3-6-3
0-3-6-0

which is a 4x4 map just to illustrate the idea The numbers are the height value. But I guess it is really hard to visualise this, wouldn't it? you'll need loads of active objects for a mountain that is 4x4 tiles of 6 high. That is 4x4x6 tiles for a really small square of the map...

and second to make the mountain look smooth. challenging

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
8th March, 2006 at 00:26:44 -

Yes, doing the heights with an INI is a good simplified idea. It also makes it very easy to edit the elevation of cell in the height grid. The way that you represent your elevations with organized numbers is a lot like how values are stored in a 2D array; which brings the reason why I want to try and do it with a 3D array.

I want the possibility to have tunnels going through my mountains, so that the player can climb over a mountain or pass under it. Making bridges should also be possible. Also, using a 3D array with each cell representing a block of space, it lets me insert a value into those cells. I can refer to this value for knowing if the cell is empty space or if it’s filled, and of what kind of content it’s filled with.

The biggest issue with a 3D array is how to easily edit the content. I would probably need to make a map editor to build the environments, save them to files and load them during the game. It’s also true that the environments are going to be very blocky and “cubish”. That’s why I want to add some slopes and cylinders into the mix.

But blocky collisions don’t really mean bad looking:
http://www3.sympatico.ca/pysavard/Forums/GrassRender.jpg

I don’t think that I will need lots of objects to display the environment, since it would be made of data and math. I could have just one big detailed background object (like that last link), and some actives to represent things that the characters can move behind or under.

Thanks again for your input. You're making me think harder about my project.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
8th March, 2006 at 11:56:59 -

Hmm the 3d array thing isnt a bad idea I guess. I have never worked with MMF arrays so far, but it is clear that it can do more than the ini-file that i came up with, because the ini-method lacks tunneling (never thought of that ).

The grassrender looks really good. Did you make it yourself?

Anyway, good luck with the engine. It sounds like you are really eager (is that the right word?) to get this done. It is not easy you know I must say it's good to see that I am not the only one thinking of how to do an isometric engine for a game. We can help each other out with ideas if any of us get stuck


 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
8th March, 2006 at 12:27:32 -

http://home.wanadoo.nl/tonbreij/Isometrische%20Engine.jpg

Image Edited by the Author.

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
8th March, 2006 at 12:29:14 -

This is my engine so far. Please remember that the "smooth" mountain tiles that you see are only made for myself to get an impression of how it will or can look in the future. It is thus not part of the engine.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
8th March, 2006 at 14:41:20 -

Sweet, nice jobe on the slop tiles. Too bad they are not functioning yet.
That remind me of marble madness. I would be very cool if you can pull something that works just as well.

On my part, I'll have to make the grid based intersection work in 2D first. So when all the math works in 2D, then I'll try to do it with 3D math.

I'm still having trouble thinking about how i'll be doing the layer sorting.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
8th March, 2006 at 22:41:53 -

you'll need the layer object for that I think. With the isometric grid object there comes 2 demos, one shows the iso grid with the layer object combined. I think it uses the D-value of an object. You'll have to give every coordinate a d-value i think. 0,0 is 0... 0,1 and 1,0 are 1... 2,0 and 1,1 and 0,2 are 2. But I don't know. I have thought a long time about it too, what is best, but this is also a feature that is not yet implemented into the file

I don't know Marble Madness. heard of it though. But I think I'll design this engine to be like the engine of Rollercoaster Tycoon. Or else a RTS. Tycoongames and strategy games are just the best of all genres that can be played years after the release. (look at red alert and rollercoaster tycoon)

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
12th March, 2006 at 10:22:39 -

One question. I inserted the Array object. It seems really handy. But when you save it, what kind of filetype must is be?

 
Hey mates, I'm Iglo yeah =P!

DanielRehn



Registered
  18/09/2002
Points
  139
13th March, 2006 at 00:56:10 -

Whatever you like (.arr if you wanna go standard)

 
n/a

Robbert



Registered
  19/06/2003
Points
  420
13th March, 2006 at 16:04:54 -

Thanks

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
13th March, 2006 at 20:57:27 -

There seems to be a problem with my array, but I don't see what it does wrong...

I have an editor that writes strings to the array indexes. I use a 2d array (so z-dimension is 1).
In this editor I can give coordinates a texture:

0,0 / 1,0 / 2,0 are grass
0,1 / 1,1 / 2,1 are sand
0,2 / 1,2 / 2,2 are water

that is basicly the array that should look something like this:

0 1 2
0 grass sand water
1 grass sand water
2 grass sand water

So this is the array. I save this as Appdrive$ + Appdir $+"texturemap.arr"

Now in the engine I try to load it. The same file.

A loop runs through all the cells in the grid:

On loop "array"
+ String At XYZ(index_x,index_y,index_z) = "gras":

Create object grasstile and set it to the converted values of index_x and index_y and index_z etc...

But it does not recognize the strings that are in the array! It only does its work when String At XYZ = "". So it only reacts to an empty string. This makes my array worthless. Does anyone have an idea where I could be wrong?





 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
13th March, 2006 at 21:04:51 -

Ah I found it! The flat array begins with z as 1, while my loop starts at z as 0.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
14th March, 2006 at 02:27:16 -

Now I've been tweaking my Isometrics transform with excellent results.
And I also got my grid based collision engine to work with smooth movements and sliding on walls. The math is done only in 2D for now but adding the 3rd dimension in the process shouldn't be too much trouble. Entering narrow passages is a bit difficult though. But I have a few different ideas on how to work it out.

Early into this project, I though that using Tigerworks' Iso Grid 2 extension wouldn't work since the type of movement it handles isn't what I was looking for.
But while trying to build my isometric editor today, I had another look at it.

I must say that I should have gone with this extension from the start. Not for the movements it does, but because it's a good 3D array that can store multiple values in each of its cells, and has the 3D addressing features that I need. It also has lots of useful functions that can handle some of the position conversion I need. To think that I cracked my skull open trying to figure out complex equations, while that this extension handles them easily.

Iso Grid 2 is so good it would be an insult not to use it, for anything related to isometrics.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
14th March, 2006 at 14:26:52 -

Could you post a screenshot or a file of the game here soon?

I would like to see at what point you're at.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
15th March, 2006 at 04:32:32 -

Sure.

Now those are still WIP and not very optimised, but here you go anyways:

http://www3.sympatico.ca/pysavard/MMF/IsoWorld.cca
My 3D to 2D coordinates conversion formula is finished.
I needed to give my 3D cube a fixed size and have it relate well to dimensions of my isometric tiles. Since I have isometric diamond tiles of 32x64, I figured it would be best to have 3D cubes of 16x16x16 unites. This turned out great and lead to simplifying my original equations. Now I divide and multiply by 2 instead of using cos() and sin() with weird float values. And I got rid of the shaky movement at the same time.

http://www3.sympatico.ca/pysavard/MMF/3D_IsoEditor.cca
My new 3D isometric editor. This is to fill the 3D array with collision cells. The blue cubes are only to represent the content of the array, not to act as collision objects.
But the basics of the editor are there, though lots of things are running constantly without really being needed. I still need to add a load and save features. The IsoGrid2 extension can easily take care of this.

I'm moving on to merging the 3D collision process with all of this, and then I have a "special" layer sorting idea that I want to try out.

Image Edited by the Author.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
15th March, 2006 at 22:35:50 -

Nice. The Isoworld.cca reminds me of Excessive speed game, that controls.

But the 3D array... if you want to create a world of 300x300x40 it takes up more than 10 mb. And that's only one map! Even if it's empty. What are you doing about that?

My solution:

For the map a 2d array that loads the standard arrays. So the map is 300x300x1 and on every cell you could write "river_side" which is an array that contains the tiles for the side of a river (with dimensions of 1x1x40)...

40 is just the max number of z of the map. I don't know why. I might make it bigger, but we'll see.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
16th March, 2006 at 01:13:01 -

No, I dont intend to do such a large array. This goes in the same idea of not doing your entire mmf game in only one huge frame.
I intend to make it a room-by-room kind of game, with each frame being a room or an area. Kind of like the dongeons in zelda.
I will load one array per room. And I'll add some scrolling in the editor to edit larger areas.

I still have no idea what game to do with this. Probably an action game with puzzles, again taking zelda as an exemple.
I'm mostly interested in the challenge of programing and isometric engine and share it with the comunity.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
17th March, 2006 at 10:54:26 -

I am planning to use this engine for a Real Time Strategy game. It's simply the best genre

So I cannot use rooms, it is a large outdoor zone But I found a solution... Oh, and I need your opinion to this one:

The layering of all the objects.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
17th March, 2006 at 14:31:46 -

Since you are making a ground landscape, it might be along these line:
For each moving objects, make sure that they each have their own Z height in an alterable value.
Then set a second alterable value to the object's screen Y position plus it's Z value.
Then use the layer extension to sort the objects using the second alterable value of the object.

Does it make sens?

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
18th March, 2006 at 19:20:26 -

Yes. Thanks.

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
19th March, 2006 at 16:00:10 -

Hm I need your vision on this one:

I need big outdoor levels. The ground has an average height of 16. When the map is 200x200 it needs 200x200x16 "tile-blocks", that are all active objects.

This was done by a loop. It began with 0,0 (being the top cell) and went to 0,1 / 0,2 / 0,3 till it reached the Y-border. Then it did "Set Y to 0 and Set X to X+1. It switched to the next X-row. When both the Y and X values were at its border the loop did this: "Set X to 0. Set Y to 0. Set Z to Z+1". It moved to the level above to do the same thing again.

In every step of the loop, after the active object is placed at the right spot, the active objects turns into a backdrop object and the active object is destroyed. This is because when you have a big map (like 200x200x16 but even with much smaller maps) the game cannot handle all the active objects being generated in such a pace. The game gets stuck.

At first sight, the playfield is right. n,n,0 (the bottom cell) is in front of 0,0,0. But 0,0,1 is in front of n,n,0... which is not right! If a have a high tree at n,n,0 it would be overlapped by 0,0,1. That is not right.

So I need to generate the tile blocks in a different way. Not by the coordinates, but by it's screen Y coordinate. So 0,0 is layer 1 / 1,0 and 0,2 are layer 2 / 2,0 , 1,1 and 0,2 are layer 3 et cetera. But I can't seem to find a way to do this. Any idea?

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
19th March, 2006 at 18:43:07 -

That's the big problem with isometric.
You can only make your ground area as backdrop object, and maybe your topmost walls, because they are "flat".
But for any OBJECT that has a height and width like a tree, or that hovers in the air like a platform, you need to keep them as active objects and limit their number.

Why are you making your world by a big loop at runtime?
Other than maybe having a random world feature, I dont see why you couldn't place your backdrop tiles yourself in the MMF frame editor.

Also, I should warn you that you are openning a big can of worms here.
MMF has some bugs with bigs loops, and it has other display bugs when pasting a large amount of active objects into the background from inside a large loop.
I had such trouble in the past and I didn't find any workarounds.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
20th March, 2006 at 09:03:59 -

Well, I am not creating the map in MMF myself, because I want the game to have a level editor. So the map is built from a loaded array.

And I tried looping with big areas but they don't really give problems. As long as you do "on loop mainloop: create active object" and then immediately "add backdrop and destroy active object" it's not a big deal.

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
21st March, 2006 at 22:15:30 -

Ah I made it possible. But with large areas the game still gets stuck (not really, but you'll have to wait for some time)

is there an extension or a way to have a loading bar which displays the progress of your loop?

If not, i'll have to look for a different way But I have the time

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
22nd March, 2006 at 21:40:45 -

Hm that's not a bad idea I guess.

So instead of running 1 big loop of 100 steps, I'd have 10 loops of 10? When a loop is completed add 10 (%) to the counter?

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
23rd March, 2006 at 04:11:35 -

I don't remember which one, but I think their's a loop extension that can run a loop accross multiple MMF tics, and thus update the loading bar with time.

Oh and BTW, my isometric 3D collision is working great, for now. Because it's doing alot of excess loops and I might need to optimize it. But I dont want to complicate it or brake it.

It looks stupid without the layer sorting. So I'm placing my brain on that matter now.
I might have an idea for it to work with larger active objects that contain multiple collision cells.

Image Edited by the Author.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
23rd March, 2006 at 09:46:06 -

Ah I'll have a look at that extension then

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
23rd March, 2006 at 10:11:19 -

Hmmm do you know what that extension is called? I see 9 different ones:

- Custom Object
- Fast Function Object
- Fast Loop
- Function Loop Object
- Global Function Object
- Looper
- Power Function
- Switch Object
- While Object

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
26th March, 2006 at 21:38:03 -

http://home.wanadoo.nl/tonbreij/rts_screen01.JPG

This is my second idea. If the loading of the environment takes so long with multiple Z-layers, I could replace that reals Z-height for visual tricks like you see on the screenshot. Do you think that is a good solution?

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
27th March, 2006 at 00:54:08 -

I'm not sure that I get it, but you can try it and let me know how it goes.
Often when I want to try a new process, I build it another cca file to see how it work. Then if all goes well, I bring it back into the actual project cca.

 
<0> ReDhAdEs <0>

Robbert



Registered
  19/06/2003
Points
  420
27th March, 2006 at 17:06:48 -

Well... look at the edges of the pool. You'll see that it looks like the water is one level below the grass level. But this is not done by real Z-stacking, but with "visual tricks". I mean the grid that you see over the water are the actual tiles that are placed.

So it's not like grass-Z is 2, water-Z is 1... but it's pure visual.

 
Hey mates, I'm Iglo yeah =P!

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
28th March, 2006 at 02:35:59 -

It should be just fine as long as you make sure that no character can walk on those tiles, cuz it will silly.

 
<0> ReDhAdEs <0>

RedHades



Registered
  25/05/2003
Points
  108

Has Donated, Thank You!
4th April, 2006 at 01:19:39 -

Big update; my isometric prototype is done and working very well.
http://www3.sympatico.ca/pysavard/MMF/IsoPrototype_03-04-2006.zip
- The movements are smooth in any directions. (W,S,A,D,Space)
- The 3D collision is pixel-perfect.
- The layer sorting process is optimised and giving great results. You can move around, over and under objects.

Next, I want to rework the movement and collision loop to minimise the number of loops.
Then I'll replace all those many small cubes with fewer and larger active objects.
I'll also add support for multiple moving objects.

I forgot to mention the extensions: Isometric Grid 2, Value Finder and Leyer Object

Image Edited by the Author.

 
<0> ReDhAdEs <0>

ben mercer

Possibly Insane

Registered
  11/07/2004
Points
  2538
11th April, 2006 at 09:00:49 -

To make isometric movement I find that it is best to let the X and Y position of each object be controlled by an alt value.

So X = Value A
Y = Value B / Isometricity

The higher the isometricity value, the more the Y axis will be squashed. You can also achieve the same using X and Y velocities.

 
Stuckboy

JC Denton: "I know your UNATCO killphrase: Laputan Machine."
Gunther Hermann: "I - am - not - a - machi --"
JC Denton: "Sticks and stones..."
   

Post Reply



 



Advertisement

Worth A Click