I tried compressing the data sent between server and client. Tried Java's built in ZLib implementation, with Deflater and Inflater, and it was a huge pain and neither I nor my friend could get it to work right. Moved on to Java's GZIPStreams, and I got those working - except they come with a major performance hit if I use them right now. So, I'm gonna leave that code in but not use it yet. For the moment, I'm back to trying to figure out this run length encoding interval tree thing:
Well, I'm working on optimizing data sent. I implemented rate limiting for data sent between client and server, and learned in the process that the server sends WAAAAY to much data to the client, atm. It's mostly chunk data - so, I need to figure out how to store less chunk data. I reimplemented HomogenousChunks, from earlier, and datagrams for them, and that helps a bit - but it's still way to much data. So, I need to look into Run Length Encoding or KD Trees, or something. :/
Still working on tests, trying out Checker Framework. While testing the thing, I also spotted a ton of what I think are T-Junction errors - single pixels with nothing drawn on them. Gonna have to figure out what to do about those later. :/
Alright, I can send block type and some chunk data via datagrams! Super laggy and eventually locks up though, so I must have made a mistake somewhere. Gonna write some more tests next, I think. XD
Alright, next step is to write the code to compose and process datagrams. Things have been going pretty well so far, though I don;t have anything to make cool screenshots out of. :/
Well, I have the data about as disentangled as I can get it for the moment - now I just need to write the code for the client and server to talk to each other. Still gonna put off netcode, but a friend recommended I stuff everything into ByteChannels for sending it back and forth, so I'm going to look into that. XD
Not sure how to go about it though. Do I just make 'client connection' and 'server connection' classes, and make it so that whenever the client or the server want something from the other, they have to ask their connection for it? :/
Alright, wrote a ton of tests and refactored a bunch of code. Currently working on the architecture for client and server to communicate. Not netcode yet, but I want to have things arranged such that I have a neat little place to *put* the netcode once I get to it.
I've structured my packages into client/server/common. Still have to finish writing tests, refactoring, and then rewrite the code to actually respect that split. XD
Still writing tests, and doing lots of refactoring. Once I have a comprehensive test suite and I'm happy with my smaller refactors, I'm going to work on fully splitting the client and the server, though I'm not going to implement any netcode just yet. Then, back to optimizing world generation, I think. XD
Been writing tests all day. Already dug out one long standing bug and fixed it, and have been finding all sorts of places where the behavior wasn't quite what I wanted it to be, though not usually in a way that mattered. XD
I should clarify, for the above two posts, I'm talking about sky lighting, not point lighting - I only do about 24+ times as much block lighting as minecraft does. :P
Add to that that my diagonal channels probably take even more compute than vertical ones do, and that the scaling on that 8 times as many blocks per volume is probably even greater due to the greater number of propagations between blocks, and it's no wonder the thing lags. I'm going to clean up the code some and write tests, and then see about getting really good at profiling, optimizing, and the like, and if that isn't enough, maybe I'll ditch the diagonal lighting channels. :/
Alright, fixed weird synch errors in worldgen. Worldgen is still slower and laggier than I'd like it to be, though, on account of lighting, because I'm effectively trying to do 40+ times as much lighting as minecraft does - I have 5 lighting channels, and I have 8 times as many blocks per volume as minecraft does.
Split the server off into it's own thread - seems to work fine? Gonna move some of the chunk generation there, instead of in dedicated chunk gen threads. Think I can remove the sync problems that way without making anything lag. XD
Alright, I have tests, though they only work on the maven branch. Still working on lighting propagation - it works way better now, but it's still a little laggy, and if I use multiple threads I get issues. :/
Currently working on adding tests, and I added a branch of the project that uses Maven, so it should be slightly easier for other people to jump in and work on the thing if they want to. After I have some decent tests, I'm going to go back to working on light propagation, it's mostly decent but it gets funky for chunks past x or z -1, for whatever reason. :/
Still working on this, making progress though. Discovered I had north and south backwards, so, ooops? The fix was surprisingly painless for having gotten one of the fundamental axes of the universe backwards, though. XD
Spent all day trying to untangle code and optimize lighting propagation. Drove me up the fucking wall for a bit, but I think I have it sorted out now, at least for the moment. XD