Skip to content

Commit

Permalink
Merge branch 'master' into add_camera_boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
EdvinLndh committed Oct 21, 2024
2 parents 19169ad + 3db8afd commit d19b4f4
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 69 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/macosx-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
# https://docs.github.com/en/actions/reference/software-installed-on-github-hosted-runners
# we install stuff not already there
macos-build:
runs-on: macOS-latest
runs-on: macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -19,7 +19,7 @@ jobs:
string(TIMESTAMP current_date "%Y-%m-%d-%H:%M:%S" UTC)
message("timestamp=${current_date}" >> $GITHUB_OUTPUT)
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-deps
with:
path: |
Expand All @@ -29,7 +29,7 @@ jobs:
restore-keys: |
${{ runner.os }}-deps-
- name: Cache ccache dir
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-ccache
with:
path: ~/Library/Caches/ccache
Expand All @@ -40,26 +40,14 @@ jobs:
run: brew update-reset
- name: Brew update
run: brew update
- name: Install clang / LLVM 15.0.0
run: |
set -x
brew install --force wget
mkdir -p /tmp/clang
cd /tmp/clang
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.0/clang+llvm-15.0.0-x86_64-apple-darwin.tar.xz -O clang-15.0.0.tar.xz
ls
tar -xvf clang-15.0.0.tar.xz -C ~
cd ~
mv clang+llvm-15.0.0-x86_64-apple-darwin clang-15.0.0
~/clang-15.0.0/bin/clang++ --version
- name: Brew install DeJaVu fonts
run: brew install --cask font-dejavu
- name: Remove python's 2to3 link so that 'brew link' does not fail
run: rm /usr/local/bin/2to3* && rm /usr/local/bin/idle3*
- name: Install environment helpers with homebrew
run: brew install --force ccache
- name: Install dependencies with homebrew
run: brew install --force libepoxy freetype fontconfig harfbuzz opus opusfile qt6 libogg libpng toml11 eigen
- name: Install LLVM with homebrew
run: brew install --force llvm
- name: Install openage dependencies with homebrew
run: brew install --force cmake python3 libepoxy freetype fontconfig harfbuzz opus opusfile qt6 libogg libpng toml11 eigen
- name: Install nyan dependencies with homebrew
run: brew install --force flex make
- name: Install python3 packages
Expand All @@ -68,9 +56,7 @@ jobs:
# numpy pulls gcc as dep? and pygments doesn't work.
run: pip3 install --upgrade --break-system-packages cython numpy mako lz4 pillow pygments setuptools toml
- name: Configure
run: |
CLANG_PATH="$HOME/clang-15.0.0/bin/clang++"
./configure --compiler="$CLANG_PATH" --mode=debug --ccache --download-nyan
run: ./configure --compiler="$(brew --prefix llvm)/bin/clang++" --mode=release --ccache --download-nyan
- name: Build
run: make -j$(sysctl -n hw.logicalcpu) VERBOSE=1
- name: Test
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu-22.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
sudo docker save openage-devenv:latest | gzip > /tmp/staging/devenv.tar.gz
shell: bash
- name: Publish the Docker image
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: devenv-image-compressed.tar.gz
path: '/tmp/staging/devenv.tar.gz'
Expand All @@ -32,7 +32,7 @@ jobs:
run: mkdir -p /tmp/image
shell: bash
- name: Download devenv image
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: devenv-image-compressed.tar.gz
path: '/tmp/image'
Expand All @@ -47,7 +47,7 @@ jobs:
mkdir -p /tmp/openage
tar -czvf /tmp/openage/openage-build.tar.gz ./build
- name: Publish build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openage-build.tar.gz
path: '/tmp/openage/openage-build.tar.gz'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows-server-2019.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
vswhere -latest
shell: pwsh
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
Expand Down Expand Up @@ -78,15 +78,15 @@ jobs:
python -m openage --add-dll-search-path $DLL_PATH --version
shell: pwsh
- name: Publish build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: build-files
path: './build'
if-no-files-found: error
retention-days: 30
- name: Publish packaged artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: package-files
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows-server-2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
vswhere -latest
shell: pwsh
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
Expand Down Expand Up @@ -78,15 +78,15 @@ jobs:
python -m openage --add-dll-search-path $DLL_PATH --version
shell: pwsh
- name: Publish build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: build-files
path: './build'
if-no-files-found: error
retention-days: 30
- name: Publish packaged artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: package-files
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Goals
-----

