Server/Squirrel Update Released (March 1)

Started by Stormeus, Mar 01, 2016, 10:56 PM

Previous topic - Next topic

Stormeus

An update for VC:MP 0.4 (04rel003) servers has been released.
  • Added the ability to play sounds that follow players as they play.
  • Fixed a crash that would occur if redirecting all players on a server to a different server.

Windows Server (x86)
Windows Server (x64)
Linux Server (x86)
Linux Server (x64)



An update for Squirrel has also been released:
  • Added PlaySoundForPlayer(player, soundID) and PlaySoundForWorld(worldID, soundID)
  • Added player.PlaySound(soundID), which is identical to the PlaySoundForPlayer function in behavior

Updated binaries are available on the download page for the Squirrel plugin:
https://bitbucket.org/stormeus/0.4-squirrel/downloads

rww

Squirrel Plugin is f**ked. 5 errors on 5 seconds...
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

MacTavish

ahh @Stormeus you didn't told anything about this


Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Murdock

I'm getting errors that the RGB class doesn't exist

Stormeus


.

#5
Quote from: Stormeus on Mar 01, 2016, 11:49 PMLooking into this.

Shomehow the class ended up with the name cRGB instead of RGB.
.

MacTavish

#6
yea changing RGB to cRGB solves the trouble.

everything works fine now but when when minimize game windows and again open then sound stops

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Stormeus

#7
There were a lot of sweeping changes that haven't been thoroughly reviewed, which is my bad. I suspected something was up when I pulled the changes and print functionality was broken. I'm reverting everything that I haven't personally reviewed.

.

Quote from: Kusanagi on Mar 02, 2016, 12:06 AMyea changing RGB to cRGB solves the trouble

Don't worry. You'll find a few more down the line. I can guarantee you that. There's a particular issue with Sqrat that will make you scratch your head with some of the weirdest and random errors you'll see. I'm just waiting to see if they appear in the current implementation. I've wasted a good amount of time trying to figure it out. And all it takes is a single macro define to avoid that broken part of Sqrat. Which even improves performance by removing a few table look-ups on each function call.
.

Stormeus

Yeah, the wonkiness of Sqrat mixed with the ridiculousness of the things that need to be done in Squirrel here can result in functionality breaking like this, which is mostly why I started a rewrite of the Squirrel plugin. I haven't had the opportunity to finish it, though, and that's something I'd like to revisit.

Stormeus

@rwwpl @Kusanagi @Murdock Builds should be fixed now, redownload from Bitbucket.

.

#11
The particular issue that I'm talking is that if for some reason, there's an error inside a method. Sqrat will erase that error. Replace it with a generic "Unknown error has occurred" message. Then throw that error instead and complain that the certain type where the method was called wasn't registered. This results in some of the most random and weird errors you've seen.

By default Sqrat uses an element from the registry table to see if an error occurred. It's pretty much a clone of how Squirrel deals with it's exceptions except worse. Especially in therms of performance. Why? That element is actually a pointer of "new std::string()" with each thrown message and even when you retrieve the error message it involves copying the string and deleting the old one. So yeah, that's one issue. BUT, on each function call Sqrat clears the old error (1 table search). Then attempts to retrieve the specified instance and checks to see if and error occurred (2 table searches). If it does then it clears the error (3 table searches) and throw's that generic message (4 table searches) or does an assert(0) on debug builds and return to VM. And that's only if it fails to find your instance.

After doing that you reach the argument retrieval stage. Again, clear the existing message (useless in this case since you just did it before). Then obtains the arguments and again checks for errors and clears/retrieves it and throws it again to squirrel VM. After doing this you reach the function call. And again, clear existing errors (which is again useless because you just did it before) and call the function/check for errors and clear/retrieve it. And throw it again to squirrel VM.

Overall you have about ~4-6 table searches on each function call plus the searches that squirrel does for the error it receives. So yeah, not very optimal.

At this point you have two options to fix this shenanigan. 1) Disable error checking completely by defining SCRAT_NO_ERROR_CHECKING. I wouldn't recommend that. 2) Use exceptions instead by defining SCRAT_USE_EXCEPTIONS and throwing a Sqrat::Exception to indicate an error during the code. Which removes all table look-ups and forces an immediate return to squirrel.

At least that does fix the issue with the weird "unknown error has occurred" issue, which I'm sure some of you have encountered it.
.

DizzasTeR

#12
It was really satisfactory to get this feature quickly, the only thing leaving it from being perfect is to allow PlaySound functions (or make a seperate one) to 'stream' certain music files from hosts just like SAMP or MTA:SA does.

:edit: Tested the above functions, heard no sounds, nothing at all. Neither PlaySoundForPlayer played anything nor PlaySoundForWorld did anything. Same goes for player.PlaySound too. Using the old PlaySound function with vectors played the sound of same ID which I used to test the new functions.

Murdock

@Doom_Kill3R did you update your client? They all work fine for me

DizzasTeR

The client 'Failed to rename' error poped up and by manually renaming it didn't resolve it. Reinstalled VCMP as administrator and it works now.