Update and Discord implementation to the server | Week 2


Monday ~ Tuesday - Two Days off

I took the day off on these two days since I have other things to do under these two days that was more important that working on Fat Valley. But got back to working on it after these days.

Wednesday - Smooth Movement and Server Crashes.

I stated to look into smooth movement and and started to work on the new Input system. I changed the whole input system since the old one didn't support multiple inputs at the same time. But now with the new system now it checks for input every tick the server runs on and do the responding to the input to specific key in the players update code on the server. I have currently set the server tick rate to 128 Tick which means the the server will go trough every players update on the server and update their inputs and stats. Its works by taking 1000 / TICK_RATE and you get how many times the server will update every information that server have to every client that is connected to the server. Therefore with higher tick rate the server has the smoother the movement on the clients. Check Screenshot here on smooth movement. But with 128 tick and maybe have 100 clients connected will make the server performance less efficient and take up more power therefore when a game build comes out I will set the default tick rate 128. But if my game ever become "popular" I'm going to lower the tick-rate to 96 and if I need to go lower it will be 64 tick (its smooth but can notice server lag more). But in the future there a always opportunities to make it better.

Thursday - Crashes and New Server Command Systems.

I was looking up a error on the server tick rate system that I shouldn't have gotten. Then my visual studio project started crashing without giving me a error message. I later noticed that my code that check if the server has anything to do else it should sleep until next update but the code after a while. The error was that it was returning less than 0 and if it does it will sleep forever. I sat the whole day trying to find another way to solve this issue but I couldn't find any. After a long time debugging I decided to just not care about that for now. Its not that important at the moment since I haven't released the game yet and therefore when I'm just testing the game locally and with friends there is not much performance that is lost there. But in the 1.0.0 build of the server I will have fixed this issue and will give more CPU usage for other tasks. I also tested out a new system to run commands on the server without typing it in the server console and the new system is Discord. For now I have just tested on how to set a position to the player and send that new information the all clients and sets new position on the server. Everything console command that existed in the console has now been moved to the new discord system. Take a look on how it works here. Of course I have set a restriction to every command and only listen to some users on discord. I will change this system in the future so if I open a discord server in the future you can get a link key in-game so you link you discord account to you Fat Valley account to run commands on discord server for example you can claim a in-game daily bonus via a command. I will talk more about this new system and how I will make it in a future post. But that its what have been working on this day. Later this day I asked the a friend how I could bypass this error I got with the Thread to sleep until next update without changing the code and we make it work without crashing. It just skips that sleep code if its gets the error and continuing the code.

Friday - Fixing the Username

Today I finally fixed the username not showing. Check out that here. It was an easy thing to fix since I already had some of the code already made. Since syncing the name isn't so hard as other things I have done. Then I did some tweaking to the discord commands system to now support username and clients id to get the server to do something to the client. Check out it here. I also added a secret server command for the bot to test in my game testing builds. Now when I am done with this week I will start to work more on the server sided physics. Since just pushing that away will have some extra delay since that is really needed to have server sided authority over a player. I don't know where to start but I will find a way even if it takes a long time. At the current time posting this Unity3d have some problems on their end and giving a error in the editor and crashes when starting the play mode and I am unable to work on Fat Valley.

Thanks for reading my Dev Log for Week 19

Every Screenshot in this post in order:

GIF of Smooth Movement sync
GIF of Discord Commands
GIF of Fixed Username
GIF of New Discord support

Leave a comment

Log in with itch.io to leave a comment.