Skip to content

Commit

Permalink
Merge branch 'master' into curve_element_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jere8184 authored Dec 12, 2024
2 parents 96712f0 + 2b902a9 commit e890cf1
Show file tree
Hide file tree
Showing 32 changed files with 309 additions and 104 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Ubuntu 22.04 CI
name: Ubuntu 24.04 CI

on: [push, workflow_dispatch]

jobs:
build-devenv:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: sudo DOCKER_BUILDKIT=1 docker build ./packaging/docker/devenv --file ./packaging/docker/devenv/Dockerfile.ubuntu.2204 --tag openage-devenv:latest
run: sudo DOCKER_BUILDKIT=1 docker build ./packaging/docker/devenv --file ./packaging/docker/devenv/Dockerfile.ubuntu.2404 --tag openage-devenv:latest
shell: bash
- name: Save the Docker image
run: |
Expand All @@ -24,7 +24,7 @@ jobs:
retention-days: 30

build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: build-devenv
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ If you're interested, we wrote detailed explanations on our blog: [Part 1](https
| Operating System | Build status |
| :-----------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Debian Sid | [Todo: Kevin #11] |
| Ubuntu 22.04 LTS | [![Ubuntu 22.04 build status](https://github.com/SFTTech/openage/actions/workflows/ubuntu-22.04.yml/badge.svg?branch=master)](https://github.com/SFTtech/openage/actions/workflows/ubuntu-22.04.yml) |
| Ubuntu 24.04 LTS | [![Ubuntu 24.04 build status](https://github.com/SFTTech/openage/actions/workflows/ubuntu-24.04.yml/badge.svg?branch=master)](https://github.com/SFTtech/openage/actions/workflows/ubuntu-24.04.yml) |
| macOS | [![macOS build status](https://github.com/SFTtech/openage/workflows/macOS-CI/badge.svg)](https://github.com/SFTtech/openage/actions?query=workflow%3AmacOS-CI) |
| Windows Server 2019 | [![Windows Server 2019 build status](https://github.com/SFTtech/openage/actions/workflows/windows-server-2019.yml/badge.svg?branch=master)](https://github.com/SFTtech/openage/actions/workflows/windows-server-2019.yml) |
| Windows Server 2022 | [![Windows Server 2022 build status](https://github.com/SFTtech/openage/actions/workflows/windows-server-2022.yml/badge.svg?branch=master)](https://github.com/SFTtech/openage/actions/workflows/windows-server-2022.yml) |
Expand Down
1 change: 1 addition & 0 deletions copying.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ _the openage authors_ are:
| Edvin Lindholm | EdvinLndh | edvinlndh à gmail dawt com |
| Jeremiah Morgan | jere8184 | jeremiahmorgan dawt bham à outlook dawt com |
| Tobias Alam | alamt22 | tobiasal à umich dawt edu |
| Alex Zhuohao He | ZzzhHe | zhuohao dawt he à outlook dawt com |

If you're a first-time committer, add yourself to the above list. This is not
just for legal reasons, but also to keep an overview of all those nicknames.
Expand Down
2 changes: 1 addition & 1 deletion doc/code/curves.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ directly invalidating the state, making curves more reliable in async scenarios
resolving dependencies for keyframes in the past can still be challenging).

The usage of curves has a few downsides though. They are less space efficient due to the
keyframe storage, interpolation are more costly more costly than incremental changes, and
keyframe storage, interpolation are more costly than incremental changes, and
their integration is more complex than the usage of simpler data structures. However, in
situations where operations are predictable, long-lasting, and easy to calculate - which
is the case for most RTS games - the positives may outweigh the downsides.
Expand Down
8 changes: 4 additions & 4 deletions libopenage/engine/engine.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023-2023 the openage authors. See copying.md for legal info.
// Copyright 2023-2024 the openage authors. See copying.md for legal info.

#include "engine.h"

Expand All @@ -16,7 +16,7 @@ namespace openage::engine {
Engine::Engine(mode mode,
const util::Path &root_dir,
const std::vector<std::string> &mods,
bool debug_graphics) :
const renderer::window_settings &window_settings) :
running{true},
run_mode{mode},
root_dir{root_dir},
Expand Down Expand Up @@ -55,8 +55,8 @@ Engine::Engine(mode mode,

// if presenter is used, run it in a separate thread
if (this->run_mode == mode::FULL) {
this->threads.emplace_back([&, debug_graphics]() {
this->presenter->run(debug_graphics);
this->threads.emplace_back([&]() {
this->presenter->run(window_settings);

// Make sure that the presenter gets destructed in the same thread
// otherwise OpenGL complains about missing contexts
Expand Down
6 changes: 4 additions & 2 deletions libopenage/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#include <thread>
#include <vector>

#include "renderer/window.h"
#include "util/path.h"


// TODO: Remove custom jthread definition when clang/libc++ finally supports it
#if __llvm__
#if !__cpp_lib_jthread
Expand Down Expand Up @@ -71,12 +73,12 @@ class Engine {
* @param mode The run mode to use.
* @param root_dir openage root directory.
* @param mods The mods to load.
* @param debug_graphics If true, enable OpenGL debug logging.
* @param window_settings The settings to customize the display window (e.g. size, display mode, vsync).
*/
Engine(mode mode,
const util::Path &root_dir,
const std::vector<std::string> &mods,
bool debug_graphics = false);
const renderer::window_settings &window_settings = {});

// engine should not be copied or moved
Engine(const Engine &) = delete;
Expand Down
26 changes: 24 additions & 2 deletions libopenage/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2023 the openage authors. See copying.md for legal info.
// Copyright 2015-2024 the openage authors. See copying.md for legal info.

#include "main.h"

Expand Down Expand Up @@ -31,7 +31,29 @@ int run_game(const main_arguments &args) {
run_mode = openage::engine::Engine::mode::HEADLESS;
}

openage::engine::Engine engine{run_mode, args.root_path, args.mods, args.gl_debug};
// convert window arguments to window settings
renderer::window_settings win_settings = {};
win_settings.width = args.window_args.width;
win_settings.height = args.window_args.height;
win_settings.vsync = args.window_args.vsync;

renderer::window_mode wmode;
if (args.window_args.mode == "fullscreen") {
wmode = renderer::window_mode::FULLSCREEN;
}
else if (args.window_args.mode == "borderless") {
wmode = renderer::window_mode::BORDERLESS;
}
else if (args.window_args.mode == "windowed") {
wmode = renderer::window_mode::WINDOWED;
}
else {
throw Error(MSG(err) << "Invalid window mode: " << args.window_args.mode);
}
win_settings.mode = wmode;
win_settings.debug = args.gl_debug;

openage::engine::Engine engine{run_mode, args.root_path, args.mods, win_settings};

engine.loop();

Expand Down
22 changes: 21 additions & 1 deletion libopenage/main.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2023 the openage authors. See copying.md for legal info.
// Copyright 2015-2024 the openage authors. See copying.md for legal info.

#pragma once

Expand All @@ -16,6 +16,24 @@

namespace openage {

/**
* Window parameters struct.
*
* pxd:
*
* cppclass window_arguments:
* int width
* int height
* bool vsync
* string mode
*/
struct window_arguments {
int width;
int height;
bool vsync;
std::string mode;
};

/**
* Used for passing arguments to run_game.
*
Expand All @@ -26,12 +44,14 @@ namespace openage {
* bool gl_debug
* bool headless
* vector[string] mods
* window_arguments window_args
*/
struct main_arguments {
util::Path root_path;
bool gl_debug;
bool headless;
std::vector<std::string> mods;
window_arguments window_args;
};


Expand Down
3 changes: 1 addition & 2 deletions libopenage/pathfinding/pathfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ const Pathfinder::portal_star_t Pathfinder::portal_a_star(const PathRequest &req
auto portal_pos = portal->get_exit_center(start_sector->get_id());
auto portal_abs_pos = sector_pos + portal_pos;
auto heuristic_cost = Pathfinder::heuristic_cost(portal_abs_pos, request.target);

portal_node->current_cost = 0;
portal_node->current_cost = Pathfinder::heuristic_cost(portal_abs_pos, request.start);
portal_node->heuristic_cost = heuristic_cost;
portal_node->future_cost = portal_node->current_cost + heuristic_cost;

Expand Down
13 changes: 4 additions & 9 deletions libopenage/presenter/presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "renderer/stages/skybox/render_stage.h"
#include "renderer/stages/terrain/render_stage.h"
#include "renderer/stages/world/render_stage.h"
#include "renderer/window.h"
#include "time/time_loop.h"
#include "util/path.h"

Expand All @@ -48,10 +47,10 @@ Presenter::Presenter(const util::Path &root_dir,
time_loop{time_loop} {}


void Presenter::run(bool debug_graphics) {
void Presenter::run(const renderer::window_settings window_settings) {
log::log(INFO << "Presenter: Launching subsystems...");

this->init_graphics(debug_graphics);
this->init_graphics(window_settings);

this->init_input();

Expand Down Expand Up @@ -93,18 +92,14 @@ std::shared_ptr<qtgui::GuiApplication> Presenter::init_window_system() {
return std::make_shared<renderer::gui::GuiApplicationWithLogger>();
}

void Presenter::init_graphics(bool debug) {
void Presenter::init_graphics(const renderer::window_settings &window_settings) {
log::log(INFO << "Presenter: Initializing graphics subsystems...");

// Start up rendering framework
this->gui_app = this->init_window_system();

// Window and renderer
renderer::window_settings settings;
settings.width = 1024;
settings.height = 768;
settings.debug = debug;
this->window = renderer::Window::create("openage presenter test", settings);
this->window = renderer::Window::create("openage presenter test", window_settings);
this->renderer = this->window->make_renderer();

// Asset mangement
Expand Down
8 changes: 5 additions & 3 deletions libopenage/presenter/presenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
#include <memory>
#include <vector>

#include "renderer/window.h"
#include "util/path.h"


namespace qtgui {
class GuiApplication;
}
Expand Down Expand Up @@ -87,9 +89,9 @@ class Presenter {
/**
* Start the presenter and initialize subsystems.
*
* @param debug_graphics If true, enable OpenGL debug logging.
* @param window_settings The settings to customize the display window (e.g. size, display mode, vsync).
*/
void run(bool debug_graphics = false);
void run(const renderer::window_settings window_settings = {});

/**
* Set the game simulation controlled by this presenter.
Expand Down Expand Up @@ -120,7 +122,7 @@ class Presenter {
* - main renderer
* - component renderers (Terrain, Game Entities, GUI)
*/
void init_graphics(bool debug = false);
void init_graphics(const renderer::window_settings &window_settings = {});

/**
* Initialize the GUI.
Expand Down
5 changes: 5 additions & 0 deletions libopenage/renderer/demo/demo_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "demo_0.h"

#include "renderer/demo/util.h"
#include "renderer/gui/integration/public/gui_application_with_logger.h"
#include "renderer/opengl/window.h"
#include "renderer/render_pass.h"
Expand Down Expand Up @@ -50,6 +51,10 @@ void renderer_demo_0(const util::Path &path) {
false,
};

if (not check_uniform_completeness({display_stuff})) {
log::log(WARN << "Uniforms not complete.");
}

auto pass = renderer->add_render_pass({display_stuff}, renderer->get_display_target());

while (not window.should_close()) {
Expand Down
7 changes: 6 additions & 1 deletion libopenage/renderer/demo/demo_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <epoxy/gl.h>
#include <QMouseEvent>

#include "renderer/demo/util.h"
#include "renderer/gui/integration/public/gui_application_with_logger.h"
#include "renderer/opengl/window.h"
#include "renderer/render_pass.h"
Expand Down Expand Up @@ -172,6 +173,10 @@ void renderer_demo_1(const util::Path &path) {

auto pass2 = renderer->add_render_pass({display_obj}, renderer->get_display_target());

if (not check_uniform_completeness({obj1, obj2, obj3, proj_update, display_obj})) {
log::log(WARN << "Uniforms not complete.");
}

/* Data retrieved from the object index texture. */
resources::Texture2dData id_texture_data = id_texture->into_data();
bool texture_data_valid = false;
Expand All @@ -188,7 +193,7 @@ void renderer_demo_1(const util::Path &path) {
ssize_t y = qpos.y();

log::log(INFO << "Clicked at location (" << x << ", " << y << ")");
if (!texture_data_valid) {
if (not texture_data_valid) {
id_texture_data = id_texture->into_data();
texture_data_valid = true;
}
Expand Down
7 changes: 6 additions & 1 deletion libopenage/renderer/demo/demo_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <epoxy/gl.h>
#include <QMouseEvent>

#include "renderer/demo/util.h"
#include "renderer/gui/integration/public/gui_application_with_logger.h"
#include "renderer/opengl/window.h"
#include "renderer/render_pass.h"
Expand Down Expand Up @@ -224,6 +225,10 @@ void renderer_demo_2(const util::Path &path) {

auto pass2 = renderer->add_render_pass({display_obj}, renderer->get_display_target());

if (not check_uniform_completeness({proj_update, obj1, display_obj})) {
log::log(WARN << "Uniforms not complete.");
}

/* Data retrieved from the object index texture. */
resources::Texture2dData id_texture_data = id_texture->into_data();
bool texture_data_valid = false;
Expand All @@ -243,7 +248,7 @@ void renderer_demo_2(const util::Path &path) {
ssize_t y = qpos.y();

log::log(INFO << "Clicked at location (" << x << ", " << y << ")");
if (!texture_data_valid) {
if (not texture_data_valid) {
id_texture_data = id_texture->into_data();
texture_data_valid = true;
}
Expand Down
5 changes: 5 additions & 0 deletions libopenage/renderer/demo/demo_4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <eigen3/Eigen/Dense>
#include <QKeyEvent>

#include "renderer/demo/util.h"
#include "renderer/gui/integration/public/gui_application_with_logger.h"
#include "renderer/opengl/window.h"
#include "renderer/render_pass.h"
Expand Down Expand Up @@ -165,6 +166,10 @@ void renderer_demo_4(const util::Path &path) {

auto pass2 = renderer->add_render_pass({display_obj}, renderer->get_display_target());

if (not check_uniform_completeness({proj_update, obj1, display_obj})) {
log::log(WARN << "Uniforms not complete.");
}

window.add_resize_callback([&](size_t w, size_t h, double /*scale*/) {
/* Calculate a projection matrix for the new screen size. */
float aspectRatio = float(w) / float(h);
Expand Down
5 changes: 5 additions & 0 deletions libopenage/renderer/demo/demo_5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QMouseEvent>

#include "renderer/camera/camera.h"
#include "renderer/demo/util.h"
#include "renderer/gui/integration/public/gui_application_with_logger.h"
#include "renderer/opengl/window.h"
#include "renderer/render_pass.h"
Expand Down Expand Up @@ -134,6 +135,10 @@ void renderer_demo_5(const util::Path &path) {
"tex",
gltex);

if (not check_uniform_completeness({terrain_obj})) {
log::log(WARN << "Uniforms not complete.");
}

// Move around the scene with WASD
window.add_key_callback([&](const QKeyEvent &ev) {
bool cam_update = false;
Expand Down
Loading

0 comments on commit e890cf1

Please sign in to comment.