Skip to content

Commit

Permalink
[v0.1.0] First release. (#54)
Browse files Browse the repository at this point in the history
* Consolidate game title.

* Read build version from text file.

- Rename directory for user data from "spaced' to "userdata".

* Add menu music, replace game music: light jazz theme.

* Add tools/build_release.cmake.

* Move assets to assets/assets, in prep for CLI zipping.

* Fixup release package script.

* Add package CI on "v*" tag push.

* Customize log filename.

* Add windows app icon.

* Add Android icon.

* Add Android package step.

* Add Play Store BS.

* Add screenshot to README.

* Update README.

[Android] minify release builds.
  • Loading branch information
karnkaul authored Jul 7, 2024
1 parent a138a64 commit 03794c7
Show file tree
Hide file tree
Showing 99 changed files with 458 additions and 111 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ indent_size = 2
[CMakeLists.txt]
indent_style = space
indent_size = 2

[build_version.txt]
indent_style = space
indent_size = 2
insert_final_newline = false
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
run: |
export JAVA_HOME=$(find /opt -name "jdk-17.*")
cd src/android
./gradlew assembleDebug
./gradlew assembleRelease
77 changes: 77 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: package
on:
push:
tags:
- 'v*'
jobs:
package-linux:
runs-on: ubuntu-24.04
env:
PACKAGE_NAME: NovaSwarm-x64-linux-v0.1.0.zip
steps:
- uses: actions/checkout@v4
- name: init
run: sudo apt update -yqq && sudo apt install -yqq ninja-build xorg-dev libpulse-dev libkpipewire-dev
- name: package release
run: cmake -DPACKAGE_NAME=${{ env.PACKAGE_NAME }} -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PACKAGE_NAME }}
draft: true
fail_on_unmatched_files: true
package-windows:
runs-on: windows-latest
env:
PACKAGE_NAME: NovaSwarm-x64-windows-v0.1.0.zip
steps:
- uses: actions/checkout@v4
- name: package release
run: cmake -DPACKAGE_NAME="${{ env.PACKAGE_NAME }}" -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PACKAGE_NAME }}
draft: true
fail_on_unmatched_files: true
package-android:
env:
PACKAGE_NAME: NovaSwarm-arm64-android-v0.1.0.apk
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: init
run: |
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
tar xvzf jdk-17_linux-x64_bin.tar.gz -C /opt
- name: build APK
run: |
export JAVA_HOME=$(find /opt -name "jdk-17.*")
cd src/android
./gradlew assembleRelease
mv app/build/outputs/apk/release/app-release-unsigned.apk ../../$PACKAGE_NAME
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PACKAGE_NAME }}
draft: true
fail_on_unmatched_files: true
package-macos:
runs-on: macos-latest
env:
CPU_ARCH: arm64
OS_NAME: macos
PACKAGE_NAME: NovaSwarm-arm64-macos-v0.1.0.zip
steps:
- uses: actions/checkout@v4
- name: init
run: brew install ninja
- name: package release
run: cmake -DPACKAGE_NAME=${{ env.PACKAGE_NAME }} -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PACKAGE_NAME }}
draft: true
fail_on_unmatched_files: true

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ compile_commands.json

imgui.ini
bave*.log
/spaced
NovaSwarm*.log
/userdata
/notes.txt
/local_store
/massif.*
/assets/assets.zip
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.22)

project(spaced)
file(READ build_version.txt build_version)

message(STATUS "spaced build version: ${build_version}")

project(spaced VERSION ${build_version})

configure_file(src/package.yml.in "${CMAKE_CURRENT_SOURCE_DIR}/.github/workflows/package.yml" @ONLY)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,60 @@
# spaced
# Nova Swarm

**A 2D space shooter game, homage to Space Impact**

