Git Product home page Git Product logo

softbearstudios / mk48 Goto Github PK

View Code? Open in Web Editor NEW
305.0 305.0 58.0 301.85 MB

Mk48.io ship combat game

Home Page: https://mk48.io

License: GNU Affero General Public License v3.0

Makefile 0.15% HTML 0.54% JavaScript 1.26% Svelte 2.02% GLSL 1.18% Rust 94.80% CSS 0.04%
boat browser-game combat game game-server multiplayer rust rust-lang ship web-game webassembly webgl webgl-game yew yew-framework

mk48's Introduction

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 rustup (see instructions here)
  2. Install Rust Nightly (rustup override set nightly-2022-08-14)
  3. Add WebAssembly target (rustup target add wasm32-unknown-unknown)
  4. Install trunk (cargo install --locked trunk, install gcc first if it complains about missing cc)
  5. Optionally, install the make command

You may use any version of Rust that works, but only nightly-2022-08-14 is known to be compatible.

Client

  1. Enter /client
  2. make or, equivalently, trunk build --release
  3. Deploy the server to host the client

Server

  1. Enter /server
  2. make to build and run a test server
  3. Navigate to localhost:8081 (or whatever port is printed in the console)

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 at the bottom of common/src/entity/_type.rs.

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. Install NodeJS 14 or higher (here)
  2. Enter /engine/js
  3. make
  4. Deploy the server to host the admin interface
  5. Go to localhost:8081/admin/
  6. 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.

Trademark

Mk48.io is a trademark of Softbear, Inc.

mk48's People

Contributors

caibear avatar finnbear avatar plally avatar rs-v avatar sheumais avatar thatretrodev avatar xenohim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mk48's Issues

Farming Teammates

New spawned players can be killed for 5-10 crates plus their score. This allows for farming of them if they keep re-spawning. A solution I came up with to not spawn many crates if they haven't been alive very long.

Ability to save score

Requirements:

  • Players cannot exploit to instantly withdraw from a battle
  • Saved scores do not give an unfair leaderboard advantage
  • Only the player who saved the score should be able to restore it
  • Saved scores should only be able to be restored once

Stop button/key

Otherwise too hard to stop with keyboard controls.

Suggested by: jake

Invite Code Features

If invite code is pasted in chat it's formatted nicely and just joins team without opening new tab.
Joining with a code bypasses requesting and won't fail even if len(members) + len(requesting) > 6.

Crash: incrementSelection

u.incrementSelection is undefined at index.svelte-fe06ee2d.js:1:59205
undefined has no properties at index.svelte-fe06ee2d.js:1:59205

Reported by: ๐Ÿ”ป

Team chat

Teams should be able to talk in private

WebRTC client

In addition to WebSockets, should support WebRTC, because the server sends complete updates and it doesn't matter if the transport is unreliable.

Ability to switch ships when max level

Every 500-1000 points, should get the ability to change to any ship (no more health/weapons though)

I'm not necessarily concerned with which ship you can turn into (it should be of equal to or lower level). My concerns are mainly about when you are allowed to change ships. It absolutely cannot become a strategy to escape battles, and I don't really want everyone playing giant slow ships and switching to small fast ships whenever they want to move around the map. When you upgrade/switch to a ship, you will need to commit to using it for a while (for now, "a while" is forever or until your next upgrade. It could be acceptable to reduce "a while" to ~10 minutes or until your next upgrade). I also still have to evaluate whether it would be better to add this feature on its own, or tie it to some new building/base.

Suggested by +, iulik among others.

Privacy policy

We don't sell user data, or collect much of it, for that matter. However, this needs to be clearly stated in a privacy policy.

Ship horns

Suggested by: jake, Carlsons1938, and Iron Shrimp

Game modes

Ideas:

  • Arcade/casual vs. realistic/pro
  • FFA vs. teams (suggested by 8151382425 among others)
  • Freeplay vs. Conquest (suggested by Cris)
  • Large 50/50 team battle (suggested by Admiral)
  • No points required to upgrade (Hang)
  • Domination: start as Skipjack and capture majority of 5 points (Suggested by Type)
  • Capture the flag (suggested by SS NERO)
  • Base wars (suggested by SS NERO)
  • Peaceful/sandbox mode (suggested by Jake)
  • Classic, WW2, Modern etc. (suggested by Capt Grey)
  • Pearl Harbor / Carriers vs. Battleships (suggested by Awesome)
  • 1v1 (suggested by Camo)

Capture zones

Circular zones randomly spawn. Players/teams can remain in them for some time to capture them. Captured zones generate points for the player/team.

Code duplication

Utility functions for math and time are duplicated by many packages in server. Code duplication needs to be reduced.

Minimap

Suggested by: Player3611 and Teeth Showing Mortality

Electronic warfare

  • Could potentially jam inbound, radar guided weapons
  • Could appear on radar/sonar as different type of ship

Suggested by: u/whittileaks

  • EMP pulse: disables steering, shooting, flying, etc. nearby/within a time limit.

Suggested by anonymous

Ram

Ram ships are immune from ramming damage and deal more ramming damage to their opponent.

Suggested by: ๐Ÿ”ป

Server optimizations

World

  • Sector contains an array of entities and a slice/sector pointer for more. (better locality)
  • Player has "pointer" to entity. (remove entity ID to entity mapping)
  • Shrink entity struct. (better locality and less memory)

Hub

  • Clients doubly linked list to other clients. (remove client mapping)
  • Shrink Client structs. (less memory)
  • Player has pointer to team. (faster to lookup)
  • Player doubly linked list to other players in team. (probably not worth it)

Inbound/Outbound

  • Team members and requesting copy on write. (less garbage)
  • Pool inbound messages such as manual. (less garbage)
  • Iterate world to find players rather than iterating players. (better locality)
  • Send damage instead of health as it can be omitted more often (crates)

Marshaling

  • Call Stream.Flush less often during marshaling. (up to 15% CPU improvement)
  • Custom float marshaling with less precision. (less network and possibly faster)
  • Terrain compression encoding changes. (less network)
  • Compress packets. (less network but more CPU)

Test

Describe your feature request

Additional context

Controls

  • Arrow keys / WASD because many people assume that's how you move and are confused and several have asked for it.
  • Tip that tells you controls and can be closed
  • More tips for each new weapon type

mk48io.com

Domain has been registered, must be configured.

High Performance Particles

There are currently only wake particles that are created on the client behind boats. The particles are updated in JS and aren't very fast (~500/ns per update on my computer). This limits the amount of particles that we can spawn and also impacts frame rate on lower end devices. If we can reach at least 100/ns per particle update I think it will meet our goals.

Proposed solutions:

  1. Optimize the update code on the CPU by using Web Assembly.
  2. Rewrite the particles to be only updated on the GPU with a vertex shader.
  3. Reduce the number of particles based on computer specs/frame rate.

Once the particles have high enough performance we can add more effects such as smoke/fire.

Turning Slowdown

If direction target is greater than 90 degrees from direction, slow down ship to turn faster.
The only alternative for players is to move mouse to center which is tedious.

Upgrading during battle

Players often upgrade their ship while in battle to refresh their health and armaments. I don't think this should be a viable strategy as it allows new players to more easily kill top players, because top players can only do it once. I recommend health percentage staying the same after upgrade at a minimum, and maybe armament percentage should too.

Naming inconsistencies

  • 8_8cmSKC35 and 38cmSKC34 contain unit cm, bl6MkXXIII doesn't list unit in
  • MTB upper case, sam lower case
  • heli is abbreviated but sumarine isn't

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.