SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > SRB2 Discussion > Bug Reports

Reply
 
Thread Tools Search this Thread
Old 07-19-2018   #1
choalover
Just a random person
Default Dedicated Servers Aren't Included in Player List Iteration

For some odd reason, the dedicated server is not included when you iterate the player list by using for player in players.iterate. I originally thought the MapChange and ThinkFrame hooks aren't executing in dedicated servers, but then I tested local variables outside of for player in players.iterate, and the hooks worked perfectly fine, but player is nil if I attempt to use any player variables outside of for player in players.iterate, since player is undefined in the MapChange and ThinkFrame hooks.

Original Version of Thread:
Spoiler:
If you are using the dedicated server, then the MapChange and ThinkFrame hooks never execute; as a result, player.empiralMP is nil for the dedicated server, and it is causing Lua errors. I found this out when I didn't see any messages being printed involving the pre-init, init, and post-init stages for EmpiralMP on the dedicated server's side. I do not know if this is intentional or a bug with SRB2. On integrated servers and clients, there are no Lua errors at all.
__________________
EmpiralMP v1.1.4 Official Thread: https://mb.srb2.org/showthread.php?t=43548

Last edited by choalover; 07-19-2018 at 02:49 AM.
choalover is offline   Reply With Quote
Old 07-19-2018   #2
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Are you absolutely sure that ThinkFrame doesn't run at all for dedicated servers? If it did then a lot of scripts would be breaking in dedicated mode I'd imagine.

No idea about MapChange though, that has issues of its own even outside of dedicated servers IIRC.
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record. Also, it's pronounced "Yes-tin".
Monster Iestyn is offline   Reply With Quote
Old 07-19-2018   #3
choalover
Just a random person
Default

Quote:
Originally Posted by Monster Iestyn View Post
Are you absolutely sure that ThinkFrame doesn't run at all for dedicated servers? If it did then a lot of scripts would be breaking in dedicated mode I'd imagine.

No idea about MapChange though, that has issues of its own even outside of dedicated servers IIRC.
I need to do some more testing.

---------- Post added at 09:41 PM ---------- Previous post was at 09:28 PM ----------

Update: Sorry to double post, but ThinkFrame, and MapChange do in fact work on dedicated servers; the real issue is that dedicated servers are not included when the player list is iterated through for some reason.
__________________
EmpiralMP v1.1.4 Official Thread: https://mb.srb2.org/showthread.php?t=43548
choalover is offline   Reply With Quote
Old 07-19-2018   #4
Lach
hop
 
Lach's Avatar
Default

Pretty sure that is intentional—for many common scripts, it would be a waste to constantly iterate through a player slot that doesn't have any actual in-game presence. If you need to access the player_t struct of the dedicated server, I believe the global Lua variable server points to it. https://wiki.srb2.org/wiki/Lua/Global_variables
Lach is offline   Reply With Quote
Old 07-19-2018   #5
choalover
Just a random person
Default

Quote:
Originally Posted by Lach View Post
Pretty sure that is intentional—for many common scripts, it would be a waste to constantly iterate through a player slot that doesn't have any actual in-game presence. If you need to access the player_t struct of the dedicated server, I believe the global Lua variable server points to it. https://wiki.srb2.org/wiki/Lua/Global_variables
Thanks. I will go ahead and fix that before working on multiple home support.

Sent from my LGL62VL using ********
__________________
EmpiralMP v1.1.4 Official Thread: https://mb.srb2.org/showthread.php?t=43548
choalover is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:54 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.