* Fully authentic look and feel
* This can only be approximated, since the behaviour of the original game is mostly undocumented,
* This can only be approximated since the behavior of the original game is mostly undocumented,
and guessing/experimenting can only get you this close
* We will not implement useless artificial limitations (max 30 selectable units...)
* An easily-moddable content format: [**nyan** yet another notation](https://github.com/SFTtech/nyan)
Expand All @@ -79,7 +79,7 @@ Current State of the Project

**Important notice**: At the moment, "gameplay" is basically non-functional.
We're implementing the internal game simulation (how units even do anything) with simplicity and extensibility in mind, so we had to get rid of the temporary (but kind of working) previous version.
With these changes we can (finally) actually make use of our converted asset packs and our nyan API!
With these changes, we can (finally) actually make use of our converted asset packs and our nyan API!
We're working day and night to make gameplay return\*.
If you're interested, we wrote detailed explanations on our blog: [Part 1](https://blog.openage.dev/new-gamestate-2020.html), [Part 2](https://blog.openage.dev/engine-core-modules.html), [Monthly Devlog](https://blog.openage.dev/tag/news.html).

Expand All @@ -99,16 +99,16 @@ If you're interested, we wrote detailed explanations on our blog: [Part 1](https
Installation Packages
---------------------

There's many missing parts for an actually working game.
There are many missing parts for an actually working game.
So if you "just wanna play", [you'll be disappointed](#current-state-of-the-project), unfortunately.

We strongly recommend to build the program from source to get the latest, greatest and shiniest project state :)
We strongly recommend building the program from source to get the latest, greatest, and shiniest project state :)


