Jump to content

When should I start a new GameFiber?


minipunch

Recommended Posts

After looking at other releases, as well as many other examples I am still confused on when exactly I should be starting a new GameFiber? Is it only when you are going to use the GameFiber.Sleep() command? I am curious if starting a new GameFiber would help prevent my plugins from crashing?

Can someone clear this up for me?

Much appreciated,

minipunch :thumbsup:

Link to comment
Share on other sites

Basically, any time you do anything which takes any time to process, you need a game fiber. Otherwise it freezes up the game because nothing else can run while that code is executing if it's not in a separate fiber. So, if you have any kind of while or for loop, if you have any kind of task that you're waiting to complete, any time you want to sleep, etc. 

It's generally good practice to have most of your code in a game fiber so it doesn't freeze up the main game. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

On 12/04/2016 at 10:51 AM, ainesophaur said:

I'm curious if there are any "dont's" when using a game fiber.. Such as don't start a fiber within a fiber. 

 

I haven't noticed any adverse effects to over using fibers.. But Ive only developed things I need.

I think it just depends on the hardware.

Dispatch we are Code 4. Show me 10-8.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...