The RPG Maker Resource Kit

Other Game Creation => Program Troubleshooting => Topic started by: Xenomic on September 14, 2011, 03:56:43 AM

Title: Lagging [2K3]
Post by: Xenomic on September 14, 2011, 03:56:43 AM
So, I decided to try my hand at making my own crafting system. I have everything set up and it seems to work perfectly...save for the game lagging hardcore. Note, I used one variable for EVERY item in the game, and have it set in a Common Event as a Parallel Process (no switch trigger) so that it constantly checks how many of each item is available. Is there a way to reduce the lag given? I tried putting in "Wait: 0.0 sec", which helps in some areas, but other areas still lag badly. Or should I just make it check each time the player enters the crafting shop? (Note, I have not done this with the equipment yet, so that's even more to add to the list, so this is roughly about 500-1000 variables being checked at once at the same time. I don't know how to mitigate the problem at all...x_x;; )
Title: Re: Lagging [2K3]
Post by: LoganF on September 14, 2011, 06:04:39 AM
Quote
Or should I just make it check each time the player enters the crafting shop?

I would expect this to help contain the lagging to when the player is crafting, but then the lag will kick in as soon as you set the script running.

Without knowing exactly how you've designed your crafting system, I'm not really sure how to help. Are you using some kind of custom menu system? Or perhaps just checking what particular items the player could make given his inventory? Or something else?

A little more info would be helpful, but I'd say a CMS based approach would definitely be a start as you can do all the setting up for the craft before running a check (which is where the lag would kick in but it's not a real issue here) to see what item(s) can be made from the ingredients provided - if you're not already doing that.
Title: Re: Lagging [2K3]
Post by: Xenomic on September 14, 2011, 06:12:02 AM
This is my first time doing a crafting system (I've never tried a CMS before...as I'm not THAT advanced ^^; ). The coding I'm using for the crafting is as follows:


(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi187.photobucket.com%2Falbums%2Fx308%2FXenomic%2FScreenshots%2Funtitled1.png&hash=d4a2b7d4d128449e07058632ac262973c3ceb25c)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi187.photobucket.com%2Falbums%2Fx308%2FXenomic%2FScreenshots%2Funtitled2.png&hash=4084259840018e3ac608a16d17125784fdbf8248)



That's just testing it with one craftable item (I just repeat that for each one, and have a custom handler for canceling to end the event processing. I did try with the switch option, and yeah it does lag that part hardcore (but at least it keeps the rest of the game from lagging). Sadly, I'mma have to repeat this for each different kind of character/items too, which may take a while in itself since I know nothing of CMS making x_x
Title: Re: Lagging [2K3]
Post by: LoganF on September 14, 2011, 09:54:01 AM
Maybe now is a good time to learn something new?

You don't have to go overly crazy with the CMS idea. I know it looks pretty daunting to start with, especially if you look to other peoples' creations first. The hardest part is probably in the presentation rather than the actual system itself.

Rather than having a common event check through the entire inventory list and assign individual variables for individual items, you could just have enough variables to cover the maximum number of items possible in any given synth/craft - probably four or five - and assign them only for the items you need at that time.

So after the Divine Red-White choice has been selected just before you print the message showing how many items the player has/needs, you would have your variables assigned:


: [Divine Red-White] Handler
 <> Variable Oper: [0001: Item 1] Set, Item 1 Possessed
 <> Variable Oper: [0002: Item 2] Set, Item 2 Possessed
 <> Variable Oper: [0003: Item 3] Set, Item 3 Possessed
 <> Variable Oper: [0004: Item 4] Set, Item 4 Possessed
 <> Message: ...
 <> Show Choices: Craft/Cancel
etc etc

You'd also want to take out that switch in line 1.

I've attached a screenshot of what I mean. I'd put it on photobucket but I can't be bothered to figure out my log in details.

Whilst it does mean a fair bit more work on your part, it's easier than making a CMS and won't have anywhere near as much lag as running a parallel process to assign however many variables you have items for. You'd also reduce the number of variables you need for this down to a handful which is far more easier to work with than having to look through pages of them to find the right items.

It's been a while since I really used 2k3 since I converted to VX after seeing how much easier it is to script things using the included scripting tools.
Title: Re: Lagging [2K3]
Post by: Xenomic on September 14, 2011, 07:11:59 PM
Man...I was thinking of doing it this way originally too lol. But yeah, this works a lot easier than the other way, that's for sure. I may look into CMS stuff later (perhaps to update my game to be more unique than it is, I always like doing that), though that'll be for much later methinks. I do appreciate your help on this, makes things so much better.

I did think of using VX for this project when I started, but I wasn't fond of trying to script everything myself back then x_x;;