Multiplayer top-down shooter made from scratch in C++. Comes with an in-game Editor!
Online shooter with relentless dynamics.
Challenge your friend to an intense duel, or gather two clans to fight a spectacular war.
Written in modern C++, without a game engine!
Forever free and open-source :heart:
Only 29 MB!
The game will start with an interactive Tutorial!
Download Headless Dedicated Server
All archives are digitally signed. You can verify signatures.
Open Source Friend (200 votes, 16.5k views)
Hypersomnia is a competitive arena released as free software.
The game has been online and playable since 2017. It brings together:
Hypersomnia aims to be the ultimate open-source 2D shooter - a grand community project extensible without limit.
Declare allegiance to one of the three factions whose apple of discord is a disparity between prevailing notions of moral excellence:
Metropolis. Atlantis. Resistance.
Will you take revenge for the unethical simulation of an inferior universe? Will you support the cruel experiments to win total control over metempsychosis? Or will you join the underground civilization that awaits the end of war in this dangerous afterlife reality?
10 community maps and counting!
2 game modes: Bomb defusal and Gun game.
An in-game map editor that lets you host a work-in-progress map to instantly play it with your friends, even behind a router!
Your friends will automatically download your map with all its custom resources!
(like in CS 1.6)
rectpack2D, written for packing textures, became famous and was used in Assassin's Creed: Valhalla.
My Entity-Component-System idea from 2013 describes techniques similar to Unity Engine patent from 2018.
Networking is based on cross-platform simulation determinism.
clang
- on all OSes. It's very nice of LLVM to be ieee754-compliant by default.std::sin
, std::sqrt
by these from STREFLOP.
streflop::sqrt
became a huge bottleneck - thankfully, I found another efficient ieee754-compliant implementation.
std::unordered_map
- often replacing them with deterministically ordered std::map
.<random>
header (its implementation differs across OSes).40 kbit/s (= 5 KB/s)
under a tickrate of 60 Hz. Only player-controlled characters contribute to traffic.
You can host a working game server from the main menu - the game is able to forward ports out of the box!
P
of the other party.P + delta * n
.Cute fish and insect AI with flocking behaviors. Full source: movement_path_system.cpp.
Anyone can host the entire Hypersomnia server infrastructure.
Memory pool implementation with:
std::vector
).
push_back
).std::swap
with the last element and pop_back
- a very known idiom).indirection_array
pointer (1).
indirection_array[identifier]
(2).objects
vector pointer (3).objects[indirection_array[identifier]]
(4).objects
and indirection_array
will usually be cached already so subsequent dereferences will be reduced to two fetches from RAM at most).indirection_array
is kept up-to-date whenever objects are allocated or removed.I
.
I
.I+1
.I
.undo_last_allocate
apart from the standard free
. It's used by the commands that have to undo creating a resource (which means deleting it). It will free the object in a way that the next allocation will result in an identical integer id and internal pool state (with allocated objects order) as before freeing the resource. It is an optional feature for the sake of editor commands that is never used during actual gameplay. Analogously, there is an undo_last_free
.Built-in self-updater: the game will download and apply updates automatically.
ssh-keygen
.
..and I'm signing builds offline with a Trezor hardware wallet. This is how every update looks like on my end:
Discord and Telegram notifications when:
a new game version is deployed,
players connect,
a 1v1 "duel of honor" begins (auto-detected whenever there's only 1 player per faction),
community server is hosted,
or a match comes to an end. This includes full player stats and the MVP.
Beautifully simple JSON format for the game maps. This short json:
{
"settings": {
"ambient_light_color": [53, 25, 102, 255]
},
"nodes": [
{
"id": "floor",
"type": "dev_floor_128",
"pos": [640, 0],
"size": [1536, 1536]
},
{
"id": "light",
"type": "point_light",
"color": [255, 165, 0, 255],
"pos": [100, 100],
"radius": 700
},
{
"id": "wall",
"type": "dev_wall_128",
"pos": [-384, 0],
"size": [512, 1536]
},
{
"id": "crate",
"type": "crate",
"pos": [64, 448]
},
{
"id": "wood1",
"type": "hard_wooden_wall",
"pos": [192, -192]
},
{
"id": "wood2",
"type": "hard_wooden_wall",
"pos": [561.819, 206.436],
"size": [384, 128],
"rotation": -15
},
{
"id": "aquarium",
"type": "aquarium",
"pos": [1408, 0],
"rotation": 90
},
{
"id": "baka1",
"type": "baka47",
"pos": [698, -8]
},
{
"id": "baka2",
"type": "baka47",
"pos": [454, -264]
}
]
}
Instantly produces:
And speaking of the Editor..
It's created with the excellent ImGui.
You're working directly on the game world. 100% WYSIWYG.
Supports custom resources. It's enough to paste folders with PNGs, WAVs, OGGs to the map directory..
Supports GIFs as well! Just drag&drop them on the scene and they will be animated in-game, right out of the box!
It's possible to playtest a work-in-progress map with a single click:
After which you instantly appear in the game's server browser:
You will enter the game as the host.
The connecting clients will automatically download the map in its current version with all its custom resources.
ESC will let you stop the session and go back to the Editor exactly as you left it, enabling ultra-efficient iteration cycles.
This is possible because the server, the game and the editor are all within the same executable.
The official Discord will also be notified that you're playtesting a map, so others can join in on the fun!
The Editor took well over a year to implement.
It paid off big time - there is now a neat catalogue of community maps - every one of them downloadable.
Hypersomnia has been in development since 2013 (as seen in the commit history).
It didn't take 10 years of uninterrupted coding, though - in the meantime, I worked commercially to cover my costs of living. I saved money to be able to work less and focus on Hypersomnia. My financial decisions now let me develop the game full-time.
I use a lot of 3rdparty libraries like Box2D
(physics) or yojimbo
(transport layer) - everything not on this list, however, is written pretty much from scratch, in pure C++.
Many believe that writing games without an engine is no more than reinventing the wheel, or put more bluntly, a complete waste of time.
I hope this project serves as a great testament to the opposite.
Had I never embarked on this journey, I would have never made some of the interesting discoveries detailed in Tech highlights section. Video game internals are just so vast and interdisciplinary that they have limitless potential for creative breakthroughs, and it is a waste to never even entertain the idea that some widely used solutions can be replaced by something absolutely ingenious.
From: https://hypersomnia.xyz/guide
You can reconfigure all bindings by going to Settings->Controls tab.
Currently, Hypersomnia is only buildable using clang
.
Your operating system must be 64-bit.
Irrespectively of the OS, you will need the following software in order to build Hypersomnia:
libc++
, libc++abi
and lld
as well.C:\OpenSSL-Win64
Once dependencies are installed, go to the directory where you wish to have your Hypersomnia project downloaded, open git bash and paste:
git clone --recurse-submodules https://github.com/TeamHypersomnia/Hypersomnia
The --recurse-submodules
is necessary to clone the submodules as well.
Wait for the download to complete. Next steps depend on the platform you are on.
On all platforms, you can choose among three building configurations:
Debug
- the fastest to build and provides debug information.Release
- No debug information. Use only for production builds. Specifies IS_PRODUCTION_BUILD=1
C++ preprocessor define that disables assertions in performance-critical areas.RelWithDebInfo
- Same as Release
but with debug info and with many assertions ("ensures") compiled-in.
Preferred choice for testing the developed game while full speed is required.Refer to appveyor.yml file for up-to-date building procedure. A short overview of the process now follows.
Prerequisites:
Open up the terminal. Setup the environment:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
(If the file cannot be found, it means you are not using Visual Studio 2022 Community. You will have to look for a corresponding vcvarsall.bat
location on your own.)
Next, run these commands:
cd Hypersomnia
mkdir build
cd build
set CONFIGURATION=RelWithDebInfo
cmake -G Ninja -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link -DARCHITECTURE="x64" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DGENERATE_DEBUG_INFORMATION=0 -DOPENSSL_ROOT_DIR=C:\OpenSSL-Win64 ..
ninja
This will build a non-Steam client by default.
To build a Steam client, add a -DLINK_STEAM_INTEGRATION=1
flag to the cmake
command.
Note: your computer might start lagging heavily for the duration of the build as ninja
will use all available cores for compilation.
If you intend to develop the game, it is best to use "Debug" configuration for the fastest builds.
If you want to somehow customize your build, e.g. disable certain game features, refer to the beginning of CMakeLists.txt
to see which options you can pass to the cmake
command.
If the game builds successfully, run this command to launch it:
ninja run
If you built with -DLINK_STEAM_INTEGRATION=1
, don't forget to create a hypersomnia/steam_appid.txt
file with 2660970
in it.
Otherwise the game will try to restart itself through Steam.
If, for some reason, some step fails, refer to the latest working Appveyor build and the relevant appveyor.yml
file.
Refer to Linux_build.yml file for up-to-date building procedure - it is constantly in flux. A short overview of the process now follows.
Current platforms are actively tested and supported:
Arch Linux:
libc++ lld pkg-config libx11 libxcb xcb-util-keysyms libsodium
Ubuntu:
sudo apt-get install cmake ninja-build libxcb-keysyms1 libxcb-keysyms1-dev libxi6 libxi-dev alsa-oss osspd-alsa osspd libasound2 libasound2-dev p7zip p7zip-full libgl1-mesa-dev libxcb-glx0-dev libx11-xcb-dev
Once the dependencies are all set, this is the complete script for building and launching the game from scratch, with RelWithDebInfo configuration:
git clone --depth 1 --recurse-submodules https://github.com/TeamHypersomnia/Hypersomnia
cd Hypersomnia
export CXX=clang++; export CC=clang;
cmake/build.sh RelWithDebInfo x64
ninja run -C build/current
Use your favorite shell to enter the repository's directory. Then run:
cmake/build.sh [Debug|Release|RelWithDebInfo] [x86|x64] ["ADDITIONAL CMAKE FLAGS"]
For example:
export CXX=clang++; export CC=clang;
cmake/build.sh Debug x64
After which, the resultant build.ninja
should appear in the build/Debug-x64-clang directory.
Example for gcc:
export CXX=g++; export CC=gcc;
cmake/build.sh Debug x64
After which, the resultant build.ninja
should appear in the build/Debug-x64-gcc directory.
There are several additional ninja targets defined:
ninja run
Launches the game normally.
ninja tests
Launches unit tests only and exits cleanly.
The above targets set the working directory automatically to ${PROJECT_SOURCE_DIR}/hypersomnia
.
If, for some reason, some step fails, refer to the latest working Linux_build.yml
file.
If the game fails to launch, it should automatically open a log file with the relevant message using $VISUAL
executable.
You might want to follow some additional configuration to make the experience better on Linux.
The Hypersomnia editor can reveal files in explorer.
Also, the game may prompt you to select a file, e.g. to choose the avatar.
On Windows, this is accomplished through an IFileDialog
.
Needless to say, such a class does not exist on Linux.
Hypersomnia provides shell scripts for common file managers in hypersomnia/detail/unix/managers
.
You'll need one for choosing a file to open and one for revealing files in explorer.
cd
to hypersomnia/detail/unix
and, assuming you want to use ranger
as your file manager, create symlinks as such:
ln -s managers/reveal_file_ranger.zsh reveal_file.local
ln -s managers/open_file_ranger.zsh open_file.local
None of the symlinks will be tracked by git.
Currently, the following file managers are supported:
--choosefile
and --selectfile
optionsRefer to MacOS_build.yml file for up-to-date instructions.
To understand the repository's folder structure, make sure to read the documentation.
Pull requests are welcomed, should they even be typo fixes, missing const guarantees or changes in nomenclature. If you however plan to add a completely new feature, create a relevant issue so that everybody knows about it, because the project is continuously in a very, very active development and may undergo a revolution when it is the least expected.
A WIP documentation can be found at wiki.
Make sure to check out TeamHypersomnia for other repositories that are useful when setting up your own custom servers.
If you have questions or you fail to build Hypersomnia, create an issue. Or if you just can't wait to utter some brilliant ideas with regard to the game, please do so, too!