Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

What does GameFiber class exactly means?

Featured Replies

I'm not  a native "english-user"

So I cant understand what does GameFiber exactly means and how does it works.

I saw it many times in conversation parts, and I wonder why 

GameFiber.yield(100); or GameFiber.sleep(1000); exists..........

 

Can I have specific introduction bout dat?

  • Management Team
3 hours ago, Lit'Wayne said:

I'm not  a native "english-user"

So I cant understand what does GameFiber exactly means and how does it works.

I saw it many times in conversation parts, and I wonder why 

GameFiber.yield(100); or GameFiber.sleep(1000); exists..........

 

Can I have specific introduction bout dat?

 

A GameFiber is essentially its own thread. Now, why is this important? While GTA V ticks scripts one at a time (so no benefit for multiple threads here), it allows you to use the commands you already mentioned. You can spawn a new GameFiber, have it do something and then wait for 5 seconds before doing something else. This will not interrupt any other fiber or game code and RAGE Plugin Hook will automatically resume the waiting fiber after 5 seconds for you and it will continue execution. So whenever you deal with operations that need to wait or handle blocking resources, using a GameFiber might be a good idea.

 

A word of caution though: For LSPDFR itself we have largely moved away from having many fibers like we used to in previous versions. The reason being that the code is less predictable since the order in which fibers will execute is more or less random and other plugin fibers might run in between. To save resources we like to do a few things only once per tick, which would not be possible if we used many fibers. For instance, at the start of the tick, we invalidate all entities that no longer exist and remove their internal tasks etc. This means that tasks down the road do not have to worry about running on a non-existent entity, saving us some call time as well. If we used fibers for everything like we did before, we would always have to double check. So while fibers provide a lot of benefits and are generally quite lightweight, for large scale projects they can cause more harm than good and should be used with caution.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

1 hour ago, LMS said:

 

A GameFiber is essentially its own thread. Now, why is this important? While GTA V ticks scripts one at a time (so no benefit for multiple threads here), it allows you to use the commands you already mentioned. You can spawn a new GameFiber, have it do something and then wait for 5 seconds before doing something else. This will not interrupt any other fiber or game code and RAGE Plugin Hook will automatically resume the waiting fiber after 5 seconds for you and it will continue execution. So whenever you deal with operations that need to wait or handle blocking resources, using a GameFiber might be a good idea.

 

A word of caution though: For LSPDFR itself we have largely moved away from having many fibers like we used to in previous versions. The reason being that the code is less predictable since the order in which fibers will execute is more or less random and other plugin fibers might run in between. To save resources we like to do a few things only once per tick, which would not be possible if we used many fibers. For instance, at the start of the tick, we invalidate all entities that no longer exist and remove their internal tasks etc. This means that tasks down the road do not have to worry about running on a non-existent entity, saving us some call time as well. If we used fibers for everything like we did before, we would always have to double check. So while fibers provide a lot of benefits and are generally quite lightweight, for large scale projects they can cause more harm than good and should be used with caution.

Tune in tomorrow as LMS solves world hunger and climate change.

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...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.