Jump to: navigation, search

Technical Technologies Used

Cubiverse uses a few different technologies, but given that this is a world where everyone is using new any exciting technologies for back-end server work I decided to go with good old C++ (and a bit of Chrome V8 magic)...

Cubi is a classic client / server architecture, where clients connection to a central authoritative game server. Those clients are Javascript web applications that run in your browser, whilst the server is a C++ application with a database system storing the persistent world information.

One major improvement over most client / server games is that each server instance can execute multiple worlds at the same time, so the same server process will be able to handle multiple worlds all unique and separate (at least at the minute.. but who know, interconnecting certain world's may allow for MMORPG style games and world sharding).

Client

For the client I decided to use Javascript for the primary reason that the code would run anywhere a compliant web-browser was found, this opened up the game to the entire world at the cost of a few Megabytes per client (which actually adds up a little bit of money these days).

The JavaScript client is served to the web browser in an minimised obfuscated form, firstly to reduce bandwidth and secondly to offer some protection from casual JavaScript warriors (or hackers). Every time the Java-script it is received the contents are reordered and altered, the server tracks the obfuscation so that it can decode obfuscated json regardless of each clients "random" variables and objects. The server can also send down JavaScript to be eval()ed, this JavaScript allows Cubi to check for cheats (not yet implemented, honest...) and ensure the obfuscation is correct.

Server

Someone asked me why I didn't go with node.js seeing its a Javascript game... The only reason is down to speed, I knew I would be able to code a C++ game server far faster than learning and getting "good" enough at node.js for it to matter when things need scaled up. With C++ I can control threads, know memory management and easily stop run-away user JS code. Speaking about the JS code that runs on the server, I embedded Chrome's V8 Javascript engine (which was incredibly complex.. lots of C++ voodoo mixed with the volatile world of Javascript's scope and contexts).