mk48 icon indicating copy to clipboard operation
mk48 copied to clipboard

Mk48.io ship combat game

Mk48.io Game

Build Mk48.io Discord

Logo

Mk48.io is an online multiplayer naval combat game, in which you take command of a ship and sail your way to victory. Watch out for torpedoes!

Building

Tools

  1. Install Rust Nightly (install rustup, then rustup override set nightly-2022-06-15)
  2. Install NodeJS 14 or higher (here)

You may use any version of Rust that works, but we use some nightly features and nightly-2022-06-15 is known to work, whereas some newer versions produce internal compiler errors.

Client

  1. Enter /js
  2. npm install
  3. make
  4. Deploy the server to host the client

Server

  1. Enter /server
  2. make to build and run a test server
  3. Navigate to localhost:8080

Developing

If you follow the Building steps, you have a fully functioning game (could be used to host a private server). If your goal is to modify the game, you may want to read more :)

Entity data

Entities (ships, weapons, aircraft, collectibles, obstacles, decoys, etc.) are defined in data/entities-raw.json. This file is, however, preprocessed by node data/preprocess.mjs into js/src/data/entities.json which is compiled into both the client and server. It comes with the repository, but must be reprocessed if the raw data is changed.

Entity textures

Each entity type must be accompanied by a texture of the same name in the spritesheet, which comes with the repository. If entity textures need to be changed, see instructions in the sprite_sheet_packer directory.

Engine

Both client and server rely on our custom game engine (which is present in the engine directory).

Admin interface (optional)

One notable feature of the engine is an (optional) admin interface. To build it:

  1. Enter /engine/js
  2. make
  3. Deploy the server to host the admin interface
  4. Go to localhost:8080/admin
  5. Paste the contents of engine/game_server/src/auth.txt, generated randomly by a build script, into the alert dialog

Macros

Many macros are utilized by the codebase. Mk48-specific macros can be found in the macros directory, and game engine macros can be found in the engine/engine_macros directory. A few notable macros are:

  • Mk48 entity loader (generates EntityData for all entity types, used by both client and server)
  • Game engine audio loader (generates Audio enum for client, with a variant per sound)
  • Game engine settings (generates Javascript bindings for settings structs)
  • Game engine renderer layer (for composable rendering layers)

Contributing

See Contributing Wiki page.