Realbasic/Xojo: an Isometric engine (2.5D)

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.

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))

Rate this:

Share this:

Like this:

LikeLoading...

Related

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

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 …

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.

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