Ship Combat Game

Overview Game


Logo 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!



  1. Install NodeJS 14 or higher
  2. Enter /client
  3. npm install
  4. make or npm run dev
  5. Navigate to http://localhost:3000


  1. Install go1.16 or higher
  2. Enter /server
  3. make
  4. Profile with make pprof and optionally specify seconds=<number> and/or profile=heap


See Contributing Wiki page.

  • Ship switching abused

    Ship switching abused

    Its pretty obvious that some players have figured out a way to switch between ships at will. Not just by saving a level and switching right before sinking to a larger ship, but switching several times in a row. I witnessed a switch from level 3 to level 4 warship to level 10 Nimitz to stop from being sunk by me. Not just one time but several times.

    Expected behavior

    You cannot switch period to stop a sinking. A timer should be set from last damage to prevent abuse of ship upgrading. Figure out how they are accessing the ship upgrade menu like that would also be a suggestion.

    If this is allowed, I would like to know how they do it.

    opened by mitm001 12
  • Shrink Entity Struct

    Shrink Entity Struct

    For the possibility of performance we can shrink the world.Entity struct to 32 bytes from 64 bytes (1/2 the size and still power of 2). The point of this issue is to discuss if we should implement this to test it or if the cons would outweigh any estimated pros.

    // The current struct (64 bytes):
    type Entity struct {
    	Transform                // 16 bytes (8 bytes pos + 4 bytes vel + 4 bytes dir)
    	Guidance                 // 8 bytes (4 bytes vel + 4 bytes dir)
    	EntityType               // 1 byte (eventually may be 2 bytes once entity count > 255)
    	Damage   float32         // 4 bytes
    	Distance float32         // 4 bytes
    	Lifespan float32         // 4 bytes
    	Owner    *Player         // 8 bytes
    	ext      unsafeExtension // 8 bytes
            // EntityID EntityID     // 4 bytes
            // _ [4]byte             // 4 bytes struct padding

    Required changes:

    • [x] Convert world.Angle from float32 to uint16 with 0 meaning 0.0 and 65535 being 2 Pi * 65535 / 65536.
    • [x] Move world.Extension (unsafeExtension) to world.Player.
    • [x] Move Entity.Damage to world.Extension.
    • [x] Remove Entity.Distance as it can be estimated from lifespan.
    • [x] Change lifespan and velocity(Target) to uint16 and int16 (Lifespan measured in 100/ms increments).
    // The new struct (32 bytes):
    type Entity struct {
    	Transform                // 12 bytes (8 bytes pos + 2 bytes vel + 2 bytes dir)
    	Guidance                 // 4 bytes (2 bytes vel + 2 bytes dir)
            Owner    *Player         // 8 bytes
    	EntityType               // 1 byte (eventually may be 2 bytes once entity count > 255)
    	Lifespan uint16          // 2 bytes
            // EntityID EntityID     // 4 bytes

    Possible Pros:

    • Entities use 1/2 the memory.
    • Better locality of reference for iterating entities (speculating ~5-10% performance improvement of world functions from previous optimization). *Angles can be added/subtracted together without expensive math32.Mod.
    • Allows us to do further optimizations with less copying like AOS vs SOA.


    • Player can't have more than 1 boat in the future (unless we make []Extension).
    • More complex math and marshaling for angles, velocities, and lifespans.
    • Entity.Distance() is just an estimate and may not be accurate.
    • If we want to add more fields we will need to be more creative in the future.

    Note that this is just an idea and may not be worth the added complexity.

    performance server 
    opened by caibear 10
  • Sub stealth

    Sub stealth

    I am not certain but either there is a bug in stealth or there is a trick I am missing.

    The issue is with one certain player they are never visible to me until my sub sinks. This happened half a dozen times last night. They would be almost within the sea wolf speed ring and I couldn't see them. This is with both of us not using sonar and with them using ships or subs. They can see me though as they are firing on me when we are 1 to 2 inches apart. Their torpedoes don't show red triangles either until the very last moment. He says its working that way for him against me also but he obviously sees me every time before I see them as they are firing on me first.

    One particular battle I attacked a destroyer close range at a dock, sinking it, I immediately attacked a sub right next to that ship, sinking it. I turned on sonar, saw nothing and surfaced. As soon as I surfaced, his ship turned visible, I was right at his bow but never saw them yet I was so close I could see docks without sonar, just not his ship.

    On another occasion, I had attacked a ship but as I was out of ammo so I decided to move under the ice around an large ice island and circle around to allow ammo to restore. This trip took about 45 seconds to a minute. The entire time I was doing this I kept seeing torpedoes appear without the red triangle every 10 seconds or so. I thought at first it was from the sea side being fired by others in a battle and it was just coincidence they were tracking on me. After about the fourth decoy, realized it was this same person chasing me the whole way. I only saw who it was after they were almost on top of me, which was weird as we both had the same sub yet they caught up to me and they could see me the whole time obviously as they were firing away.

    This same pattern repeated itself a few other times where I would never see their sub until after I was sunk. Even the torpedoes would stay masked until right before impact.

    You cannot defend against what you don't see so I figure there must be some trick to doing this type of strong stealth where they can fire away and I never even see them. I questioned them on this and they said they were using no sonar also and the sub itself was stealthy. Whats weird is I could see them perfectly fine half a screen away with a golf submarine. This makes no sense that a golf sub could see them but my sea wolfs vs sea wolfs couldn't.

    I can tell that others can see me when attacking without sonar a little over two inches away most ships as they start evasive maneuvers before I fire torpedoes.

    opened by mitm001 5
  • Game modes

    Game modes


    • 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)
    feature request 
    opened by finnbear 5
  • sub to ship switch

    sub to ship switch

    Looks like a new abuse is now happening. The latest is to attack with a sub and move towards target then switch to carrier if its obvious they are toast. The carrier is under water so you get sunk as it moves to surface. Second time today.

    Expected behavior would be make it so you must surface to switch from sub to ship.

    opened by mitm001 4
  • High Performance Particles

    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.

    performance client 
    opened by caibear 4
  • High level Sub torpedos too weak

    High level Sub torpedos too weak

    Sub torpedoes are to weak by about 15%. At higher levels a sub cannot defeat another ship by unleashing all its available payload into any other ship of the same level.

    I unloaded entire payload of Sea Wolf into a Nimitz and still had to follow up with 3 more torpedo's. Its even worse against the other ships with same level. Even the next lower level sub, unloading every weapon it has cannot sink a max level ship.

    Expected behavior

    There is no ship ever built that could sustain that many hits from an advanced torpedo or 10 missiles and remain floating. Its not physically possible.

    This unbalance means in one on one situations its nearly impossible to sink a max level ship with a sub. You will on almost every occasion be sunk with their counter attacks, which are way to powerful in their own right.

    I do succeed occasionally but it takes some stupid mistake on their part or catching them with low health for it to happen. If they don't panic and simply counter attack they win every battle.

    Tweaking the torpedoes so that firing a maxed out payload sinks any ship of the same level would be more appropriate. Evidently, others feel the same way as I have seen it discussed on the Radio.

    opened by mitm001 3
  • Recovering Sunken Ships

    Recovering Sunken Ships

    I think that being able to Recover Sunken Ships might be something great for Here's my (simple) idea on how that would work:

    • Sunken Ship gets Found and Recovered (Maybe using an item, or maybe using a Ship designed for Recovering other Ships)
    • Recovered Ship parts get collected (Maybe this could give the player XP points?)

    As for implementing it, I'm not sure about how the player would actually recover a sunken ship on the client-side but on the server-side sunken ships could be stored for a couple minutes to give other players time to recover the ships.

    feature request 
    opened by thatretrodev 3
  • Access extension of non-boat

    Access extension of non-boat

    panic: access extension of non-boat [recovered]
    panic: access extension of non-boat
    goroutine 44 [running]:*Hub).Run.func1()

    Crashed server today.

    bug server 
    opened by finnbear 3
  • Ship with single weapon deselected weapon

    Ship with single weapon deselected weapon

    Describe the bug

    1. Be G-5 (freshly logged in)
    2. Attack Zubr with both torpedoes (held down space)
    3. Zubr doesn't sink, waiting for reload
    4. Torpedoes reloaded (2/2)
    5. New torpedoes won't launch!

    I tried space, E, clicking, any launch angle - no luck. Browser console had nothing except FPS messages. Eventually noticed that the single entry in the weapon list left-bottom does not have a gray box around it! Clicked on it, it was selected and I was able to launch torpedoes again! For some reason it was deselected, even though I was not able to deselect it again manually neither by clicking or pressing tab. I cannot reliably reproduce it. Maybe it didn't like that I held down space all the time?

    This is admittedly a very minor bug, but might still be useful to have a reference

    Expected behavior

    Weapon is never deselected.

    Additional context (optional)

    Used Chromium Edge 91.0.864.48 directly in

    opened by Ohmugin 3
  • North ice pack and subs

    North ice pack and subs

    Subs need a way to discern more easily the terrain or whatever it is that sinks you up there when moving. Three times now I lost level 9 sea wolf to something invisible. The ice pack hides something, whatever it is and a high level sub should be able to detect it.

    Additional context

    bug duplicate feature request 
    opened by mitm001 2
  • Sprite Packer Issues

    Sprite Packer Issues

    Upon running the sprite packer file as listed in the (outdated) instructions, it gives two errors:

    error[E0063]: missing field `loop_start` in initializer of `AudioSprite`
       --> src/
    357 |             let sprite = AudioSprite {
        |                          ^^^^^^^^^^^ missing `loop_start`
    error[E0599]: no method named `log2` found for type `u32` in the current scope
       --> src/
    188 |         Box::new((min_size..=MAX_SIZE.log2()).into_iter().flat_map(|power| {
        |                                       ^^^^ help: there is an associated function with a similar name: `ilog2`

    It seems both the README and the files are over a year out of date.

    opened by Sheumais 1
  • Possible script error browser

    Possible script error browser

    The situation is that on occasion the game will lock you out from selecting buttons like upgrading ships.

    The two times I had it occur were over these last two days.

    Torpedoes and decoys also start acting funny like in my previous posts on the subject where my decoys get ignored but opponents become super duper strong as in way out of range and behind my sub nose yet torpedoes go right through opponent to them, they make extreme turns like U turns at point blank range, torpedoes lock onto target and then unlock and wander off into the world somewhere when no decoys or ships around or all but one torpedo or missile hits target and the last fired just goes through target. Even missiles are affected as in they may go opposite direction like 180 behind rather than forward.

    May be a script interfering not as in cheat script but like somethings running infinitely causing other scripts not to run.

    It takes a refresh to fix it.

    Other player reported he got word null when firing torpedoes. Not sure what that was on so I will ask him to clarify.

    Win 7, Firefox browser with private browsing and clear history settings on close.

    opened by mitm001 2
  • Destroyer stealth overpowered vs sub

    Destroyer stealth overpowered vs sub

    Subs cannot see a destroyer just on the other side of an oil rig or just past one sub length. Thats ridiculously overpowered. In real world, its exactly the opposite. No ship can easily detect a sub unless surfaced. To make an even bolder statement, there isn't a ship on the sea that can hide from sub detection ability much less survive a full payload being emptied into them, even from a diesel engine one.

    opened by mitm001 2
  • Rocket torpedo is totally worthless

    Rocket torpedo is totally worthless

    As the title states the rocket torpedo fails to even submerge 99% of the time.

    We are talking broadside on an Iowa or Nimitz and all it does is crash into the side, never submerges. distance seems to make 0 difference.

    They make no sense when aiming either. Its like they choose some random direction every time.

    They are already extremely weak as a weapon so why make them not even submerge?

    Ive spent literally HOURS trying to get them to work, no exaggeration.

    If there's some trick to them it needs to become more obvious because I have failed to figure it out and I tried everything I could to make them work. On surface and submerged.

    On occasion, whats extremely frustrating is they will ALL work, I mean they will all launch perfectly same direction, all submerge perfectly and all HIT the target. However there is absolutely no rhyme or reason they do work as its not repeatable.

    Fix them or give us something else as its very frustrating losing 10% of your firepower. I say 10% only because they are so weak even if all 4 hit it only equals a normal torpedo from a Sea Wolf.

    Edit: Subs take so dam long to reload we can't afford to lose even 10% of the firepower.

    opened by mitm001 4
  • Sub and exp suggestions

    Sub and exp suggestions

    1. Subs reload way to slow in comparison to ships. At minimum a 10 to 20 % boost in reload capabilities is called for. Ships regain fire power and health at a significantly faster pace due to being on the surface since chests boost health and float.
    2. All ships should collect exp based off each hit to the target and the amount of damage it does. I cant count the number of times I beat a high level ship down to almost sunk and someone else just one hits them for all the exp. Not to mention all the times you sink the ship and someone else sucks up all the chests. Especially when attacking a fleet. You sink their team mates and the fleet just gets stronger based off your efforts as they suck up all the chests for exp, health gains and quicker reloads. Theirs no logic in a fleets gaining strength from losing battles but that's what happens.

    Having each hit give exp based off damage done will distribute the exp fairly. This requires striping exp gain from chests which would also keep exp campers off the leader board as they would have to actually attack something to get exp.

    feature request 
    opened by mitm001 6
Softbear Studios
Softbear Studios
Arkanoid game in Go using Ebiten game engine with ECS.

Arkanoid-go Arkanoid game in Go using Ebiten game engine with ECS. You must have Git LFS installed when cloning the repository to download assets. See

null 55 Oct 9, 2022
AircraftWar - a game powered by Go+ spx game engine

AircraftWar - a game powered by Go+ spx game engine How to run Download Go+ and build it. See Download thi

GoPlus 1 Jan 5, 2022
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See Download this

GoPlus 3 Nov 6, 2022
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See Download this

GoPlus 3 Nov 6, 2022
MazePlay - a game powered by Go+ spx game engine

MazePlay - a game powered by Go+ spx game engine How to run Download Go+ and build it. See Download this g

GoPlus 1 Dec 16, 2021
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!

galactic-asteroid-belt Overview A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy! Run To run, you will need Go

null 0 Dec 2, 2021
RundQuiz-Game - This is a Go exercise that implements and builds a quiz game from a list of math questions in a CSV file.

Go RundQuiz Game Exercise details This exercise is broken into two parts to help simplify the process of explaining it as well as to make it easier to

IkehAkinyemi 0 Jan 5, 2022
Simple 2D game to teach myself various things about game development and ECS, etc

2d-grass-game I really don't know what to name this game. Its a big grass field, and its in 2d so....2D Grass game This is a simple 2D game to teach m

James Wynne III 1 Jan 17, 2022
A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Hajime Hoshi 7.6k Dec 28, 2022
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Engo 1.6k Dec 26, 2022
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

G3N - Go 3D Game Engine Repositories 2.2k Jan 9, 2023
A Game Server Skeleton in golang.

A game server skeleton implemented with golang. 注意(NOTICE) 欢迎加入QQ群: 459420581 (Gopher成都,讨论一切与go有关的话题) gonet/2 gonet1已停止维护(I no longer maintain this, p

xtaci 1.2k Dec 26, 2022
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Nan Lin 2.3k Dec 25, 2022
A game server framework in Go (golang)

Leaf A pragmatic game server framework in Go (golang). Features Extremely easy to use Reliable Multicore support Modularity Community QQ 群:376389675 D

Name5566 4.7k Jan 2, 2023
Lightweight, facility, high performance golang based game server framework

Nano Nano is an easy to use, fast, lightweight game server networking library for Go. It provides a core network architecture and a series of tools an

Lonng 2.2k Jan 1, 2023
A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Oakmound Studio 1.3k Jan 8, 2023
Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.

pitaya Pitaya is an simple, fast and lightweight game server framework with clustering support and client libraries for iOS, Android, Unity and others

TFG Co 1.6k Jan 2, 2023
A hand-crafted 2D game library in Go

Pixel A hand-crafted 2D game library in Go. Take a look into the features to see what it can do. go get If you are using Mod

Michal Štrba 4.1k Dec 31, 2022
Simple 2D game prototyping framework.

prototype Simply prototype 2D games using an easy, minimal interface that lets you draw simple primitives and images on the screen, easily handle mous

null 77 Dec 17, 2022