Author Topic: Lag spikes when using VCE with relays  (Read 1263 times)

I am trying to develop a working power system for my ship on Blockland using relays to add variable-based measurements of "power" to my ship's power supply. However, for some reason, every time the relay is sent for the ship's core to add more power, the game gets a serious FPS drop. I can't figure out why. No console errors whatsoever. It's really weird.
Any way I could fix this?

How do you expect anyone to be able to do anything if you don't post the events?

sorry, didn't think of that.

here you go


It's best to use VCE-stateFunction and VCE-callFunction instead of relays. You can also use callFunction to call a relay on each client, instead of per brick. (useful for spells, effects, etc)

Here is an example:


Every 1 second, 100 HEAT and POWER are added to the CORE brick. No lag spikes :)

The best part about VCE functions is that you can call them from a named brick, which means
you can basically do VCE_ifVariable on a named brick by calling it's stated function

why exactly is that better though? it looks way more complicated. will it help reduce the lag spikes?

Also, I need to use relays. These events have to happen between different bricks.

why exactly is that better though? it looks way more complicated. will it help reduce the lag spikes?
http://forum.blockland.us/index.php?topic=108369.0
Scroll down and look at functions

Quote
When you find yourself in need of using multiple relays,
   you normally would have to make another brick for another relay. Well that is no more!

   With VCE Functions, you can have up to 17,340 functions on ONE brick!

Also, I need to use relays. These events have to happen between different bricks.
You could just use 2 different VCE functions on one brick, or use 2 bricks each with their own function

that's not answering his question
will it reduce lag

that's not answering his question
will it reduce lag
Yes. VCE doesn't like to use relays, and relays are already limited as it is.
I tested these events on my server before posting the pic.
It added the vars smoothly every second, not even the slightest bit of lag

Try it yourself,
happy eventing!

can i just use onvariable update and modvariable between different bricks to mimic relays?

Are you sure you don't have a loop somewhere in your events?

they're designed to loop.

they're designed to loop.
Exactly. I just showed you the proper way to do it with a VCE function. Using a function isn't much different from calling a regular if statement, except that you can call it on other bricks and make it relay without lag. If all else fails you could always try VCE_castRelay, but I haven't messed around with it much and it's part of the "VCE experimental" package so use it at your own risk.

Did you try the events I posted earlier?

Using modvariable and onvariableupdate to mimic relays fixed the problem instead. I no longer get the FPS drop.