fantomX game framework is released

Monkey Forums/User Modules/fantomX game framework is released

MikeHart(Posted 2015) [#1]
And here is the first release. fantomX is the successor of fantomEngine and fully mojo2 powered. Here are the changes compared to fantomEngine 1.57...

Version 2.0

*New functionalities*

- fantomX now uses mojo2.
- Box2D is more closely integrated into the engine. As mojo2 is now supported, this was unavoidable.

*New functions/methods *

- ftEngine.CreateCanvas:Canvas(image:Image = Null)
- ftEngine.GetCanvas:Canvas()
- ftEngine.Render:Void(scene:ftScene)
- ftEngine.RenderFlush:Void()
- ftEngine.SetAlpha:Void(alpha:Float)
- ftEngine.SetCanvas:Void(canvas:Canvas)
- ftEngine.SetCanvasAmbientLight : Void ( red:Float, green:Float, blue:Float )
- ftEngine.SetCanvasColorMask:Void(red:Bool, green:Bool, blue:Bool, alpha:Bool)
- ftEngine.SetCanvasFogColor:Void(red:Float, green:Float, blue:Float, alpha:float)
- ftEngine.SetColor:Void(red:Float, green:Float, blue:Float)
- ftEngine.SetupRender:Void()
- ftMapTile.GetProperty:String(key:String)
- ftMapTile.GetPropertyCount:Int()
- ftObject.CreateImage:ftObject(width:Int, height:Int, xpos:Float, ypos:Float, _ucob:Object=Null)
- ftScene.Render:Void(setupRender:Bool = False)
- ftScene.Update:Void(speed:Float=1.0, updateEngineTimer:Bool = False)
- ftTileMap.GetTileSet:ftTileSet(index:Int)
- ftTileMap.GetTileSetCount:Int()
- ftTileSet.GetImageHeight:Int()
- ftTileSet.GetImageWidth:Int()
- ftTileSet.GetTileHeight:Int()
- ftTileSet.GetTileWidth:Int()
- ftVec2D.Lerp:ftVec2D(targetVector:ftVec2D, timeFaktor:Float)


- ftObject.SetBlendMode regarding usable mojo2 blend modes.
- Removed class tPointS and exchanged it with class ftVec2Dp.
- Class ftVec2D extends now class ftVec2Dp.
- Moved the collision detection methods outside of ftObject into the cftCollisions file and made functions out of them.
- Renamed function GetPitchRate:Float(halfStep:Float, base:Float=1.0) inside the cftMisc.monkey file to ftGetPitchRate.
- Moved ftEngine._StripDir:String( path:String ) as a function to the cftMisc.monkey file.
- ftEngine.GetTouchX:Float(index:Int=0, withCam:Bool = True) ' Added withCam parameter
- ftEngine.GetTouchXY:Float[](index:Int=0, withCam:Bool = True) ' Added withCam parameter
- ftEngine.GetTouchY:Float(index:Int=0, withCam:Bool = True) ' Added withCam parameter
- ftEngine.LoadMusic:ftSound(filename:String, loopFlag:Bool=True) ' Changed the default loop frag to true
- ftEngine.SetMaxSoundChannel:Void(maxChannel:Int = 31) ' Changed the channel range to 0-31

*New example*

- Sound/Sound.monkey

You can grag it here..

The documentation is reachable at

To convert an old project to fantomX you need to do just a view changes. At the beginning of your code...

' Tell fantomX to import physics related classes/fields/methods
#FantomX_UsePhysics = False

' Import the fantomX framework which imports mojo2 itself
Import fantomX

And then in the OnRender method of your app...

	Method OnRender:Int()
		' Check if the engine is not paused
		If fE.GetPaused() = False Then
			' Clear the screen 
			fE.Clear( 255,0,0)
			' Render all visible objects of the engine

			' Now draw the current FPS value to the screen
			fE.SetColor(255, 255, 0)
			fE.GetCanvas().DrawText( "FPS= "+fE.GetFPS(),fE.GetLocalX(10), fE.GetLocalY(10))
			' Last, flip the previously drawn content to the screen, make it visible
			fE.GetCanvas().DrawText("**** PAUSED ****",fE.GetLocalX(fE.GetCanvasWidth()/2.0),fE.GetLocalY(fE.GetCanvasHeight()/2.0),0.5, 0.5)
			' Last, flip the previously drawn content to the screen, make it visible
		Return 0

therevills(Posted 2015) [#2]
Congrats on the release!

Amon(Posted 2015) [#3]

Gonna test this Chimps Monkey Surfing Power now. Well done and congrats on the release.

Playniax(Posted 2015) [#4]
Congrats on the release!

MikeHart(Posted 2015) [#5]
Thank you people!

Neuro(Posted 2015) [#6]
Ok so yeah, i'm pretty psyched right now to get this up and working. Got this error that i'm trying to work out though :

Compilation error : Duplicate identifier 'Image' found in module 'graphics' and module 'graphics'.

On this line :
img_raider = LoadImage("Raider.png", 32, 32, 12, Image.MidHandle)

MikeHart(Posted 2015) [#7]
As you posted in the FGL forum, i answered there. You are mixing mojo1 and mojo2.

Paul - Taiphoz(Posted 2015) [#8]
I got an error when trying to run your examples, is there something special that needs to be done to run this code?

Expecting class member decliration on "Protected" in Graphics

I put the fantomX folder in my modules folder along with the json was it ? module, then opened the example folder which it has inside to run an example, they all crash on this graphics error.

MikeHart(Posted 2015) [#9]
Yes, the fantomX folder with all the sources inside and the JSON folder.

No, nothing, the samples run out of the box.

Works fine here on HTML5 and OSX. Which Monkey version do you run? Needs 85e at least. I tested it on 86a also.

Paul - Taiphoz(Posted 2015) [#10]
ok got it working, although not sure what was wrong it seems that Mollusk had issues with it that jugnle and ted did not so dunno, might have just been Mollusk still trying to use an older trans..

anyway nice work.

MikeHart(Posted 2015) [#11]
I am glad. I use Ted for my development.

Neuro(Posted 2015) [#12]
Got it working now. I had the FontMachine module imported which was causing the duplicate issue since it was still loading the old mojo. Image loading methods have also changed - guess reading the instructions once in a while can help.

BTW, this would of come in handy during the NES Game Jam : Image.SetFlagsMask(Image.Managed);

I shall be making use of that later on :). Now if i can only get FontMachine to work with mojo2...

MikeHart(Posted 2015) [#13]
Neuro, no need for the fontmachine module. fE and fX both load bitmap fonts created via fontmachine for a while now. With outlines and shadows too.

Neuro(Posted 2015) [#14]
Lol, well i had to find out eventually :). Everything is good to go again now.

MikeHart(Posted 2015) [#15]
I am glad. That is the biggest problem i guess. The presentation of the features.
So people get aware of them. But that will change.

MikeHart(Posted 2016) [#16]
A while ago, fantomX version 2.02 was released:

New functionalities
- Added ftObject.SetImageScale9:Void (top:Float, bottom:Float, left:Float, bottom:Float) to support 9-slice image scaling.
- Added ftLayer.ActivateTouchEnterExitEvent (onOff:Bool = True) to activate the call of the following events...
- Added ftEngine.OnObjectTouchEnter (obj:ftObject, touchId:Int)
- Added ftEngine.OnObjectTouchExit (obj:ftObject, touchId:Int)
- Added SKN3's XML very good module

- Fixed ftLayer.TouchCheck so it takes a scaling of the layer into its calculation.

- ftEngine.CopyObject now supports 9-slice image scaling related fields of an object.
- ftObject.Render now supports 9-slice image scaling.
- ftObject.SetHeight:Void (height:Float, scaleMode:Bool = False) Added scale mode parameter. If set to true, the scale factor of an object is adjusted too.
- ftObject.SetWidth:Void (width:Float, scaleMode:Bool = False) Added scale mode parameter. If set to true, the scale factor of an object is adjusted too.

New examples
- Input/TouchInputEX/TouchInputEX.monkey
- Objects/Appearance/9SliceScaling/9SliceScaling.monkey

MikeHart(Posted 2016) [#17]
Btw. I started porting fantomX to Monkey2.

Amon(Posted 2016) [#18]
Btw. I started porting fantomX to Monkey2.

Now that would be some damn interesting code to look at. I wish I was as skilled as you, Mike. You are an exemplary coder and it's good to have you back.

Blitz Is funny like hate to love it so much. It works, you see. It is why I still see forums with hardened C++ programmers gawking in awe at the blitz3d source.


It's the spice..........

MikeHart(Posted 2016) [#19]
Btw. I started porting fantomX to Monkey2.

Atm. fantomX for M2 is not comming.

The current version of fantomX for MX is available at

Jesse(Posted 2016) [#20]
Well, I know a lot of programmers here don't want to make the transition to MX2 but I made it and I love it. There are a some things that seem new and requirements that have to be made before you can actually make a game. But once you get past that you can stick to simple programming or use the advanced features. all I use is Classes and interface with the usual language commands and works great for me. I don't mind the need to compile everything, it's not like it's such a big deal. In OS X you run the ".sh" file and takes care of everything as long as all of the tools are up to date and installed, I never had a problem.
I do think that Mark should just stick to one language and just keep updating it but I believe the way he is doing it is the most efficient way for him since it's a one man team. Starting over is easier than modifying existing code. Most of us don't like change because it takes us out of our confort zone and it's the main reason why most here are loosing interest in his products and why Mark is paying the price with such a low interest in them. But, change is good and I have learned to accept it as part of life so I just flow with it. I know I could have stayed in MX1 and would have been able to to have the same results. Ultimately what matters is the skills of the programmer. I find that a lot of individuals complain about what it's not there and want but once it's there find something else to complain about: just an excuse for why they can't make the game they want or why they can't apply the triple A features they want to apply. I have made a few games In monkey and what I have found out is that the only thing that limits me is the creativity. Yes, new features do help and make programming somewhat simpler but with or with out them I can still produce what I want. it's the mental ability to creates something that is interesting to the senses that is hard.

I also understand that the same reason why I don't use the Fantom Engine is the same reason why some of us don't like to make the transition to something new. it's the pains of learning it that we hate. Otherwise, I probably would have been using it long time ago as it seems like a good Engine. I also think that I am skilled enough as a programmer that I think that it's easier to code my own stuff than having to learn somebody else's style of coding. But, that doesn't mean I am right.

Finally I think the transition to MX2 is good choice, from what I can tell, and the more we are there the more we can help each other, Ultimately the community is what make it a good programming language. And, no matter what anyone here thinks or says Mark has abandoned Mx1 like BlitzBasic, Blitz3d and blitzMax so the Transition is the best option, I think. I just hope that Mark don't try to create another BRL product, that would really be nailing the last nail on the coffin and I am afraid it will be game over for everybody here.

MikeHart(Posted 2016) [#21]
Hi Jesse,

MX1 is a perfectly fine product and still runs great and is stable. At least for HTML5 and desktop which are my target platforms.

Xaron(Posted 2016) [#22]
I just hope that Mark don't try to create another BRL product, that would really be nailing the last nail on the coffin and I am afraid it will be game over for everybody here.

He always did, he (probably) always will. So no, MX2 won't be the last in the line in my opinion. The community gets smaller and smaller for every new product which is somehow normal because the products get more and more mature and there is less and less reason to use stuff like MX2 as language for instance when there is C++ and C#.

Earlier products were used because of stability and they were easy to understand. Simple languages. Nowadays with all this lambda and whatever stuff I scratch my head why I shouldn't use languages like C++ directly instead of Monkey. BlitzBasic3d for instance was just simple, beautiful (well OO fans will call it ugly) and it still works.

MikeHart(Posted 2016) [#23]
well OO fans will call it ugly) and it still works

When I look at over languages that don't support OOP, I see some beautifull results. And these communities are very productive. Sometimes less is better and you concentrate on getting the job done.

Xaron(Posted 2016) [#24]
I couldn't agree more...

Jesse(Posted 2016) [#25]
Some how don't see Mark creating something else after MX2. I see him taking his time to finish it this time and make it work smoothly. IMO I find it more fluid to work with. I don't use lambdas and has not limited me from doing what I want to do. I just learned how to use interfaces and I can see the advantages of using them even though I haven't found a need to use them. All I use are classes along with polymorphing and it does everything I need to do. I use polymorphing because I found it very useful and make more robust code. before I learned how to use polymorphing, I used to thing that it was just a dumb addition to programming but now It has just become part of my daily programming and I like it. I know I can make a game just with functions and get the same results but I find it more pleasant to work with OO code. I don't know exactly how Lambdas work but I will eventually learned how to used them and if I find use for them, they will become part of my tools to use but for now I don't miss them. I am mostly a self thought OO programmer. I was old School Pascal, Qbasic, Fortran, and procedural assembly. I self thought me how to program C. I couldn't get my head around C++ but after getting into BlitzMax I started getting the hang of OO programming. Little by little I have learned to enjoy OO coding. I don't think I could go back without missing all this new methodology.

IMO without trying to offend anybody here, some how I see the fable of the fox and the sour grapes here. :).
These are only my opinions and everybody has a right to do whatever they want. The community can make MX1 even better better but it will take lot's of love and dedication to it. I will only wish you all good luck with it. Most of us are just hobby programmers and any language will work fair enough for our purpose. I have moved on an I don't miss it.

MikeHart(Posted 2016) [#26]
Jesse, no sour grapes here what so ever. MX and M2 and all the other languages are just tools. And believe me, I have more tools in my toolbag, not only these. Monkey isn't my tool of choice anymore. My current game is being devleoped with a different tool.I am just here to support the users of my MX frameworks.

About M2, I yet have to see the advantage of M2 over MX. The building process is time consuming for me. One simple change to your module and you have to rebuild it. This was much more convenient in MX.
M2 1.06 didn't compile at all for me, dunno why as 1.02 was fine. I don't need lambas. I didn't even use interfaces before in MX. Just classes and extened classes in MX. I have created modules to interface with external SDKs in MX. So again, I have to see the advantage of M2 over MX. But I love the design of Ted2. To bad it lacks a class/method/function listbox to navigate in your code. Mojo2 in M2 is still inferior ot Mojo2 in MX.

For me it is about getting a job done. As simple as possible.

Jesse(Posted 2016) [#27]
I think everybody looks forward to doing something as simple and efficiently as possible. to me they are both just as efficient. I really can't tell you why I like M2 over M1. I know I feel more comfortable and more productive with M2 than M1 and is not that I use any different aspects of the tool. I have not gotten in to the position where M1 does what M2 doesn't either. To me it just seems Faster and more Robust but I guess its just a personal sentiment. When I left BMax I wasn't sure I liked the performance of M1 and I had never really been happy with it. I left Bmax because of the available other platforms in Monkey but was never really happy with it. So far M2 is meeting my expectations and it's why I am happy with it.

It's good you are satisfied with M1 and hope it fills your needs. As for me I have moved on to M2 and don't regret it. The only thing that bothers me is that some programmers ditch about things that they don't understand and make conclusions without real knowledge and is why my comment about the sour grapes. But hey, everybody is entitle to an opinion whether it's based on real experiences or not.

MikeHart(Posted 2016) [#28]
@Jesse: Well, I had a look at M2 v1.08 again. Quite a few changes again in M2. And now I hit a showstopper. A class which gets extended won't compile because M2 complains about a missing constuctor. I then have added the constructor and it still complains. In v1.02, M2 was completely fine with it. :-(

@all others: I am reworking the GUI part of fantomEngine/fantomX at the moment. Let's say the listview isn't the best gadget there. So there will be an enhancement coming.

Jesse(Posted 2016) [#29]
Yea, it still work in progress. I run in to a few problems using generics myself. It would give me an error on the generic class but the problem was in the classes that it used . I was able to figure it out by the process of elimination.I needed to add a plain "New()" constructor to all of the classes that used that specific generic class. It might be related to your problem.

If you still need help figuring that problem out, I can try to help you solve it. Also, Mark has been very consistent in resolving bugs after they are reported to Github. If there is an issue that can be resolved easily, he'll update it and post it to the repository sometimes immediately. He has been very active with the forums. I am sure he can help you solve it better than anybody there. I am surprised how active he has been in the forums lately.

MikeHart(Posted 2016) [#30]
Thanks Jesse. Previous issues I reported on github got ignored so i don't have high hopes regarding getting support from him.