Skip to main content

Posts

Showing posts from April, 2017

Using MessagePack to transfer data between a Unity cleint and Go server

So this took me a lot longer than it should have. GoLang Vmihailenco's library is my favorite at the moment for GoLang. It's one line to encode and one line to decode. I simply create a struct to get the packet's Id and then a struct for the input. I'm just doing this to prepare for any other data coming into the server. //GetPacketID Get's the packet id from a packet type GetPacketID struct {     ID int } //InputPacket Get's input data from packet type InputPacket struct {     ID int     X int     Y int     entity *Entity } This now allows me to marshal data like this: n, addr, err := conn.ReadFromUDP(buf) CheckError(err) //deseralize var pID GetPacketID err = msgpack.Unmarshal(buf[:n], &pID) and unmarshal it like this: var statePacket StatePacket b, err := msgpack.Marshal(statePacket) CheckError(err) You can probably see why I like this library so much. One line serialization a

It's 1:28 AM and I have two midterms tomorrow

My name is Zac Holland and I'm a student at University of Denver. For the past few years I have been trying to figure out how to create an MMO using Unity and GO. I have gone through a ridiculous amount of versions that ultimately got trashed. Through trial and error, I think this iteration will be the best and most efficient version. First of all, let me catch you up. Server: All I have is a simple authoritative server that will receive movement data, adjust the entity, and report the game state back to the user. Client: The client is basically just displaying information. It will receive a game state about 20 times a second and adjust each entity accordingly. Note: Every post will be linked to a specific commit in each repo. I'll link to the source of each commit at the bottom or something. These first commits don't have much though. Like at all, there is really no difference. Repos Client Server