* For **Linux** check at [repology](https://repology.org/project/openage/versions) if your distribution has any packages available. Otherwise you need to build from source.
* For **Linux** check at [repology](https://repology.org/project/openage/versions) if your distribution has any packages available. Otherwise, you need to build from source.
We don't release `*.deb`, `*.rpm`, Flatpak, snap or AppImage packages yet.
* For **Windows** check our [release page](https://github.com/SFTtech/openage/releases) for the latest installer.
Otherwise, you need to build from source.
Otherwise, you need to build from the source.

* For **macOS** we currently don't have any packages, you need to build from source.

Expand Down Expand Up @@ -152,15 +152,15 @@ Contributing
You might ask yourself now "Sounds cool, but how do I participate
and ~~get famous~~ contribute useful features?".

Fortunately for you, there is a lot to do and we are very grateful for help.
Fortunately for you, there is a lot to do and we are very grateful for your help.

## Where do I start?

* **Check the issues** [labelled with `good first issue`](https://github.com/SFTtech/openage/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). These are tasks that you can start right away and don't require much previous knowledge.
* **Ask us** in the [chat](https://matrix.to/#/#sfttech:matrix.org). Someone there could need
help with something.
* You can also **take the initiative** and fix a bug you found, create an issue for discussion or
implement a feature that we never though of, but always wanted.
implement a feature that we never thought of, but always wanted.


## Ok, I found something. What now?
Expand All @@ -176,7 +176,7 @@ Fortunately for you, there is a lot to do and we are very grateful for help.
## How do I contribute my features/changes?

* Read the **[contributing guide](/doc/contributing.md)**.
* You can upload work in progress (WIP) versions or drafts of your contribution to get feedback or support.
* You can upload work-in-progress (WIP) versions or drafts of your contribution to get feedback or support.
* Tell us (again) when you want us to review your work.

## I want to help, but I'm not a programmer...
Expand Down
28 changes: 20 additions & 8 deletions doc/build_instructions/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@

```
brew update-reset && brew update
brew tap homebrew/cask-fonts
brew install font-dejavu
brew install --cask font-dejavu
brew install cmake python3 libepoxy freetype fontconfig harfbuzz opus opusfile qt6 libogg libpng toml11 eigen
brew install llvm
pip3 install cython numpy mako lz4 pillow pygments toml
# optional, for documentation generation
brew install doxygen
pip3 install --upgrade --break-system-packages cython numpy mako lz4 pillow pygments setuptools toml
```

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies:
Expand All @@ -22,16 +18,32 @@ You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/buildi
brew install flex make
```

Optionally, for documentation generation:

```
brew install doxygen
```

## Clone the repository

```
git clone https://github.com/SFTtech/openage
cd openage
```

## Building

We advise against using the clang version that comes with macOS (Apple Clang) as it notoriously out of date and often causes compilation errors. Use homebrew's clang if you don't want any trouble. You can pass the path of homebrew clang to the openage `configure` script which will generate the CMake files for building:

```
# on Intel macOS, llvm is by default in /usr/local/Cellar/llvm/bin/
# on ARM macOS, llvm is by default in /opt/homebrew/Cellar/llvm/bin/
./configure --compiler="$(brew --prefix llvm)/bin/clang"" --download-nyan
```

Afterwards, trigger the build using `make`:

```
./configure --compiler=$(which clang++) --mode=release --download-nyan
make -j$(sysctl -n hw.ncpu)
```

Expand All @@ -40,7 +52,7 @@ make -j$(sysctl -n hw.ncpu)


## Running
`make run` or `./bin/run` launches the game. Try `./bin/run --help`!
`make run` or `cd bin && ./run` launches the game. Try `./run --help` if you don't know what to do!


## To create the documentation
Expand Down
7 changes: 5 additions & 2 deletions libopenage/renderer/opengl/shader_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,11 @@ void GlShaderProgram::update_uniforms(std::shared_ptr<GlUniformInput> const &uni
glBindTexture(GL_TEXTURE_2D, tex);
// TODO: maybe call this at a more appropriate position
glUniform1i(loc, tex_unit_id);
auto &tex_value = *this->textures_per_texunits[tex_unit_id];
tex_value = tex;
ENSURE(tex_unit_id < this->textures_per_texunits.size(),
"Tried to assign texture to non-existant texture unit at index "
<< tex_unit_id
<< " (max: " << this->textures_per_texunits.size() << ").");
this->textures_per_texunits[tex_unit_id] = tex;
break;
}
default:
Expand Down
1 change: 1 addition & 0 deletions libopenage/renderer/opengl/shader_program.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class GlShaderProgram final : public ShaderProgram
std::unordered_map<std::string, GlVertexAttrib> attribs;

/// Store which texture handles are currently bound to the shader's texture units.
/// A value of std::nullopt means the texture unit is unbound (no texture assigned).
std::vector<std::optional<GLuint>> textures_per_texunits;

/// Whether this program has been validated.
Expand Down
34 changes: 15 additions & 19 deletions openage/cppinterface/exctranslate.pyx
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.

"""
Provides the raise_py_exception and describe_py_exception callbacks for
Expand All @@ -10,21 +10,14 @@ from cpython.exc cimport (
PyErr_Occurred,
PyErr_Fetch,
PyErr_NormalizeException,
PyErr_SetObject,
PyErr_Restore
)
from cpython.pystate cimport (
PyThreadState,
PyThreadState_Get
PyErr_SetObject
)

from libcpp.string cimport string
from libcpp cimport bool as cppbool

from libopenage.log.level cimport level, err as lvl_err
from libopenage.log.message cimport message
from libopenage.error.error cimport Error
from libopenage.error.backtrace cimport Backtrace, backtrace_symbol
from libopenage.error.backtrace cimport backtrace_symbol
from libopenage.pyinterface.functional cimport Func1
from libopenage.pyinterface.pyexception cimport (
PyException,
Expand All @@ -36,26 +29,29 @@ from libopenage.pyinterface.exctranslate cimport (
set_exc_translation_funcs
)

import importlib
from ..testing.testing import TestError
from ..log import err, info
from ..log import info

cdef extern from "Python.h":
int PyException_SetTraceback(PyObject *ex, PyObject *tb)

cdef extern from "traceback.h":
void _PyTraceback_Add(const char *funcname, const char *filename, int lineno)
# _PyTraceback_Add has been made private in Python 3.13
# see https://github.com/python/cpython/pull/108453
# TODO: Find another solution to add tracebacks
# cdef extern from "traceback.h":
# void _PyTraceback_Add(const char *funcname, const char *filename, int lineno)


cdef void PyTraceback_Add(const char *functionname, const char *filename, int lineno) noexcept with gil:
"""
Add a new traceback stack frame.
Redirects to Python's internal _PyTraceback_Add function.
"""
# possible since 3.4.3 due to http://bugs.python.org/issue24436.
# the function will likely remain internal due to https://bugs.python.org/issue24743
_PyTraceback_Add(functionname, filename, lineno)
Note: Currently does nothing, because _PyTraceback_Add is no longer
accessible since Python 3.13.
TODO: Find another solution to add tracebacks.
"""
# _PyTraceback_Add(functionname, filename, lineno)


cdef class CPPMessageObject:
Expand Down

0 comments on commit d19b4f4

Please sign in to comment.