Multiplayer, kd-trees and water


Multiplayer will be in the form of a downloadable server which will broadcast its ip to the main server when it starts up.
Players will see your server on, click “join game” and the game will launch as usual, connecting to your server. Multiplayer will probably be up to 32 players.
Technically what’s going on behind the scenes is that each downloaded server will run a very very tiny http server that does nothing more than provide an html page with the game applet on it. This gives the applet permission to connect to that ip adress, and multiplayer becomes possible. Combine this with some fancy framing, and it will all appear to happen on a single central web page.

Huge levels

I added the ability to select the level size when creating a level. Be warned that huge levels really are huuuge and will require quite powerful pcs to play well.
To battle this, I put in some more work on the rendering, switching the entire system from a naive O(N) solution to a much nicer O(log N). My first attempt was to use a kd tree, but that turned out to be extremely inefficient since it only split nodes into two children. Adapting it to a nice octtree gave some nice effects.
Small levels run ever so slightly slower now because of the overhead, but culling on huge levels is faster than before.
I also fiddled with the fog parameters to make short view distances look better. Unfortunately, it doesn’t really work too well on the transitions between lit and shadow tiles. :D

Faster flowing water

The old water system was based on chance. Water tiles had a certain percentage chance of polling each game tick, so a single tile of water could take ages to spread. This behavior is fine for more chaotic things like grass growth and fire spread, but water really should just rush in as soon as it can.
So I made it do so. :D (see video in next post)

posted 14 years ago