Problem with effect
Home › Forums › TimelineFX Module › Problem with effect
- This topic has 7 replies, 2 voices, and was last updated 6 years, 7 months ago by peterigz.
-
AuthorPosts
-
April 5, 2018 at 4:43 am #6472
wookie22ParticipantHello,
I have effect called “slow_smoke” (last in attached library). Problem is that it works in editor but not works in my game (nothing shows). It will show when I set GlobalAmount to some higher value using eff.SetAmount(1) but I need lower amount.
I’m using Bmax vanilla with newest TimelineFX libs
Could you take a look?
https://drive.google.com/open?id=18EVr5tDVmdEaBqS_ySVGenvBsuagpea8
- This topic was modified 6 years, 8 months ago by wookie22.
April 6, 2018 at 6:50 pm #6474
peterigzKeymasterHi, I’ll try and look at this, currently my Blitzmax doesn’t seem to be compiling so once I’ve sorted that I’ll take a look at it.
April 6, 2018 at 7:14 pm #6475
wookie22ParticipantOK, I’m looking forward to get some fix 🙂
April 10, 2018 at 1:54 am #6476
wookie22ParticipantHello – did you managed to check that bug? I will be very grateful. By the way – will you be at EGX Rezzed London because I will be there ? 🙂
- This reply was modified 6 years, 8 months ago by wookie22.
April 11, 2018 at 8:37 pm #6478
peterigzKeymasterHi, sorry for the delay, I finally managed to get Blitzmax working again! I loaded the effect in the sample program that comes with the documentation and it seems to play ok. Is there anything in your code that might be causing the effect to play with less particles? Are you using “MyParticleManager.SetGlobalAmountScale(1)” anywhere perhaps with a lower number? If is the code I am using to test: (sorry about lack of formatting, the code box wasn’t working properly for some reason!
SuperStrict
Framework brl.max2d
Import rigz.timelinefx
Import rigz.tweener
Import brl.glmax2dSetGraphicsDriver GLMax2DDriver()
‘Load the effects library
Local MyEffectsLib:tlEffectsLibrary = LoadEffects(“effects/main_lib2.eff”, False)
‘Create an effect and assign it an effect from the library
Local MyEffect:tlEffect = MyEffectsLib.GetEffect(“slow_smoke”)
‘Create the particle manager to manage the particles
Local MyParticleManager:tlParticleManager = CreateParticleManager()Graphics (800, 600, 0)
‘These commands are important to set the origin of the particle manager. For this example we’re setting the origin so that
‘effects will be placed at screen coordinates. If you leave out the setorigin command then an effect created at 0,0 would
‘be placed at the center of the screen.
myparticlemanager.SetScreenSize(GraphicsWidth(), GraphicsHeight())
myparticlemanager.SetOrigin(GraphicsWidth() / 2, GraphicsHeight() / 2)
‘You can use the following command to control the number of particles spawned globally by the particle manager.
‘This is handy for slower PCs where you want to reduce the number of particles that are drawn overal. A setting of 0.5 would halve the
‘number spawned for example. 1 is the default value.
‘MyParticleManager.SetGlobalAmountScale(1)MyParticleManager.SetUpdateMode(tlUPDATE_MODE_INTERPOLATED)
‘This will make one frame equal 33 millisecs long – or 30 updates per second.
SetUpdateFrequency(30)‘Create a tweener using the tweener mod. Make sure its frequency matches that above
Local Tweener:tTweener = New tTweener.Create(30)‘Our main loop
While Not KeyDown(KEY_ESCAPE) Or AppTerminate()Cls
If MouseHit(1)
‘to create an effect you need to use the copyeffect command, and copy the MyEffect you created earlier.
‘You shouldn’t use MyEffect as it is the template
‘for which is used to create effects you draw on screen.
Local tempeffect:tlEffect = CopyEffect(myeffect, MyParticleManager)
‘Set the temp effect to the mouse coords
tempeffect.SetX(MouseX())
tempeffect.SetY(MouseY())
‘give it a random zoom level which will affect the overal size of the effect
tempeffect.SetZ(Rnd(0.5, 1.5))
‘add the effect to the particle manager. Important, otherwise the particle manager would have nothing to update
MyParticleManager.addeffect(tempeffect)
End If‘here is the timing code, update the tweener to get the number of ticks for this loop
Tweener.Update()For Local Ticks:Int = 1 To Tweener.FrameTicks
‘Update the execution time for the tweener
Tweener.UpdateExecutionTime()
‘Update the particle manager
MyParticleManager.Update()
Next‘and finally draw the particles.
MyParticleManager.DrawParticles(Tweener.Tween)SetRotation 0
SetScale 1, 1
SetAlpha 1
DrawText MyParticleManager.GetParticlesInUse(), 10, 10Flip 0
Wend
April 17, 2018 at 12:35 pm #6483
wookie22ParticipantHello,
I’m just back from EGX Rezzed and will investigate this (this is strange). Thank you!
May 13, 2018 at 11:14 pm #6498
wookie22ParticipantOK I found it! It was my fault!
I used ParticlesManager.SetIdleTimeLimit(5) – I’m not sure why, I wrote that line 3 years ago. Probably I thought that it will improve performance. After removing that line all works fine.
I have another question – I have many emitters set on huge level and they all “rendered” regardless they are on screen or not (and it consumes GPU power). Can I enable/disable effect rendering? I mean drawing only without stopping emitters?
Cheers
May 18, 2018 at 11:42 am #6506
peterigzKeymasterGlad you sorted it 🙂
Regarding rendering off screen, it should do this automatically, as long as you set the screen size in the particle manager (SetScreenSize). Any particles outside of this should not be rendered.
-
AuthorPosts
You must be logged in to reply to this topic.