Server/Squirrel Update Released (March 1)

Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128
Server/Squirrel Update Released (March 1)
« on March 1st, 2016, 10:56 PM »Last edited
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

  • VC:MP Beta Tester
  • LU-DM Team
  • Posts: 390

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 809

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

Retired VC:MP Player/Scripter :P

Murdock

  • LU Beta Tester
  • Posts: 236

Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
.

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 809
Re: Server/Squirrel Update Released (March 1)
« Reply #6, on March 2nd, 2016, 12:06 AM »Last edited on March 2nd, 2016, 12:11 AM
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

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128
Re: Server/Squirrel Update Released (March 1)
« Reply #7, on March 2nd, 2016, 12:11 AM »Last edited on March 2nd, 2016, 12:20 AM
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.

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Server/Squirrel Update Released (March 1)
« Reply #8, on March 2nd, 2016, 12:14 AM »
Quote from Kusanagi on March 2nd, 2016, 12:06 AM
yea 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

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128
Re: Server/Squirrel Update Released (March 1)
« Reply #9, on March 2nd, 2016, 12:16 AM »
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.

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Server/Squirrel Update Released (March 1)
« Reply #11, on March 2nd, 2016, 12:40 AM »Last edited on March 2nd, 2016, 12:43 AM
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.
.

Doom_Kill3R

  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,107
Re: Server/Squirrel Update Released (March 1)
« Reply #12, on March 2nd, 2016, 03:21 AM »Last edited on March 2nd, 2016, 03:36 AM
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

  • LU Beta Tester
  • Posts: 236

Doom_Kill3R

  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,107
Re: Server/Squirrel Update Released (March 1)
« Reply #14, on March 2nd, 2016, 05:47 AM »
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.