TimelineFX Module
Monkey Forums/Monkey Programming/TimelineFX Module
| ||
I've been giving a lot of thought recently to where I want to take TimelineFX next. For those that don't know TimelineFX is my particle effects software which has a Blitzmax module, but is also a stand alone piece of software that can export effects to sprite sheets for use in anything. The web site is here: http://www.rigzsoft.co.uk I've had a lot of requests to create a library on all sorts of platforms like corona, unity etc., but I'm gonna do a monkey module, partly because I love Blitzmax and my programming roots are kind of there, but also because monkey seems very capable and I'd like to use the HTML5 aspect of it for a new website I'll be doing too, be cool to have live previews of effects in the browser. Anyway, I hope I'll pick up Monkey pretty quick, I've had it since the first release but done bugger all with it; hopefully I'll be able to get something moving about easily enough :). I could be asking a lot of questions in due course, and have a couple of initial ones: The save format of timelineFX is using a zip archive containing all the particle shapes and an XML file for the effects data: is there a zip file reader for Monkey, if not I'll just create a new save format. And is there an XML reader? I think there's one in Diddy if I'm not mistaken? If you can think of any module creation pitfalls I should know about then please do :) Thanks! |
| ||
There is an XML parser in Diddy, yes. As for loading 'raw' data, I'm afraid you're going to have a hell of a job with it as, subject to the platform, you're pretty much limited to LoadString(). Trouble with that is that it can fail when it encounters non-standard or non-printable characters, as does LoadState(). I don't remember the specifics but in one platform, any occurence of a chr(0) caused it to think that was the end of the file. I don't know if there's a ZIP file reader yet, but even if there is, I don't envy you. |
| ||
I would considere to use a HEX representation of any file on a String, or something like this. Binary support on Monkey is non-existant (hopefully yet). |
| ||
Ok, well there's no raw data to load really, just an xml file and the png's that go with it, so maybe just a case of creating a folder.eff in the data folder and loading the unzipped contents from there. |
| ||
You may want to take a look here: http://www.monkeycoder.co.nz/Community/posts.php?topic=1395 Gfk has created a pseudo file system, which is included in Diddy. |
| ||
base64 for raw files works well. i use it for b3d files just fine. the only drawback is larger files (33% larger). There are on-line converters for you to test. |
| ||
I'm looking forward to this. |
| ||
That's great news! Thanks for supporting Monkey. TimelineFX is such a useful particle software! |
| ||
This is great for monkey... Mr Rigz's work is magic! Dabz |
| ||
I am super excited for this :D |
| ||
Me too! If the same effects can be run in Monkey that can be run in Blitzmax then I would not be surprised if this becomes one of the world's best particle engines for web & mobile. How is progress going so far? Encountered any interesting obstacles? |
| ||
Yep, I'm really looking forward to this as well. I love the system in BMax. Good luck. |
| ||
So far using TimelineFX to render animations to textures is working great! Looks very professional. Keep us updated on the Monkey module. |
| ||
Hey Peter, need this as well, any news? :) |
| ||
It's getting there, shortly after I posted this I suffered a bout of tonsillitis which was pretty nasty but slowly getting back into the swing of things :) Thanks for the interest I'm hoping it will turn out well! |
| ||
Good to hear you are getting better. Let me know if you need testers, I have several games I can test it in now :) |
| ||
Some news Peter? Still on it? |
| ||
I am also very interested! |
| ||
and me |
| ||
Me too! |
| ||
Me five! |
| ||
It's coming along slowly but surely, and I've procrastinated far too much lol. It's been hard to motivate myself because I'm doing a lot of work before I can actually see any results. But get there it will :) Thanks for the continued interest it does spur me on :) |
| ||
Aye, I'm interested as well. Good luck with it! :) |
| ||
I'm interested as well. I bought the TimelineFX software over Christmas, and it is neat. Very neat. Cheers |
| ||
It's quite a way along, I haven't been working constantly on it but I'm currently trying out all effects in the library and seeing if they look as they should and fixing bugs as I come across them. It's cool to see TimelineFX working in a browser :) |
| ||
Thats great news.Cant wait to see the finished product. |
| ||
Just found out about the timelineFX software myself and then overjoyed to see that you are creating a monkey version. Definitely another buyer here when its finished! And now the obvious question....how's it coming along? :) |
| ||
Very slowly but surely :) |
| ||
Surely is good :) |
| ||
Awesome to hear! Still looking forward too it :) Still the best particle effects I have seen in a 2D game engine! And it is quite awesome Monkey has that power (soon). |
| ||
Well I think this is ready for some beta testing if anyone brave enough fancies trying it out :) I made an SVN repo here http://timelinefx.googlecode.com/svn/trunk/ You'll also need Diddy (Thanks to all the contributers!) as it users the XML parser in that. There's a little documentation in there but I'm still working on that, those familiar with the Blitzmax version shouldn't feel to far from home although there maybe one or two features missing that haven't been implemented yet. Check out the example in the examples folder to get you started. I uploaded a working example here: http://www.rigzsoft.co.uk/lightshow/ It uses devolonter's WebGL code here to make it run fast in a browser, pretty essential really for particle effects! Seems fine in Chrome however runs like a pig for me in IE for some reason. Check out the docs on Loadeffects, it will explain what you need to do to prepare an EFF file for monkey (basically you need to unzip it into the data folder) Here's what the example looks like, pretty straight forward: 'The minimum we need to import is mojo and of course timelinefx! Import mojo Import timelinefx 'remember to make sure monkey is set up to read xml files! #TEXT_FILES="*.txt|*.XML|*.xml|*.json" 'Create a simple Monky App Class Class FXexample Extends App 'Create some fields to store an effects libray, effect, and a particle manager. Field MyEffects:tlEffectsLibrary Field MyEffect:tlEffect Field MyParticleManager:tlParticleManager 'In the OnCreate method you can load your effects 'library and set up the particle manager. Method OnCreate() 'load the effects file. See the docs on LoadEffects on how to 'prepare an effects library for use in monkey. MyEffects = LoadEffects("explosions") 'Use GetEffect, to retrieve an effect from the library. MyEffect = MyEffects.GetEffect("toon explosion 2") 'create a particle manager to manage all the effects and particles MyParticleManager = CreateParticleManager(5000) 'Set the number of times per second that you want the particles to 'be updated. Best to set this to the UpdateRate SetUpdateFrequency(30) 'Let the Particle manager know the screen size MyParticleManager.SetScreenSize(DeviceWidth(), DeviceHeight()) 'Set the origin so that we can use mouse coords to place effects on screen MyParticleManager.SetOrigin(DeviceWidth() / 2, DeviceHeight() / 2) 'Mojo update rate SetUpdateRate 30 End 'Use the OnUpdate method to update the particle manager Method OnUpdate() 'lets create an effect everytime the mouse is clicked If MouseHit 'Copy the effect *Important! Dont just add an effect directly from the 'library, make a copy of it first* Local tempeffect:tlEffect = CopyEffect(MyEffect, MyParticleManager) 'Position the effect where we want it tempeffect.SetPosition(MouseX, MouseY) 'Add the effect to the particle manager MyParticleManager.AddEffect(tempeffect) EndIf 'Update the particle manager MyParticleManager.Update() End 'Use the OnRender method to render all particles Method OnRender() Cls 'draw the particles MyParticleManager.DrawParticles() End End Function Main() New FXexample End |
| ||
Excellent! I'll try this as soon as I'll find some time. The best Monkey News all year! Thank you so much for all your effort! |
| ||
Compiles fine to html5. Fails on most other targets. Do you want more info? |
| ||
I'm looking forward to test this soon. Brilliant work! |
| ||
Absolutely amazing in HTML 5! I could use any library from TimelineFX Editor and the effects look exactly the same in HTML 5. I only had to remove folders from the XML/EFF file to make it work. So far I have only tested this by editing the ParticleManager.monkey file, and I noticed that I can't just rename ParticleManager.monkey because it gets imported into timelinefx.monkey So, I still need to test this on different targets, and then include it into an existing project and also see how it works with different device resolutions, play with parameters, load/discard effects etc. This is exciting. Thank you! |
| ||
Thanks for trying it out :) The only only other target I tried on is glfw which worked fine. It doesn't use anything funky, just vanilla monkey (with the xml parser from diddy) so it should work work in theory. Any info you have would be good Volker. I need to make a mini game like I did with vaders in blitzmax so I can test it a bit more, and it's useful as an example too. |
| ||
Here we are. Fails compiling to android: Monkey Runtime Error: Invalid int: "360.000000" loaders.monkey<104> loaders.monkey<79> ParticleManager.monkey<22> Fails to xna: C:\Monkey\modules\timelinefx\examples\ParticleManager.build\xna\MonkeyGame\MonkeyGameContent\MonkeyGameContent.contentproj(100,73): error MSB4025: Die Projektdatei konnte nicht geladen werden. Beim Analysieren von 'EntityName' ist ein Fehler aufgetreten. Zeile 100, Position 73. (Sorry, german. Probably a failure in parsing xml; forbidden character?) Fails to Flash: TRANS FAILED: Invalid character in flash filename: explosions/Fog-Group.png. Looks like Flash doesn't like the minus sign. http://www.monkeycoder.co.nz/Community/posts.php?topic=602 |
| ||
Time to buy this, me thinks... |
| ||
Thanks Volker, I will solve the flash problem by adding an export to monkey in the editor which will remove invalid characters, plus I'll have it just save as a zip file so it's a bit easier to unpack into the data folder. I'll set up XNA next then and try and figure the XML parsing issues there. I've just installed all the android stuff and all compiles fine but I haven't really setup an emulator to test it yet, but it's late now will continue tomorrow :) I did wrap that int in a float instead and committed the changes so give that a go if you want, might fix it... |
| ||
Did some more testing. Explosions now work under android, but other effects fail. Some libraries, for ex. "FireandSmoke" do not even work under html; "m_effectClass of null". Others work fine in html but crash under android. You can download my commented JungleIDE project here: http://skopia.de/Timelinefx.rar |
| ||
Thanks Volker that helps a lot. Effectclass of null is usually because it can't find the effect, I need to catch that error and return something a bit more helpful. The thick smoke effect you were calling is in a folder so it should read "smoke and fire/thick smoke". However it still fails because it isn't loading the TPA files properly, thought I'd sorted that but obviously not :) |
| ||
So thing to do this weekend is add an export to monkey option in the editor to rename files appropriately. For now you can get things working for those effects by renaming the .tpa files to png. Will try and get the android emulator working, it's building ok but not loading the emulator, unfortunately I don't have an android phone to test as I know the emulator can be slow! |
| ||
I just tested this on iOS (iPad 2). I works fine, but I had to make some minor adjustments. I had to rename the DATA.XML file from the unzipped EFF to lower case data.xml because in loaders.monkey you call [monkeycode] local xmldoc:XMLDocument = parser.ParseFile(filename + "/data.xml") [/monkeycode] So iOS/Mac is obviously case sensitive. Maybe it's better to change the line of code above to upper case. The only other issue I had then was that XCode complained about semantic issues, but these are in diddy code, not in your module. It was easy to resolve, I just commented out the three lines that XCode highlighted in red. I don't think your code makes use of that part of diddy anyway. It runs fine, especially with a release build and 60fps. Not surprisingly the debug build feels less smooth. I tested with the "Environment/Shaft of light 2" effect from the "official" TimelineFX library. When I touch the screen a few times to add 10+ effects it slows down, but I'm not sure how heavy this effect is. When I have time I'll try to add this to an existing and already quite complex project, have a look at actual FPS, etc. Overall, it's looking great! I'm already using rendered TimelineFX in my app, but this is even better! Cheers! |
| ||
Don't have time to test this just now (my limited company goes live tomorrow so I'm stuck doing really boring crap for HMRC atm) but just wanted to say I'm really pleased to see it appear at last! I've used the Blitzmax version since 2010 and it rocks. When our current project is finished, we'll be doing an iOS conversion and using TFX for that, as well as for another little iOS project I have planned. |
| ||
Excellent news! |
| ||
Pete, how do i overall scale an effect, so it is drawn smaller? I tried tempeffect.SetScale(), tempeffect.SetGlobalZoom() and so on. BTW: tempeffect.SetSizeY(0.1) throws an error. |
| ||
Thanks all. It *should* be setscale, but I'll check if it's implemented properly. Will get some more done on it today. |
| ||
Ok, fixed the zoom problem and committed. You can use either SetZ or SetGlobalZoom to change the overall scale of the effect. SetSizeX/Y just affects the size of the particles in the effect. Also fixed the SetSizeY issue was just a typo :) Regards to performance on mobile devices etc. I'd always think that fill rate is going to be the killer there. I'm sure that starbursts and little explosion effects with small particles should be fine but effects with large scaled particles will still have to be either fully or semi pre-rendered. But of course you'll just have to test and find out. I'd imagine that there'll be a few things that can be optimised especially as I don't know all the ins and outs of Monkey yet. But the big things are already taken care of, for example all of the attribute graphs are converted into lookup tables so no heavy linear or bezier curve interpolation are done at runtime. |
| ||
The example stopped working. There is no "skull" effect in .data, just explosions. Please remove "DebugLog camzoom" from particlemanager.monkey. It although outputs in release mode an makes it sooo slow. And the one in components.monkey in update() ? Particle manager should restore the GFX states (alpha, scale, SetColor etc.) after drawing particles. Shall we switch to mail for bug reports? My little flying taxi looks beautiful with damaged engine. |
| ||
oops, sorry I overwrote the example rather use my own test program and completely forgot about the debuglog, fixed :) Yes will sort the states too, am currently just sorting out a new version of timelinefx with a monkey export option. Feel free to mail me, I think I'll set up a new MonkeyFX forum on rigzsoft.co.uk as well. Good to see it getting integrated in real world examples too :) |
| ||
What the status of this..? this nay be very interesting for my game. |
| ||
The status is that the monkey version is currently in beta and you're welcome to test it :) There are few gotchas with regards to preparing an EFF file for monkey but it's functioning quite well and I'm just fixing the bugs as they arrise. I now working on a new update for timelinefx app to include an export to monkey option, but it's taking a bit longer as I've updated wxMax (the gui it uses) to the latest version and just getting it up to speed on that. |
| ||
No problem. I am glad to hear we have such support for particles.. that will be very useful! I prefer to wait a bit to see the result of this before buying the software. I have a few stuff to do on my game first in the meanwhile but continue the good work! That is really appreciated here. :) |
| ||
Maybe its just myself, but has anyone else noticed an issue where the particle transparency seems to effect an image drawn above it. e.g. sorry messed up my code tags layout. Basically this is meant to show the particles firing behind a image message, but it make the image on top become transparent. I have tried it with a SetAlpha 1 in front of the image code but that makes no difference either Also, is there a TimeLine command for SoftKill in the monkey version? |
| ||
Just to say that I used TimelineFX in my commercial game Geisha The Secret Garden, made with BMax, and I'm very happy to know that this amazing tool come to Monkey. Can't wait for the final version, I'm OK to pay for that! |
| ||
Nice. Is there any news on the progress yet looking really forward to it. I may try the beta. |
| ||
Leginus, I do need to implement resetting the GFX states, but it sounds something else in your case if the image has setalpha 1 before it's drawn. Maybe it's the blendmode? Try setting the blendmode to alpha, maybe the effect uses lightblend and it's not being set back... Currently I'm working on the editor and updating it to the latest version of wxWidgets which is taking me a while. I thought softkill is in there, I'll check that out... |
| ||
Hardkill and Softkill are now implemented. |
| ||
My money is still waiting for the final Monkey release. I'm hoping to be able to use it with Playniax's Ignition framework. |
| ||
Final monkey release ? What do you mean. |
| ||
Ha. That could be read in a number of ways :) I meant the final release of the Monkey module for Timeline FX. |
| ||
Oh! yeah lol Sorry i though you was waiting after the monkey final release of monkey. :) Offcourse i am also waiting for this so i can buy the software this will be really useful for my project. Can't wait! |
| ||
@peterigz Thanks for the Hardkill / Softkill thats great. Sorry for late reply I missed your post. |
| ||
Please help me with this example. I bought TimelineFX and MonkeyX Studio. TimelineFX is a great tool! And now I try this example http://www.rigzsoft.co.uk/monkey-library-for-timelinefx/ - it is likely to be a problem in English, but I can not run :-) I'am sorry... Thank you in advance! I did: 1. Folder timeline. 2. In folder timeline I have folder timeline.data and file timeline.monkey (the file is this example) 3. I download diddy module and I joined this modul into other modules 4. I did export effect from TimelineFX (ZIP) 5. The entire ZIP file, I extracted into folder timeline.data And still I got the error :/ Type 'DiddyStack' not found What am I doing wrong please? screenshot error: If I download diddy default (from this website: https://code.google.com/archive/p/diddy/wikis/HowToInstall.wiki ), then will compile OK, but error is in browser. screenshot error: |
| ||
It looks like Diddy is not found. Make sure the diddy and threading folders are in the root of modules and not for example : modules\diddyhg\src If you have studio then Ignition is also installed. Maybe you can try importing the TimeLineFX module that comes with Ignition. Just import it at the top of your code: Import playniax.ignitionx.timelinefx.layer And remove the 'default' timeline fx import. |
| ||
Thank you Playniax! I tried it, and still nothing. I have this code now: 'The minimum we need to import is mojo and of course timelinefx! Import mojo Import diddy 'Import timelinefx Import playniax.ignitionx.timelinefx.layer 'Create a simple Monky App Class Class FXexample Extends App 'Create some fields to store an effects libray, effect, and a particle manager. Field MyEffects:tlEffectsLibrary Field MyEffect:tlEffect Field MyParticleManager:tlParticleManager 'In the OnCreate method you can load your effects 'library and set up the particle manager. Method OnCreate() 'load the effects file. See the docs on LoadEffects on how to 'prepare an effects library for use in monkey. MyEffects = LoadEffects("timeline") 'Use GetEffect, to retrieve an effect from the library. MyEffect = MyEffects.GetEffect("explosions") 'create a particle manager to manage all the effects and particles MyParticleManager = CreateParticleManager(5000) 'Set the number of times per second that you want the particles to 'be updated. Best to set this to the UpdateRate SetUpdateFrequency(30) 'Let the Particle manager know the screen size MyParticleManager.SetScreenSize(DeviceWidth(), DeviceHeight()) 'Set the origin so that we can use mouse coords to place effects on screen MyParticleManager.SetOrigin(DeviceWidth() / 2, DeviceHeight() / 2) 'Mojo update rate SetUpdateRate 30 End 'Use the OnUpdate method to update the particle manager Method OnUpdate() 'lets create an effect everytime the mouse is clicked If MouseHit 'Copy the effect *Important! Dont just add an effect directly from the 'library, make a copy of it first* Local tempeffect:tlEffect = CopyEffect(MyEffect, MyParticleManager) 'Position the effect where we want it tempeffect.SetPosition(MouseX, MouseY) 'Add the effect to the particle manager MyParticleManager.AddEffect(tempeffect) tempeffect.SetZ(1) EndIf 'Update the particle manager MyParticleManager.Update() End 'Use the OnRender method to render all particles Method OnRender() Cls 'draw the particles MyParticleManager.DrawParticles() End End Function Main() New FXexample End And output is this: I suspect this line: MyEffect = MyEffects.GetEffect("explosions") What have I in the folder 'explosions'? I have this folder empty. |
| ||
Can you test the ignitionx\bananas\playniax\ignitionx\e06_experimental\e03_timelinefx\e01_timelinefxlayer.monkey example that comes with Ignition X and see if it works? |
| ||
It seems that I don't have this file in my PC. I have just folder 'playniax' and in this folder is folder 'ignitionx' and there is this structure: |
| ||
That is weird, you are missing a lot of files. Does the docs say what version of Ignition you have? Also did you check for the latest updates? You can contact Ziggy ( jungle ide support ) about this. I will do a clean install of Studio tommorow to have a look. Btw, we are getting a bit side tracked cause TimeLineFX should work without Ignition etc. all you need is the runtime lib from TimeLineFX. Contact TimeLineFX support about this. |
| ||
Thanks Playniax! I installed this version (this is my account). Maybe, I'll try to reinstall the product Monkey X-Studio :( |
| ||
Well, I have one more observation :) In the folder 'modules' is folder 'timelinefx' and there is 'examples' and 'ParticleManager.monkey'. If I run this file, all is OK. In folder 'ParticleManager.data' are 'data.xml' and PNG files... This is output: But now. If I export my own effect from TimeLineFX, everything is the same. I UNZIP EFF file. Just I rewrite files in folder 'ParticleManager.data'. And it does not work. This is output: Sorry for my English, I hope it is understandable ;-) |
| ||
hmm, probably best to contact the guy from TimeLineFX... |