[![Build Status](https://github.com/cpp-gamedev/spaced/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-gamedev/spaced/actions/workflows/ci.yml)

![Screenshot_20240706-190240](https://github.com/cpp-gamedev/spaced/assets/16272243/ca360512-43dc-4a18-a286-ed9d7f6f4171)

## Running the game

### Requirements

1. GPU that supports Vulkan 1.1+.
1. Vulkan 1.1+ loader (driver).
1. Windows:
1. x64 (64 bit Intel/AMD).
1. Windows 10+.
1. Latest Visual C++ runtime.
1. GNU/Linux:
1. x64 (64 bit Intel/AMD).
1. libstdc++6 or newer.
1. MacOS (experimental):
1. arm64 (64 bit ARM).
1. Vulkan SDK must be installed globally.
1. Android:
1. arm64 (64 bit ARM) or x64 (64 bit Intel/AMD).

*Note: Adreno GPUs on Android seem to have driver bugs that cause rendering artifacts and can sometimes crash the app.*

### Steps

1. Download the latest release from the [releases page](https://github.com/cpp-gamedev/spaced/releases).
2. Unzip to a desired location / install the APK.
3. Run the app.

*Note: executable binaries in releases are not signed.*

## Building the source

### Requirements

In addition to runtime requirements:

1. C++20 compiler and standard library.
1. CMake 3.22+.
1. Git.

### Steps

1. Clone this repo locally.
1. Use an IDE / the command line to choose a compatible CMake preset or configure a build manually. First-time configuration takes some time to complete.
1. Build and run/debug.

## Attribution

See [attribution.txt](attribution.txt).

## Contributing

Contributions are welcome via PRs.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added assets/assets/images/icon_player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added assets/assets/music/game.mp3
Binary file not shown.
Binary file added assets/assets/music/menu.mp3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asset_type": "ParticleEmitter",
"texture": "images/foam_bubble.png",
"texture": "assets/images/foam_bubble.png",
"config": {
"initial": {
"position": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asset_type": "ParticleEmitter",
"texture": "images/explode.png",
"texture": "assets/images/explode.png",
"config": {
"initial": {
"position": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"asset_type": "ParticleEmitter",
"texture": "images/foam_bubble.png",
"texture": "assets/images/foam_bubble.png",
"config": {
"initial": {
"position": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed assets/images/icon_player.png
Binary file not shown.
Binary file removed assets/music/game.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions attribution.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SpaceShooterRedux: https://opengameart.org/content/space-shooter-redux, https://www.kenney.nl
sfx/beam_fire.wav: https://opengameart.org/content/laser-rifle
sfx/swish.wav: https://opengameart.org/content/battle-sound-effects
music/menu.mp3: https://opengameart.org/content/trouble-makers-coolriff-jazz
music/game.mp3: https://opengameart.org/content/shake-and-bake
1 change: 1 addition & 0 deletions build_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
6 changes: 3 additions & 3 deletions src/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId = "com.karnage.spaced"
minSdk = 28
targetSdk = 34
versionCode = 1
versionName = "1.0"
versionCode = 100
versionName = "0.1.0"

ndk {
abiFilters.add("arm64-v8a")
Expand All @@ -22,7 +22,7 @@ android {

buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down
Binary file added src/android/app/res/feature_graphic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/android/app/res/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/android/app/res/privacy_policy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Nova Swarm does not collect any user data. It stores user preferences, play progression, and app statistics locally.
1 change: 1 addition & 0 deletions src/android/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ target_sources(${PROJECT_NAME} PRIVATE
add_custom_target(copy-assets ALL
${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_SOURCE_DIR}/../assets"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${spaced_path}/assets" "${CMAKE_CURRENT_SOURCE_DIR}/../assets"
COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_CURRENT_SOURCE_DIR}/../assets/assets.zip"
)

add_dependencies(${PROJECT_NAME} copy-assets)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
6 changes: 0 additions & 6 deletions src/android/app/src/main/res/mipmap-anydpi/ic_launcher.xml

This file was deleted.

This file was deleted.

Binary file modified src/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#A27EE5</color>
</resources>
2 changes: 1 addition & 1 deletion src/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Spaced</string>
<string name="app_name">Nova Swarm</string>
</resources>
12 changes: 12 additions & 0 deletions src/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ add_executable(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PRIVATE spaced::lib)

target_sources(${PROJECT_NAME} PRIVATE main.cpp)

set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME NovaSwarm)

if(WIN32)
target_sources(${PROJECT_NAME} PRIVATE windows/app.rc)

set(subsystem $<IF:$<BOOL:$<CONFIG:Debug>>,CONSOLE,WINDOWS>)
target_link_options(${PROJECT_NAME} PRIVATE
/SUBSYSTEM:${subsystem}
/ENTRY:mainCRTStartup
)
endif()
38 changes: 29 additions & 9 deletions src/desktop/main.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
#include <bave/clap/clap.hpp>
#include <bave/desktop_app.hpp>
#include <spaced/build_version.hpp>
#include <spaced/game_title.hpp>
#include <spaced/spaced.hpp>
#include <iostream>

namespace {
using bave::App;
using bave::DataLoaderBuilder;
using bave::DesktopApp;
using bave::to_string;

namespace {
auto get_log_filename() {
auto ret = std::string{};
ret.reserve(spaced::game_title_v.size() + 4);
for (char const c : spaced::game_title_v) {
if (std::isspace(static_cast<unsigned char>(c)) != 0) { continue; }
ret += c;
}
ret += ".log";
return ret;
}
} // namespace

auto parse_args(int const argc, char const* const* argv) -> std::optional<int> {
namespace clap = bave::clap;
auto name = clap::make_app_name(*argv);
auto description = std::string{"2D platformer game using bave"};
auto version = bave::to_string(spaced::build_version_v);
auto version = to_string(spaced::build_version_v);
auto options = clap::Options{std::move(name), std::move(description), std::move(version)};

auto show_bave_version = false;
Expand All @@ -19,7 +38,7 @@ auto parse_args(int const argc, char const* const* argv) -> std::optional<int> {
if (clap::should_quit(result)) { return clap::return_code(result); }

if (show_bave_version) {
std::cout << "bave version " << bave::to_string(bave::build_version_v) << "\n";
std::cout << "bave version " << to_string(bave::build_version_v) << "\n";
return EXIT_SUCCESS;
}

Expand All @@ -29,7 +48,7 @@ auto parse_args(int const argc, char const* const* argv) -> std::optional<int> {
void set_log_max_levels() {
using Level = bave::log::Level;
static constexpr auto warn_v = std::array{
"DesktopApp", "DesktopDataStore", "Vulkan", "RenderDevice", "ImageCache", "BufferCache", "ShaderCache", "PipelineCache",
"DesktopApp", "DataStore", "Vulkan", "RenderDevice", "ImageCache", "BufferCache", "ShaderCache", "PipelineCache",
};

auto const set = [](auto const& names, Level const level) {
Expand All @@ -40,18 +59,19 @@ void set_log_max_levels() {
}

auto run(int const argc, char const* const* argv) -> int {
auto data_loader = bave::DataLoaderBuilder{argc, argv}.add_zip("assets.zip").add_dir("assets").build();
auto create_info = bave::DesktopApp::CreateInfo{
.title = "Spaced",
auto data_loader_builder = DataLoaderBuilder{argc, argv}.add_zip("assets.zip").add_dir("assets");
auto create_info = DesktopApp::CreateInfo{
.title = spaced::game_title_v.data(),
.mode = bave::Windowed{.extent = {1920, 1080}},
.msaa = vk::SampleCountFlagBits::e4,
.data_loader = std::move(data_loader),
.data_loader = data_loader_builder.build(),
.log_filename = get_log_filename(),
};

set_log_max_levels();

auto app = bave::DesktopApp{std::move(create_info)};
app.set_bootloader([](bave::App& app) { return std::make_unique<spaced::Spaced>(app); });
auto app = DesktopApp{std::move(create_info)};
app.set_bootloader([](App& app) { return std::make_unique<spaced::Spaced>(app); });
return static_cast<int>(app.run());
}
} // namespace
Expand Down
1 change: 1 addition & 0 deletions src/desktop/windows/app.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_APPLICATION ICON "icon.ico"
Binary file added src/desktop/windows/icon.ico
Binary file not shown.
Loading

0 comments on commit 03794c7

Please sign in to comment.