SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing

Reply
 
Thread Tools Search this Thread
Old 04-16-2017   #1
Kitoko
The hedgehog goes THKTHKTHK
 
Kitoko's Avatar
Default Client-Side Scripting Cannot Exist

I have taken a dabble at trying to create something unique, a client-side game inside the HUD hook known as Tetris. It wasn't fun (or easy) and involved hopping through hoops just to set it up, but here's my experience, and why I am upset at SRB2 for this.

Making the game itself was the easy part, despite Tetris being a full and complete game in its own. It took me a while because it is a game in itself, but writing the script for it was as native to me as bread and butter; A couple hours of writing and bug testing later, and it worked. This is definitely something I have to give credit to SRB2 for, as it'll let you do some truly unorthodox things and get away with it and trust your judgement.

Getting the game to run on its own without any help from the main game state was a little more difficult, because I had to make a token system to ensure one player isn't using another's board, using commands and states to help it link back to the actual game when the user finishes a round of Tetris. Making it send to a high-score board was just for fun.

As soon as I started testing this in netgames, this is where it all went downhill. Players could spectate others and completely break their own board or reset it and even play with other's playfields (though it was more like take their current state and use your pieces) so that made me tear my hair out for a little while, having to try and go out of my way to set up a "verification" method (that is still not perfect and breakable but works for the average citizen) to ensure that the local player was the local player, and that when they spectate another user, the game knows about it.

Then, came one of the greatest enemies of all, the lag. Oh man , the lag. I knew something was totally wrong with how HUD worked for me when I found my controls repeating over and over when the server encountered lag. This was thankfully easily solvable, but not without the side effect of dropping inputs which I was not very happy with and still am. The fact that the network game can actually have an backlash impact on the HUD was absolutely trivial, but oh yes it did.

Finally, to top it all off, after all the work and effort I put into this, I go to join a friend who was hosting this script, and found that despite all my efforts, control lag still had effect and man did this upset me. Apparently (to little surprise) the HUD hook requires an update to its state for some reason meaning that my controls were simply being piped in from the player object itself, meaning that my controls were not client-sided and never will be. I guess I shouldn't be too surprised since the warning shot was the lag impacting the controls itself, but eh.

At this point I've just given up. I can't get SRB2 to perform some sort of menu or HUD without waiting on the server. I don't know what to do now since I have a lot of ideas that revolve around being able to do something on the localized player state.
__________________
Forgive lest ye not be forgiven.
Kitoko is offline   Reply With Quote
Old 04-18-2017   #2
Prime 2.0
Grape flavored
Administrator
 
Prime 2.0's Avatar
Default

Oof, I read this and it feels like the time years ago when I discovered A_FindTarget and such didn't take Z space into account and that pointythink only rotated the spikeballs a quarter circle. Having a solid week of research into hacking together a second badnik for ATZ go up in smoke like that was agony.

Lua moved the line of where that kind of thing happens, but it hasn't changed that running in to a hard limitation sucks. Since it's the netcode though, it's... not much of a surprise, to be honest. Sorry to hear that, regardless.
__________________
Science tells us that nothing can be proven, only rendered more likely to be true. If we do not question what we already know, how can we know, much less admit, when we're wrong? Such things are vital to progress.

Last edited by Prime 2.0; 04-18-2017 at 03:52 AM.
Prime 2.0 is online now   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 10:54 PM.


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