A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 34

Thread: [possible]isometric rotation?

  1. #1
    Senior Member mr_shotgun_2000's Avatar
    Join Date
    Jun 2002
    Posts
    204

    [possible]isometric rotation?

    I have a question about isometric maps.
    is there any way I could go about creating a map and then changing it dynamically in the sense its rotation from the top down view? I dont know if thats putting it in right words so I found an example: in the examples section of outside of society there is a file that rotates link: http://oos.moxiecode.com/examples/isospin/index.html

    any ideas as how I should go about the creation of something like this?

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Location
    HK
    Posts
    149
    Hi

    The slow down situation just happens when pressing left, it is smooth on rightward. May I ask how do you make it? Rendering or something?
    Best Wishes,
    Jack SO
    Cowtoon.com - Iso. World engine open source

  3. #3
    Senior Member
    Join Date
    Jun 2000
    Posts
    896
    Hi mr_shotgun_2000,

    That is a neat link

    Let me start by saying I am not providing any insight in this post into how you can accomplish isometric rotation. My main purpose was to mention the real use of isometric worlds.

    Isometric is a specific view of a world. If you change the angle even slightly then it is no longer isometric. So with that neat link above, it is only isometric at four specific angle. All other angles are not iso.

    Isometric is useful because the perspective does not change and there is no vanishing point. This means that you can build 1 tile and have it everywhere. If there was a vanishing point, then the perspective of a tile is different than the perspective of the tile next to it, requiring multiple tile types (which usually means they are created dynamically). In the example in that link they appear to be drawn dynamically. That works fine for flat colors and vector. But if you tried to use a bitmap tile then you'd find trouble.

    Some iso games do use rotation, its just kept to certain angles. You may have noticed this if you've ever played Pikmin on the Game Cube.

    So I'd recommend that if you are going to add rotation that you make it 4 separate angles.

    Good luck with your project

  4. #4
    Senior Member
    Join Date
    Jan 2004
    Posts
    366
    Well if you would post how you did it it would be easier to fix. Are you rendering it, rotating it, going through frame by frame anim?

  5. #5
    Junior Member
    Join Date
    May 2002
    Posts
    0
    It's basically the same technique as the buggy woogie engine. But you can no longer use the usual 2:1 ratio, instead you have to use trig. You can find enough information on the boards if you search well enough.

    If your stuck on it, ask Tomsamson for some help, he did an engine like that a while ago.

    jtnw

  6. #6
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    What are you on about arrowflash? Thats not shotguns file, theres no problem, he just wants to know how to create something similair...

    Of course jobem is completely correct, if you really want to be able to see from multiple views 4 is the best for iso.

    There is a prototype here for rotating array:

    http://proto.layer51.com/d.aspx?f=414

    It would probably best to do this as the map loads, creating four rotated versions dynamically.. as shifting array info about in game could be nasty.

    good luck

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  7. #7
    Senior Member
    Join Date
    Jun 2000
    Posts
    896
    I wrote this Isometric class for my book (see below). Try changing theta and alpha to render new views.

    Here it is in use:
    http://www.electrotank.com/lab/iso/Demo.html
    http://www.electrotank.com/lab/iso/iso_world.html

    Or download the source:
    http://www.electrotank.com/lab/iso/iso.zip

    Code:
    class Isometric {
    	var maxx:Number, maxz:Number, theta:Number, alpha:Number, sinTheta:Number, cosTheta:Number, sinAlpha:Number, cosAlpha:Number;
    	var leeway:Number;
    	function Isometric(x:Number, z:Number) {
    		maxx = x;
    		maxz = z;
    		theta = 30;
    		alpha = 45;
    		theta *= Math.PI/180;
    		alpha *= Math.PI/180;
    		sinTheta = Math.sin(theta);
    		cosTheta = Math.cos(theta);
    		sinAlpha = Math.sin(alpha);
    		cosAlpha = Math.cos(alpha);
    		leeway = 5;
    	}
    	function mapToScreen(xpp:Number, ypp:Number, zpp:Number):Array {
    		var yp:Number = ypp;
    		var xp:Number = xpp*cosAlpha+zpp*sinAlpha;
    		var zp:Number = zpp*cosAlpha-xpp*sinAlpha;
    		var x:Number = xp;
    		var y:Number = yp*cosTheta-zp*sinTheta;
    		return [x, y];
    	}
    	function mapToIsoWorld(screenX:Number, screenY:Number):Array {
    		var z:Number = (screenX/cosAlpha-screenY/(sinAlpha*sinTheta))*(1/(cosAlpha/sinAlpha+sinAlpha/cosAlpha));
    		var x:Number = (1/cosAlpha)*(screenX-z*sinAlpha);
    		return [x, z];
    	}
    	function setLeeway(value:Number) {
    		leeway = value;
    	}
    	function calculateDepth(x:Number, y:Number, z:Number):Number {
    		var x:Number = Math.abs(x)*leeway;
    		var y:Number = Math.abs(y);
    		var z:Number = Math.abs(z)*leeway;
    		var a:Number = maxx;
    		var b:Number = maxz;
    		var floor:Number = a*(b-1)+x;
    		var depth:Number = a*(z-1)+x+floor*y;
    		return depth;
    	}
    }

  8. #8
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    nice file jobe,it was actually the reason why i bought your book (if you remember our discussion bout A* ages ago,that made me curious )

    Originally posted by jtnw
    If your stuck on it, ask Tomsamson for some help, he did an engine like that a while ago.
    yep,i made something similar a while ago,it actually had elements with bitmaps on them.
    basically you have a tilemap engine,you draw the map and then skew/rotate it based on angle/rotation.
    (that part is similar to the boogie woogie game).
    then you place "3d" tiles on it,they aren´t skewed,just moved to the right x/y coordinates (but you can skew their surfaces if that fits to the objects shape).
    each 3d tile object is made up of an mc containing an animation which shows a full 360° rotation of that object in iso perspective.you can then calculate to which frame all tiles should jump depending on the current rotation/angle.
    therefore you can handle all collision detection etc. like you would in a normal tilebased game,but have the nice feature to be able to rotate the scenary.
    on a sidenode: another nice side of using such an attempt is that the filesize doesn´t have to be much bigger than in a normal tilebased engine as you can turn your "texture" graphic into a graphic symbol (inside the tile object mc) and create the full 360° rotation with tweening.
    (i.e. for example tween each surface in an own layer)
    you could do the same with completely calcualted tile objects (drawn using the drawing api),but that would turn having textured objects into a pain (and would be much more processor intensive,as well as trickier to code).

    the sad side of the story is that scrolling the map gets more difficult (as you have to calculate different visible map dimensions based on the rotation/angle/viewpoint) and adjust your ordinary gotoandstop or visible scroller part quite a bit.
    (that´s also the reason why i stopped working on it,i had no particular paid project for it at that time and for a just for fun project it was too much work).

    by the way: jobe,i´m just reading your flash mx 2004 as book (which i ordered 30 september 2003 but received mid january thanks to amazon),i´m passing most parts as it really starts on beginner level,but the later chapters are nice and its even worth a read for those who´re familar with actionscript as it shows how to use as2 and what changes were made compared to as1,everyone having some time and interest in improving his scripting capabilities should have a look
    (by the way2: jobe,where´s your game demystified 2.0 book,get it out soon,won´t you? (yeah,i know it should be released in march,just can´t wait )

  9. #9
    Senior Member
    Join Date
    Jun 2000
    Posts
    896
    tomsamson,

    glad you like the book

    Yeah, game book should be out in march. I finished writing it in November.

  10. #10
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666

    coolies,this time i´ll preorder it,then i might get it in april

  11. #11
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    I don't think this should be called ISO-metric rotation, it's more tile-based-fake3D rotation I guess

    It's realy nicely done though!

    Anywayz, you could offcourse pre-render all the images to save a whole lot of speed
    Last edited by SaphuA; 02-11-2004 at 12:10 PM.

  12. #12
    Senior Member mr_shotgun_2000's Avatar
    Join Date
    Jun 2002
    Posts
    204
    thanks jobe and tom!
    I will try using different theta and alpha angles!
    one question though will it be really be that HARD to get it scrolling to work on it? (if tom could'nt manage or thought it was too much work, I AM DEAD!)

  13. #13
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    token has made very nice rotating engine. You can find it in this thread with little explanation (if you dig deep enough)

    http://www.flashkit.com/board/showth...hreadid=508466

    or direct link to the example
    http://www.token3.com/fake3d.html

    I think it was damn good idea

  14. #14
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    yep,that´s nice,too,but its a totally different way to go about it (if i remember right,many mcs were placed on the right x/y and then skewd/rotated).

    Originally posted by mr_shotgun_2000
    thanks jobe and tom!
    I will try using different theta and alpha angles!
    one question though will it be really be that HARD to get it scrolling to work on it? (if tom could'nt manage or thought it was too much work, I AM DEAD!)
    no probs,good luck with it =)
    well,it was too much work for just a free time project and i had too many other things to do back then,but i guess if some more tilebased
    pros like strille and pred would join and all would brainstrom and code together,it could be done in 1-3 days.

  15. #15
    Senior Member mr_shotgun_2000's Avatar
    Join Date
    Jun 2002
    Posts
    204
    thanks again tom! that link is really cool tony but one thing isnt that just for normal mc's in the sense I was wondering about doing something like this with an isometric scrolling engine!

  16. #16
    Senior Member mr_shotgun_2000's Avatar
    Join Date
    Jun 2002
    Posts
    204
    well the problem still persists! I tried using different theta and alpha angles and well the results are not that pleasant! the positioning isnt correct and tiles dont look like isometric no more!

    any ideas how I should go about doing this?

    PS- I saw strille's pseudo 3d engine but that isnt really tile based and i didnt quite get the concept of how he did the stuff so I cant really apply that here either!
    Last edited by mr_shotgun_2000; 02-13-2004 at 03:01 PM.

  17. #17
    Senior Member webgeek's Avatar
    Join Date
    Sep 2000
    Posts
    1,356
    tiles dont look like isometric no more!
    No, they wouldn't. Jobe said it in his first post with:
    Isometric is a specific view of a world. If you change the angle even slightly then it is no longer isometric. So with that neat link above, it is only isometric at four specific angle. All other angles are not iso.
    There are only 4 viewpoints (alpha/theta combination) where something is isometric. Any viewpoints other then those four will no longer be isometric. In that first url you posted, it appeared that the image started isometric and then rotated away from it. In fact, if you think about the angles used, you will see that only the theta was maintained. The alpha was rotated. Take a look at Jobe's first posted URL again to see what I mean.

    So are you trying to duplicate that first example you showed us or something else? If you are looking to do the first, then you are looking at something MUCH more complicated then simply doing four cardinal angles in an iso tile engine.

  18. #18
    Senior Member mr_shotgun_2000's Avatar
    Join Date
    Jun 2002
    Posts
    204
    hey webgeek!
    i got that only theta was constant! and also that well I'm not making something isometric(totally atleast)!

    and yeah I am trying to re-make what is there in the first link! any ideas as how I should go about it? (I know I'l have to use trig.)!

  19. #19
    Gross Pecululatarian Ed Mack's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    2,954

  20. #20
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182

    :)

    Ed, hunk,

    Have you actualy red the question?



    (is red the right word?)
    Last edited by SaphuA; 02-14-2004 at 07:03 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center