Realbasic/Xojo: an Isometric engine (2.5D)

isometric
Tim Seyfarth had a specific question about adding a Z-axis to a floorplan. Immidiately I was thinking about the Isometric games like Diablo and I thought it would be a nice thing to try it out in Realbasic/Xojo. However, it looked like it was not that easy to implement as it seems. A lot of math is needed to create an engine like this. As my time is limited, I decided to spend some evenings translating an existing engine into Realbasic/Xojo. I have chosen the μIso (μIsometric Engine: A Java Isometric Engine) engine. The original code can be found here. All credit for the think work goes to Luis Henrique Oliveira Rios. Visit his page for some explanation.

μIso has some flaws I noticed (sometimes a ‘strange’ hole is visible in the montains or the mouse pointer loses track) but as you have the source code you can try to figure it out for yourself.

The speed in Realbasic/Xojo is also very slow (I get 7 frames per second, while the original java code got over 30 fps), but don’t let this discourage you to take a look on how it works. I don’t see this as an engine to create games with, but rather a tool to generate static pictures (like a floorplan).

You can scroll through the demo with the cursor keys (the minotaur does not move as I did not include the pathfinding algorithm). You can move the mouse to highlight a tile.

The program consists of two main folders:
1. UISO2.5D
This contains the real engine. Except for bug fixing, you should not need to make any changes to these classes.
2. Demo
This is a demo how you use the engine. All classes here are subclasses of the engine classes.
isometric folders

The full source code can be downloaded here UISO2.5D.zip

Some notes about the code:
1. change the path to the sprites (SpritePath) !!!!!!!!!!!!
2. if working with PRE Xojo, download the PNGutilities plugin (http://gorgeousapps.com/PNGUtilitiesPlugin.zip) and change in LoadABImage (ABGlobal):

for RB 2007:
dim img as new ABImage(PNGu.OpenAsPictureWithMask(f))
for xojo:
dim img as new ABImage(picture.Open(f))

Have fun programming and cheers for now!

About these ads

About Alwaysbusy

I'm the Senior Software Architect at One-Two. I like to experiment with new technologies like the Kinect, Computer Vision and A.I. Some of my projects are programmed in more exotic languages like RealStudio/Xojo and Basic4Android, but also in C# or java. I'll post some of those projects on this blog and I hope you learn some new exciting stuff! View all posts by Alwaysbusy

7 responses to “Realbasic/Xojo: an Isometric engine (2.5D)

  • Raphaelhael

    You’ve got your redirection wrong for the download link passed.
    I guess you’ve forgott the http:// to make it happen?

    I was smart enough to figure it’s

    http://gorgeousapps.com/UISO2.5D.zip

    • Alwaysbusy

      Woops, a copy and paste error :-) Thanks for pointing it out Raphaelhael :-)

      • Raphael

        You’re welcome !
        … as it looks like I even misspelled my name (oups), so human error is obviously not a myth … no need for appologies this time ;)

        Out of pure interest, I just tested it on my mac during a coffee break. Haven’t done anything with RB / Xojo for a really long time, but I had to check out the work on this one …

        Works great! Even though I also get only about 8 to 11 fps.
        But if I had more time, this would encourage me to improve this and make something out of it. Great work!
        There’ll probably be a lot of happy kids on this one ;)

        BTW, I changed the spritePath to a FolderItem. Default is selectFolder(). Then in init just the usual FolderItem.child(“filename”).AbsolutePath … thought it was easier and more dynamic …

      • Alwaysbusy

        I thought something was wrong with your name but maybe it was an alias you used and Raphael was already taken so you doubled the hael :-)

        Yes, speed is an issue in the xojo version, but I do not have the time either to optimize it. I don’t have an immidiate need for this and people got the source. I hope someone who does optimize it sends me his version, but I fear not a lot of my readers share their code back to me.

        Cheers!

      • Raphael

        I haven’t done it yet and don’t know how common it is in the Xojo community, but if you’d use Git you could maybe at least keep stats and eventually / possibly track changes?

        http://www.tempel.org/Arbed/SmartGit

        I don’t have time either, but someday I’ll continue my path on Xojo and for that I’m glad I found your canvas tutorials !

        Anyhow. Thanks for the nice demo and have a great day! :)

  • Max

    Very good Alain. I will study it in deep

  • Tim

    Hello Alain,
    Thank you for doing this! I apologize for the delay in reviewing – it was unfortunate and unavoidable. I plan to have a look this evening – but from your article here and the responses, sure looks good!
    Thank you again,
    Tim Seyfarth

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 419 other followers

%d bloggers like this: