WazMeister Posted June 15, 2023 Share Posted June 15, 2023 Hello, I bought LeadWerks on steam beginning of week, finally sat down tonight to play around and learn. Reading the help documentation, referencing Script:UpdateWorld() it states it should be called once in Main Game Loop. Running through the marble tutorial, I've already noticed we've called it several times for individual objects. i.e the Ball, now the coin to spin it... So what exactly does it do specific for objects, and why not call it once in a main game loop.. where that may be (as assuming there is not one with scripts added to entities etc?! Many in advance for all your assitance. W Quote Dream since child of making games! From Game Programming Starter Kit 3.0, Blitz Basic, Map Creation since Duke 3D, Game Maker, Blitz3D (of recent..2023) and many other engines and years..... never really sticking to it with inner struggles that I've had to fight along with pushing to learn and acheive. 40 years old.. came across Leadwerks on Steam... Learning slowly but surely and loving it! Learn with me or just watch me fail! at my random Youtube Channel, as I stream adhoc while learning and using LeadWerks and other game creating tools. https://www.youtube.com/@wazmeister3151/featured Link to comment Share on other sites More sharing options...
Josh Posted June 16, 2023 Share Posted June 16, 2023 All the different script functions called Update() all get automatically called when the main script calls World:Update(). Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution WazMeister Posted June 16, 2023 Author Solution Share Posted June 16, 2023 Thanks Josh. OK. So why does the tutorial ask us to put world update in scripts for specfici objects and not in a main script? Quote Dream since child of making games! From Game Programming Starter Kit 3.0, Blitz Basic, Map Creation since Duke 3D, Game Maker, Blitz3D (of recent..2023) and many other engines and years..... never really sticking to it with inner struggles that I've had to fight along with pushing to learn and acheive. 40 years old.. came across Leadwerks on Steam... Learning slowly but surely and loving it! Learn with me or just watch me fail! at my random Youtube Channel, as I stream adhoc while learning and using LeadWerks and other game creating tools. https://www.youtube.com/@wazmeister3151/featured Link to comment Share on other sites More sharing options...
Josh Posted June 16, 2023 Share Posted June 16, 2023 Because you are writing code just for one object with attached scripts. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
WazMeister Posted June 16, 2023 Author Share Posted June 16, 2023 Thanks again Josh, very kind to assist. I'm still not getting it. I understand that on other languages I'd have at end UpdateWorld(), RenderWorld() etc at end of main game loop. The Lua Leadworks tutorials go through add scripts to objects and adding UpdateWorld() script to some of them to update them.... but the API Documents say only add one to the Main game Loop. What I don't understand is. a) Where is main game loop in Lua / Leadwrks Engine to add or edit UpdateWorld? Why has the tutorial not asked us to add a main game loop? b)why does the tutorial add updateworld to each object / script? Or.. is it a case each script tied to an object is like it's own 'programme / code' and it needs it's own UpdateWorld() because it's in it's self a main game loop but for each script added to an object? If that makes sense... or am I looking at this totally wrong? Quote Dream since child of making games! From Game Programming Starter Kit 3.0, Blitz Basic, Map Creation since Duke 3D, Game Maker, Blitz3D (of recent..2023) and many other engines and years..... never really sticking to it with inner struggles that I've had to fight along with pushing to learn and acheive. 40 years old.. came across Leadwerks on Steam... Learning slowly but surely and loving it! Learn with me or just watch me fail! at my random Youtube Channel, as I stream adhoc while learning and using LeadWerks and other game creating tools. https://www.youtube.com/@wazmeister3151/featured Link to comment Share on other sites More sharing options...
Josh Posted June 16, 2023 Share Posted June 16, 2023 The main program is stored in main.lua. That file is available to edit, but you probably won't need to modify it. It normally just stays the same unless you are doing something special. Each script with an UpdateWorld function just handles updating of things related to that single entity. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted June 16, 2023 Share Posted June 16, 2023 Script:UpateWorld() is called during each world update, as opposed to Script:UpdatePhysics(), which is called each physics step. These two things can be different depending on the framerate. In Ultra, there is just a single Update() function in scripts. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
WazMeister Posted June 16, 2023 Author Share Posted June 16, 2023 11 minutes ago, Josh said: The main program is stored in main.lua. That file is available to edit, but you probably won't need to modify it. It normally just stays the same unless you are doing something special. Each script with an UpdateWorld function just handles updating of things related to that single entity. OH OK.. Now it's starting to make sense. Thank you. So if I removed the update world function from the Coin, for example it might now update it's spin or position etc? Quote Dream since child of making games! From Game Programming Starter Kit 3.0, Blitz Basic, Map Creation since Duke 3D, Game Maker, Blitz3D (of recent..2023) and many other engines and years..... never really sticking to it with inner struggles that I've had to fight along with pushing to learn and acheive. 40 years old.. came across Leadwerks on Steam... Learning slowly but surely and loving it! Learn with me or just watch me fail! at my random Youtube Channel, as I stream adhoc while learning and using LeadWerks and other game creating tools. https://www.youtube.com/@wazmeister3151/featured Link to comment Share on other sites More sharing options...
Josh Posted June 16, 2023 Share Posted June 16, 2023 Yes, correct. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.