Vice City: Multiplayer

News & Announcements => Server & Plugin Updates => Topic started by: Stormeus on March 1st, 2016, 10:56 PM

Title: Server/Squirrel Update Released (March 1)
Post by: Stormeus on March 1st, 2016, 10:56 PM
An update for VC:MP 0.4 (04rel003) servers has been released.

Windows Server (x86)(https://v04.vc-mp.org/server/VCMP04_server_v16_win32.zip)
Windows Server (x64)(https://v04.vc-mp.org/server/VCMP04_server_v16_win64.zip)
Linux Server (x86)(https://v04.vc-mp.org/server/VCMP04_server_v16_linux32.zip)
Linux Server (x64)(https://v04.vc-mp.org/server/VCMP04_server_v16_linux64.zip)



An update for Squirrel has also been released:

Updated binaries are available on the download page for the Squirrel plugin:
https://bitbucket.org/stormeus/0.4-squirrel/downloads
Title: Re: Server/Squirrel Update Released (March 1)
Post by: rww on March 1st, 2016, 11:42 PM
Squirrel Plugin is f**ked. 5 errors on 5 seconds...
Title: Re: Server/Squirrel Update Released (March 1)
Post by: MacTavish on March 1st, 2016, 11:44 PM
ahh @Stormeus you didn't told anything about this

(http://i67.tinypic.com/o5c7bs.jpg)
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Murdock on March 1st, 2016, 11:46 PM
I'm getting errors that the RGB class doesn't exist
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Stormeus on March 1st, 2016, 11:49 PM
Looking into this.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: . on March 1st, 2016, 11:57 PM
Quote from Stormeus on March 1st, 2016, 11:49 PM
Looking into this.
Shomehow(https://bitbucket.org/stormeus/0.4-squirrel/src/ab45f61ee85d49a84afe05a128444f2caa120899/UtilStructs.cpp?fileviewer=file-view-default#UtilStructs.cpp-367) the class ended up with the name cRGB instead of RGB.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: MacTavish on March 2nd, 2016, 12:06 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
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Stormeus on March 2nd, 2016, 12:11 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.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: . 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.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Stormeus 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.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Stormeus on March 2nd, 2016, 12:23 AM
@rwwpl @Kusanagi @Murdock Builds should be fixed now, redownload from Bitbucket.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: . on March 2nd, 2016, 12:40 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.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Doom_Kill3R on March 2nd, 2016, 03:21 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.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Murdock on March 2nd, 2016, 04:23 AM
@Doom_Kill3R did you update your client? They all work fine for me
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Doom_Kill3R 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.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: ysc3839 on March 2nd, 2016, 03:17 PM
I noticed that you revert the "Fix print issue" commit made by me. Have you tested if the old code works well? I tested in old version, when you print more than 512 chars, the server won't crash immediately, but the stack is broken and maybe crash later. I will test it again on weekend(because I only can use computer on weekends)
Title: Re: Server/Squirrel Update Released (March 1)
Post by: Stormeus on March 2nd, 2016, 05:05 PM
The print issue fix was reverted because it only measured the length of the format string, which resulted in error messages being cut off.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: KAKAN on March 2nd, 2016, 05:30 PM
What about the sockets anyways? Fix the bugs of the Sockets plugin too, please!
And also, I can't open the server's download link, any mirrors?
Title: Re: Server/Squirrel Update Released (March 1)
Post by: ysc3839 on March 3rd, 2016, 04:46 AM
Quote from Stormeus on March 2nd, 2016, 05:05 PM
The print issue fix was reverted because it only measured the length of the format string, which resulted in error messages being cut off.
I'll try to fix it. :)
Title: Re: Server/Squirrel Update Released (March 1)
Post by: ysc3839 on March 3rd, 2016, 02:47 PM
Also I want to know why the CCore::rawprint uses fputs instead of functions->printf
Code: [Select]
void CCore::rawprint(const char * pszOutput)
{
fputs(pszOutput, stdout);
if (this->pLogFile != NULL)
fprintf(this->pLogFile, "%s", pszOutput);
}
Title: Re: Server/Squirrel Update Released (March 1)
Post by: ysc3839 on March 3rd, 2016, 05:46 PM
After searching Internet I found there's some difference between MSVC's snprintf and gcc's. We have been "tricked" by MS. >:(
Title: Re: Server/Squirrel Update Released (March 1)
Post by: ysc3839 on March 5th, 2016, 01:03 PM
Tested on VS2013 and VS2015. I found that VS2013 doesn't have "snprintf" but have "_snprintf". However, VS2015 have both "snprintf" and "_snprintf". And it's "snprintf" functions like gcc's.

Also, the plugin still have print issue.

 :edit:Linux version doesn't have this issue.
Title: Re: Server/Squirrel Update Released (March 1)
Post by: ysc3839 on March 6th, 2016, 03:09 AM
I have made a pull-request(https://bitbucket.org/stormeus/0.4-squirrel/pull-requests/12/master). :)
Title: Re: Server/Squirrel Update Released (March 1)
Post by: kingofpopYT on May 2nd, 2016, 06:15 AM
can u tell how do i add sound system?
And where do i add this