Building Comanche 3D in less than 100 lines of code (UPDATE)

Added Collision & Border Detection. The Altitude in now shown in HUD display…
https://dl.dropboxusercontent.com/u/30535865/xojo/ABComanche.zip

Framerates on compiled program is still bad… somebody here who could take a look into?

… a codesigned installer for windows is found here:
https://dl.dropboxusercontent.com/u/30535865/xojo/xojo-comanche-setup.exe

Here is a version using XojoScript. I used Tomas’ version as base because he already had HUD and Collisions added (love the crash pic!)

However, I don’t notice a big speed improvement. This is my fist Xojo script (did RBScript before), so maybe I did something wrong.

Here is the XojoScript version:
http://gorgeousapps.com/XOJOComancheWithScript.zip

Great speed improvement Alain! But compiler shows me error with Default values of surface maps. When I erase the Defaults the result looks kinda… strange… I’ve added 2 Screenshots…

Yes, I’m just updating the version. Stupid typo in the LoadMap (you have to switch x,y to y,x in MyScriptContext.VoxelMap(). Do you notice a speed improvement, I hardly do?

within IDE it’s more than twice so fast… as compiled binary even more than that…

On Mac I presume? On Windows less I think, but it may be a perception of me.

Yes on Mac Alain, look at the screenshots…

Weird, on Windows no error Xojo 2014r1.1

Uhm… maybe cause I am using 2014 r2?

The weekend is almost finished but I won’t go to bed until uploading new update :wink:

I’ve moved the collision detection and IR MFD/HUD stuff into the much faster XojoScript… yes right… IR MFD :wink:

Download Link: https://dl.dropboxusercontent.com/u/30535865/xojo/XOJOComancheWithScript.zip

… and now our Comanche has a Moving Map :wink:

https://dl.dropboxusercontent.com/u/30535865/xojo/XOJOComancheWithScript.zip

To keep the keys from beeping on OSX, change “return false” to “return true” in the Main.KeyDown event.

This is still really cool, by the way!

I’ll see if I can find the time to optimise the graphics on the Mac.

@Tomas Jakobs Nice work with the maps! This is more and more looking like the real thing :slight_smile:

Thx, Bill for the beeping advice… corrected now!
Thx, Alain.

And… well… I coudn’t leave my hands off the chopper.
improved the fickerig MFDs a bit and added SFX right now…
you have an audio collision warning sound… “Pull up” “Pull up”
:wink:

Alain, what’s your ultimate goal for this? Have you considered contacting the original authors and getting permission to redistribute it? I think it would be pretty cool to see this on the App Store and other places too.

@Sam Rowlands For me this was just an intellectual exercise to see if this was possible in Xojo. Just like all the code on my blog (except ABXVision), it is free to use so go ahead. Although a bit of credit is always nice :wink:

I’ll probably will make one follow up article on the blog (using the XojoScript and some of Tomas’ updates), but for me, that’s it. Got to move on to the next challenge :slight_smile:

There seems to be a problem with opening older RB/RS files containing images, got that with other projects too. Another option was to resave or reimport the pictures.

The code under Carbons runs a few FPS faster than under cocoa. I was eager to see myself if this all could be speeded up by using a XojoScript for image calculations, but because of the Sandbox / project bottleneck (passing between them to access a context method takes a really big chunk of time) everything would have to be done in XojoScript, so I gained maybe 2–3 FPS yet. Therefore very excited for Thomas‘ version.

@Sam: Oh Hold on Sam… we are only scratching on the surface. As Alain said, it’s an nice exercise and maybe a nice topic for Xojo but it would be a very long way to create something like Comanche. The hardest thing is still to come: AI

Speaking for myself this engine snippet by Alain makes a lot of fun. I have had a nice weekend. It’s not too complex to give up and incomplete enough to add more and more functions. It would be great if you could speed up graphics!!!

But weekend is over now and a lot of dull databases and stupid End Users waiting for me… I should work…
well… but I couldn’t resist myself and created an additional map… guess where I am? :slight_smile:

Download Link is still the same:

https://dl.dropboxusercontent.com/u/30535865/xojo/XOJOComancheWithScript.zip