Hi there again with newest update from our environment, from Leveland Studios. I'm so sorry for late devblog, but because I'm currently working for Leveland in my free time and I hadn't got any for writing a devblog, but I was working on the game. It'll be huge, so happy reading.
I was working with UNET system made by Unity Technologies, which I thought is the best option, because everything's embedded into Unity engine and it's easy to work with. But after few tests and so on, my happiness flew away. Tons of mistakes and other things, that were impossible for us to use. What's actually SyncVar?
According to Unity's Scripting API:
[SyncVar] is an attribute that can be put on member variables of NetworkBehaviour classes. These variables will have their values sychronized from the server to clients in the game that are in the ready state. Setting the value of a [SyncVar] marks it as dirty, so it will be sent to clients at the end of the current frame. Only simple values can be marked as [SyncVars]
The worst thing about SyncVars for LastWolves was, that it sends data at the end of current frame. Basically, in standard 60FPS game, it's each 16ms. But, we wanted to sync it wherever needed or between two frames, not at the end.
Old system:
[SyncVar(hook="SyncPlayerHealth")]
public int health = 100;
public void SyncPlayerHealth(int health){
this.health = health;
//Some GUI changes
}
So whenever the health changes, server syncs it with client. Hook is always running on client.
I replaced it with RPC. Let's take a look at syncing player's HP when damaged(It doesn't represent real implementation)
[Server]
void SyncPlayersHealth(int health){
this.health = health;
RpcSyncPlayersHealth(health);
}
[ClientRpc]
void RpcSyncPlayersHealth(int health){
this.health = health;
//Some GUI changes
}
Advantages:
First time in history, we've implemented Audio into game. For now, it's a piece of crap, but it'll be remade.
Due to copyright issues(we use free models as placeholders for our ones), we've removed old Quad and replaced it with our.
Woohoo! I'm really excited to introduce you aircraft. It's just in testing mode and it works only in the editor in singleplayer mode, but it works! Also, you can see what's your fuel status, altitude and so on. I would like to make it look like in real plane, almost a simulator. But you might say: What? It's a survival game, not a shitty simulator! No. It's just for the better game experience. It won't help you in your flight, it's just informational and you can fly the plane without looking at it.
Video:
The best tool ever! I was working on our ADMIN system you can control LastWolves server with. You can modify server config files, data files, permissions, use console, stop, restart and force stop server, also add new users into administration.
As a part of Server Admin, I've made RCON. For precise explanation, please visit wikipedia, but simple explanation is, that is Remote Console. So you can send and recieve commands via TCP/IP Sockets. From PHP, from mobile apps and so on. Because of optimizations, it just receives commands. You can read responses by reading from rcon file in server root directory for now.
The best thing ever! If you don't know what the heck Ragdoll actually is, visit wikipedia, i'm not an evil scientist. Simply, it's when you shot an enemy, it falls down like a doll when you drop it. Just translate it. What was the problem? Because our ragdoll system needs reference to Humanoid bodyparts and it was like(not an actual code) player.animator.GetBodyPartTransform(HumanoidBodyPart.leg) i just replaced it with simple Transform variables and manually added transform parts. No longer needed HUMANOID! Animating humanoid in Unity's Animation window is not possible or at least it won't work. Another challenge will be Mob Ragdoll.
Procedural terrain, that we were testing is good enough, but I decided, to make an infinite Voxel terrain. What does it means? You can destroy it. Mining like in Minecraft and other games(not copying it, just for illustration). We have some test terrain which is here, but now it's not implemented in actual game. Hope, it will become reality one day.
Yeah, the great improvements isn't just for players but also for the devs. Getting things organized or have an editor tools is beneficiary for us. So I decided to use "Platform dependent compilation"(Look at it in Unity's documentation) With that stuff, we can define, whether certain parts of script should be compiled or not. So in Player settings in Editor I wrote down NET_DISABLED and before the statement I wrote #if !NET_DISABLED(Which means if this phrase isn't set in editor, this part is active(is compiled), otherwise it's not compiled(inactive)) and at the end of statement I wrote #endif and use also #else or #else if. It's very useful, because I can test multiplayer code in singleplayer including animations and so on. Let me know, if you have better solution in comments down below. I'll really appreciate that.
Because anyone could connect to your server using sockets and send any commans he wanted, I implemented another file and that's rcon.apikey. It's the 20char long string using just numbers and uppercase letters(otherwise it won't work). Before any command sent, client must send this code for command to be processed. It enhances security and I hope, that no one will break it.
Yeah! I was playing game for about an hour to gather this resources and build a very small house. Of course, the recipe costs were too low.
If you have any questions, new ideas or game issues, feel free to contact us here:
Or email us at: [email protected]