glua / gm_voxelate

A module for voxel support in Garry's Mod
https://glua.io
Other
21 stars 3 forks source link

Networking Discussion #24

Closed MDFL64 closed 7 years ago

MDFL64 commented 7 years ago

Old Version

What Needs Changing

New Version

Terminology:

Process:

SwadicalRag commented 7 years ago

Every tick, send up 2kb (maybe a little more) worth of compressed chunks.

we can do better (i've started on this locally)

SwadicalRag commented 7 years ago

Chunks are sent in order

this will save like 12 bytes per chunk since chunk order is implied, I can see the benefit. Very well, we can add this to the VoxelWorldInit channel

MDFL64 commented 7 years ago

Affirmative. I'm willing to bet a lot of the overhead was from dumping that data into Lua and then shoving it back into source's networking garbage, which I'm sure is even more jank under the hood.

Also I wouldn't keep sending them in order. Order is a little more subjective with huge worlds that you can't see all of.

SwadicalRag commented 7 years ago

Do as little shit in Lua as possible. Sending configs still fair game because serializing config struct would be an even bigger shitshow.

I'm willing to bet a lot of the overhead was from dumping that data into Lua and then shoving it back into source's networking garbage

I doubt using Lua for networking would put us at a disadvantage at this stage, since we're mostly using a single c-function to send the packet data and, optionally, a C-based bitbuffer to construct the data

It's still possible to send networking data from c++ (receiving from c++ is unimplemented still) but why bother really

MDFL64 commented 7 years ago

Alright, I'm cool with it as long as we can avoid dumping the chunk data into the lua state, because that seems like a bad idea in general.

MDFL64 commented 7 years ago

I've update my post with my attempts to understand what's going on, as well as my dumbass opinions.

SwadicalRag commented 7 years ago

Okay I'm neck deep in shit right now but I mostly agree with what your said. The init channel was only a test to see what I could do with this system and its totally optional to use the oop version of channels. (Just register the channel in shared and use router: Listen)

tbh OOP is appropriate at places, maybe just not channels? There's little overhead in using OOP anyway

Enet had its own channel which I used to separate c++ and Lua networking

SwadicalRag commented 7 years ago

There's a separate Lua version cause we have debug hotloading

SwadicalRag commented 7 years ago

I reckon just boot the client if it gives us a shit puid or disconnects from enet

MDFL64 commented 7 years ago

Okay, I'm going to make some more minor modifications to the branch and on gm_f1atgrass until I get things working.

SwadicalRag commented 7 years ago

Ook I'll be available later tonight to help out

MDFL64 commented 7 years ago

I've gotten some things working on my end. Physics work, but rendering doesn't as chunks are not networked right now.

Will push my changes in a minute.

MDFL64 commented 7 years ago

dims-in-blocks branch in testbed has updated code.

MDFL64 commented 7 years ago

There's still a lot of shit I want to fix/improve/remove/simplify, but I've had enough for the time being. Might get back to it later tonight, or tomorrow after my last test.

Note that there -may- be a crash bug hiding somewhere, but when I attached a debugger to try and find it I was unsuccessful.

MDFL64 commented 7 years ago

Doing stuff.

SwadicalRag commented 7 years ago

done