![]() Five games will soon drop out of the service across Xbox Game Pass and PC Game Pass, including My Friend. They both have their advantages and either might be more ‘correct’ depending on the circumstance and when your code needs to run. The first slate of games leaving Game Pass in May has now been revealed. You could still compensate for lag with his method too, it just wouldn’t be so straightforward. His answer would run the code every 60th frame regardless of lag, a while loop with a task.wait(60) would run the code approximately every 60 seconds and the task.wait would return the exact time it waited for so you could compensate for lag. In this circumstance it doesn’t matter a huge amount which approach you take. That’s what loops are made for.Įvent-based programming is more like what the solution to that thread was. In this circumstance where your code is triggering itself every time it finishes, it is better to use a loop (vs what you mentioned in the original post on that thread you linked). It might take a while especially if you have a pause of some kind in there, but eventually you’ll get an error Maximum event re-entrancy depth exceeded The Changed event is protected against infinite loops. If you’ve got a while true do with a single definitive break in it, just use while condition do I use while loops all the time, sometimes it’s just the tool for the job. Looking for great games You will find them on GameHouse Try any game free or get unlimited access to all the games you love from your favorite genres. The result is a completely unpredictable competitive online experience that gets bigger and even wilder with every new season. If you need a while loop because an event doesn’t exist for what you need, then use a while loop. Grab all of your friends and drop into Epic Games Fortnite, a massive 100-player face-off that combines looting, crafting, shootouts and chaos. Events don’t sit in a cycle wasting resources until the condition is met. ![]() An event just exists and does nothing until it’s called. That costs a small amount of performance. The loop will run every frame or however often you specify and it will run a calculation each time. There’s no reason to make a loop that just waits for a condition to be true when there’s an event that does the same thing. However, higher level languages like Lua benefit from event-driven programming, and that is what you should prefer. They don’t cause performance problems when code needs to be repeated. There is nothing fundamentally wrong with while loops, and if you ever work with a systems language that’s about all you’ll be using. Discover the universe of Life is Strange: award-winning narrative adventure games from Square Enix, developed by Deck Nine Games and DONTNOD Entertainment.
0 Comments
Leave a Reply. |