Phoenix Framework

Monkey Archive Forums/Monkey Projects/Phoenix Framework

NoOdle(Posted 2012) [#1]
This is the development diary for my 2D game framework. In my latest version/revision/rewrite some features that are finished and implemented are:

Parent / Child Entity Relationship
Local / Global transformations
Bounds Culling
Z Ordering
Batch Drawing
Hashmap
Binary Tree
Sort Stack
Matrix and Vector functions
XML Parser
FPS and Delta Timing
Scenes
Layers
Labels
Sprites
SpriteAtlases
TextureAtlases
Fonts
Rectangle, Oval, Line
Targeted Single Touch Delegate with priority ordering

I have also added loaders for SpriteAtlases ( Zwoptex and TexturePacker ), Fonts ( Glyph Designer ) and.... I have spent the last 5 days solid with almost no sleep implementing Tiled TMX map support. Isometric, Orthogonal and Hexagonal maps can be load using CSV, base64 or XML encoding. Automatic batch drawing, layers, properties and fast clipping are all working. My parser also automatically expands layers so that they contain only one tileset reference per layer making it much quicker to render. Tiles can be animated, hidden, deleted, tinted, rotated etc etc. I still need to finish the sub level depth sorting to allow players to appear above or behind tiles across multiple layers but this is almost finished.

Here is a screenshot showing off a map + gfx from Flare rpg I'm using to test my loader.
Isometric:



And this one uses sprites drawn by Daniel Cook that I hacked about to get working. Haven't finished chopping up the shadow tiles yet. (Ignore the sorting error on the rock right hand side, that is me forgetting to delete an old layer before taking the screenshot, cba to take another! )
Orthogonal:



I have a list of features still to implement that is so long it scares me... but I have already written a lot of the code, some during earlier tests and versions of this framework. I am aware that I could easily be a victim of the dreaded feature creep which is why I spent a few hours the other day prioritising features for the initial release... fingers crossed I'll be safe.

I will be selling this framework but it will be very at a reasonable price. The reason for this is due to the huge amount of man hours I've put into this; constantly redesigning and improving core functionality, testing out different implementations and ideas, learning new mathematical techniques, algorithms and data structures. So far it looks and feels like the hard work has paid off and I haven't had so much fun programming for years! Thank you Mark I'm a happy chappy! Hopefully I'll have some more fun things for you to look at soon!


Tri|Ga|De(Posted 2012) [#2]
Looking forward to this. Looks good.


samowitsch(Posted 2012) [#3]
Cool!


NoOdle(Posted 2012) [#4]
Spent the last few days implementing actions and easing. Most actions are done for now: Position, Scale, Rotate, Blink, Fade, Visibility, Skew, Colour. Actions that manipulate other actions are also implemented, Repeat, RepeatForever, Sequence, ActionMultiple, Speed and Reverse. I have also implemented easing actions using Robert Penners equations and the tweener library as a guide.

Here is a link to the easing example.

Click inside the game window to get focus.
Right / Left keys to cycle through the different easing actions.

http://www.swfcabin.com/open/1352221753

Screenshot:



Why0Why(Posted 2012) [#5]
I'm not sure how I missed this. I bought Playniax and I like it, but Noodle, I have enjoyed all of the code you have posted in the forums more than anyone and it has helped me a lot. I really appreciate the contributions. I will buy this just to support you and the community.

Thanks again for all you do!


Shinkiro1(Posted 2012) [#6]
That looks like a lot of functionality. Are you also planning on some kind of event-handling or message passing?

Side-note: Robert Penners equations are awesome! I based my tweening lib on these functions too. The only one I couldn't get to work was EaseInOutBounce as that was giving strange results sometimes.


NoOdle(Posted 2012) [#7]
I managed to get most of them working pretty easily, the visual graph I programmed really helped to see what was going on with the functions. Managed to get OutIn versions all working effortlessly too!

I have implemented callbacks and scheduling ( calling a method/function regularly or after a certain time has elapsed ) using reflection. Ill have more information and demos showing off this stuff soon.


NoOdle(Posted 2012) [#8]
Added lots more things to the framework and reworked a few:

Virtual Joystick
Virtual D-Pad
Virtual Button
Animation Cache
Sprite Animation
Schedule Manager
Selector
SelectorAction
Callbacks

Methods can be scheduled to run at a desired FPS or at Max FPS. If the FPS is changed during the game, the scheduled methods automatically adjust to keep the correct time and update rate. MAX FPS scheduled methods match the game FPS. Schedules can also be prioritised to call one before another (useful for collision) and they also have an optional delay. They can also be repeated or fired once. Schedules can also be removed from targets by providing the name of the method. These are very useful for adding custom update loops and restricting heavy math code to update less frequently.

Selectors are slightly different. They can be used to instantly call a custom method. They are great for immediate callbacks like button clicks. They too have an optional delay.

Callbacks are used to communicate between the framework and game classes. These are different still to Selectors and Schedules. For example, a VirtualInputCallback would be called when a virtual joystick is moved or not auto centred. The callback would pass the joystick instance in as a field; allowing the stick velocity to be obtained and modify the players screen position accordingly. I decided to use interfaces as it was less overhead and lead to cleaner code, fields do not have to be classInfo boxed like with a reflection approach.

A Selector Action has also been created to allow custom methods to be called during action sequences. For example, you might want to create a sequence action that first moves any coins picked up by the player from his or her location to a score icon on the HUD and then increase the score. This allows you to do that very easily by sequencing a MoveTo action and then your own method to update the score. Simple.

Sprite Animations can be loaded from file, stored in the cache for easy retrieval via name. FrameCallbacks have also been implemented, these fire when a sprite animation is showing a desired frame. This might trigger a particle effect, or check for close enemies and decrease their hp.

I hope to tackle Menus and Scene Transitions over the next few days and.... finally I've come up with a way of having split screen multiple cameras. My idea will allow each player to share game scenes or have their own (not appear on the same map). This will also allow players to adjust their settings without affecting the other players camera and could also be used to create two different loading screens and menu screens unique for each player. It should be pretty awesome if it works out like I've planned it in my head!!

Going to finish pimping up a little demo showing off the virtual joystick and animation stuff. Which has reminded me.. I wanted to implement a parallax layer class for the demo too, I'll see if I have time.


ordigdug(Posted 2012) [#9]
Looks great! I can't wait for the first release.


NoOdle(Posted 2012) [#10]
Things are taking longer than I would like... decided to optimise the matrix transformations some more and cache them but that was a lot more confusing than I had anticipated. Also took the opportunity to restructure and rename methods. Optimised classes using static where possible and refactored to allow easier module dissection. (less co dependant)

Heres something to play around with!

[edit] Updated demo. W/A/S/D skews the scene, Arrow keys moves the scene, Space rotates.
Profanity has also been removed!

http://www.swfcabin.com/open/1355189875

The white rectangle shows the 'Scene' and things get occluded when they are outside this region. There are 3 different types of Virtual button, click, hold and toggle and they can be disabled. Red and Blue are debug visuals and show the OOBB bounds and AABB visible content respectively.

As an example here is the code to create a joystick:

	Local joy : VirtualJoystick = VirtualJoystick.Create( "joy_1", "joy_2", -40.0 )
	joy.SetPosition( 50, 220 )
	joy.SetCallback( Self, "joyMoved" )
	Self.AddChild( joy, 100, "joy" )


And then the callback which could be named whatever you like ofc:

Method joyMoved : Void( joy : VirtualJoystick )
	Local dt : Float = DeltaTimer.GetDelta()
	Local px : Float = rectangle.GetPositionX() + joy.GetVelocityX() * 3.0 * dt
	Local py : Float = rectangle.GetPositionY() + joy.GetVelocityY() * 3.0 * dt
	rectangle.SetPosition( px, py )
End Method



Nobuyuki(Posted 2012) [#11]
less co-dependency ...... you have my interest, good sir.


Tibit(Posted 2012) [#12]
Really cool!

Have you tested to have a button on the map that can be rotated & zoomed? For example in a Strategy-game, a unit could be a button, or in a game where one would like GUI elements to be placed in the "world" if that make sense.

I was half-way through doing a camera like that myself, but what you have done looks brilliant in style, function and features. Any possibility of you taking alpha pre-orders?


NoOdle(Posted 2012) [#13]
Zooming, rotation, etc, it all work with touches. I forgot to mention that there are some keyboard controls still programmed in the link above. Arrow keys moves the scene around, space key rotates it. It shows you can still move the joy and click and all works as it should! As for a pre-order I'll have a think and let you know!


Tibit(Posted 2012) [#14]
Ah nice now I see, exactly whan I'm after!

On another note. I got a google Malware warning from your link above, just wanted to let you know:
http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=http%3A%2F%2Fwww.swfcabin.com%2Fopen%2F1354935318&client=googlechrome&hl=en-US

Any estimated time to first release?


NoOdle(Posted 2012) [#15]
Yea I noticed that when I was testing in Chrome earlier, Safari doesn't mention anything... hopefully nothing to worry about....? I couldn't find another free SWF upload site with a big preview window (most scale down).

Estimated release time is err... Hoping to have something by the new year, possibly earlier, maybe christmas.

This week I'm going to tackle a few games with the framework, filling any holes as I go (which hopefully won't be many!). It will also give me a chance to write some documentation and a mini tutorial showing how to use the framework to make a game. After this I will have a pretty good idea of the timeframe for release.


Why0Why(Posted 2012) [#16]
I got the same Chrome warning, but since it was Noodle, I went through anyway :) It did look quite ominous!


therevills(Posted 2012) [#17]
I got the warning in FF too... cool demo, but do you have to swear on it?


NoOdle(Posted 2012) [#18]
but do you have to swear on it?

oops, sorry! Forgot I left that in there... I was a little over excited when the matrix transformations all worked properly! I have uploaded a new version with the naughty word removed, I also added controls W/A/S/D to skew the scene. Fun to mess with!


Nobuyuki(Posted 2013) [#19]
bump! What's the latest on this?


NoOdle(Posted 2013) [#20]
I've rewritten the framework from scratch, it has more features, its faster, cleaner and easier to use. Once I've shaken off the flu and finished moving house I will focus on releasing it asap.


Shinkiro1(Posted 2013) [#21]
That looks really neat. Looing forward to it.


Sammy(Posted 2013) [#22]
I'm not doing 2D stuff at the moment but a lot of this looks quite useful all the same, thank you!


RENGAC(Posted 2013) [#23]
Looks promising!


NoOdle(Posted 2013) [#24]
I might get round to adding a few examples that show the current progress of the framework but this will only delay its release so I'm torn.

Ive implemented so many new features and optimised existing ones.

Cameras - Infinite amount allowed, added to a world
Worlds - Infinite amount of worlds
Scenes - Render worlds and cameras

Scenes can also be transitioned, this also transitions the attached camera which in turns renders the world with the transitioned effect. Multiple scenes can be rendered at once allowing multiplayer or multiview games possible, this also gives the freedom to transition each of the views separately (useful for entering/leaving rooms in an RPG). Of course you can also transition all views as whole too due the hierarchal nature of the framework.

Worlds persist while they are being rendered, allowing transitioning scenes to reference existing data if transitioning into an existing world. All of this is done automatically with no changes to implementation code, it just works.

Parallax layers have also been drastically improved, anything you add to the layer will wrap allowing you to break up the repetition of just one image looping. Of course this also allows you to randomly place decoration on the layer and this too will wrap. Parallax speed and wrapping does not interfere with any layers that are already moving (e.g. a parallax cloud layer with a move action) so the clouds will scroll faster whilst the parallax is also scrolling. View zooming, scaling, rotation all work with the wrapping now and I've fixed the border seams problem too which is nice.

Single Touch and Multi Touch has been drastically improved, implemented classes can claim touches using the abstract methods and have a flag to prevent touches to propagate further down the delegate list. This allows very clever and complex touch systems to be implemented due to the priority sorting of each delegate in the list. Multi Touch allows very easy gesture recognition, a few basic gestures are included, pan, zoom, swipe. Touches also keep track of the number of taps allowing double taps.

Keyboard input mimics touches in the way it works, Multikey input allows for the fact that keys might be pressed together but register at slightly different times, this could allow players to land combos in fighting games with much less frustration.

Entities have been drastically improved too, matrix code cleaned up, a local and global matrix allows very fast point transformations and rendering. Bounding rects are now calculated using the absolute matrix which is much faster than transforming the corners and min/max the results.

Sprite, SpriteAtlas, NinePatch Sprites with automatic resizing for panels, frames, windows etc.
Really easy animation loading from sprite atlases, also allows any format of sequential frame numbering or lettering.

Physics and Collision Detection included swept SAT for bullets. Friction, Gravity, Bounce, drag, Constraints, Wheels, etc etc. Updated automatically, you just create a physics body with the properties desired and pass it to the physics word. It will update the linked entity and make it appear physically correctly. Quadtree and Spatial Grid are both finished and waiting to be implemented, both have optimised rebuilding methods to save time updating.

Actions have been hugely improved and added to, far too much to even talk about here. One of the cooler additions was the action timeline allowing really cool cutscenes or enemy formations to be handled with ease. All actions can be sequenced, spawned, repeated, reversed, have easing and can even have easing applied to easing that is applied to easing that is applied to a sequence that is applied to......etc etc. You get the idea.

Lots of supported programmes (more to come soon) with complete functionality:

Zwoptex
TexturePacker
GlyphDesigner
Tiled
Spine

So much more still that I haven't mentioned but I haven't got time now...


programmer(Posted 2013) [#25]
Single Touch and Multi Touch has been drastically improved, implemented classes can claim touches using the abstract methods and have a flag to prevent touches to propagate further down the delegate list. This allows very clever and complex touch systems to be implemented due to the priority sorting of each delegate in the list. Multi Touch allows very easy gesture recognition, a few basic gestures are included, pan, zoom, swipe. Touches also keep track of the number of taps allowing double taps.
Wow. Looks very promising!


garyk1968(Posted 2013) [#26]
Very impressive, when is it available?


Why0Why(Posted 2013) [#27]
Sounds amazing. I am looking forward to learning more about it.


computercoder(Posted 2013) [#28]
@NoOdle:

If you make examples, just make them in a way you could turn them into demos for distribution with the framework. You will eventually need to do this anyways... might as well make them as its fresh in your mind (and that part of the framework is stable and ready.

Even if it deleays it a bit more, it will make a MUCH better debut and first impression. Those examples could make all the difference :)


mteo77(Posted 2013) [#29]
Impressive list of features!
I agree with the examples, the more the better.


skape(Posted 2013) [#30]
How are you implementing physics / collision detection? Are you using a 3rd party library, or creating your own?

Sounds interesting!


RENGAC(Posted 2013) [#31]
Some explained examples of how to create a simple game from start to end with your framework could be very useful


NoOdle(Posted 2013) [#32]
Physics and Collision is my own. Im using SAT for the collision detection along with Swept SAT for things like bullet detection. Physics is verlet based with a few different constraints for now, distance, spring, angle. Circle, OBB and AABB Particles have been implemented, ( no rotation ). Wheel particle has been implemented, must remember where I found the amazing tutorial on that so I can link it!

The physics engine is a lightweight alternative to Box2D that will allow quicker and easier integration into your games. Particles are perfect for games that use a grid formation, TMX Collision will be integrated directly into Tiled via properties and a special layer. The TMXLoader will then be able to create the physics worlds automatically without having to add any extra code to your game. You will also be able to visually see the collisions from the design stage which should help to save some headaches!

Examples coming soon!


rIKmAN(Posted 2013) [#33]
The TMXLoader will then be able to create the physics worlds automatically without having to add any extra code to your game. You will also be able to visually see the collisions from the design stage which should help to save some headaches!

That sounds great, looking forward to the demos! :)


Gianmichele(Posted 2013) [#34]
Wow, this looks great! Any update on progress or ETA?

Any plan to implement particle designer loader?