Wednesday, August 20, 2008

Drasil Tech - Chat Compression

Drasil Tech.
Welcome to the first post of a section I will call 'Drasil Tech' where we'll explore some technical feature of Drasil.

As an introduction, I will point out that drasil is based on an increasingly heavily modified version of the vbGore engine - but is quickly beginning to look like it's own unique platform as myself and Tyler (another programmer) re-write entire sections of the engine to fit the needs of Drasil or to optimize performance or stability.

vbGore is a Visual Basic 6 based game engine, and as such Drasil is primary written in VB6. However, some performance intensive parts of the game are being ported to C++ (esspeciall server side) and integrated as DLLs, to take advantage of C++'s superior performance.

Saving Bandwidth - vbGore's engine does a great job of minimizing bandwidth right out of the box by using an optimized binary based datastream protocal. There was however, still room for improvment. For starters a lot of strings (text) are sent from the server during game-play - Player names, Item names, Quest info, NPC chat dialog, Descriptions of game elements or players, Mailbox messages, the MOTD, and of course chat text shared between users. If we want to have the ability to have global chat, we might end up quickly running up the bandwidth meter / causing network performance issues on the game server if people start to actively engage in chat. Thus, I designed a compression scheme that is not only fast, but is designed specifically to compress strings of English text using a common dictionary that will be built in to the client. Now our NPC messages and global (shout) chat don't have to cause potentially lag-inducing spikes in bandwidth. See a screenshot demonstrating a test of the compression algorithm at work:


Demonstrating compression of example MOTD text - 37 bytes may not seem like much but it adds up when these types of strings are being passed to and from the server many times per second to many different users.

No comments: