Giter Site home page Giter Site logo

oh3's Introduction

Open Hexagon 3

A potential rewrite for Open Hexagon by Vittorio Romeo using Love2D.

(omg it's finally happening)

External dependencies

Apart from the pure lua dependencies that are present in the repository, the game relies on:

  • Love2D 12.0

--> download it from actions artifact by clicking on a build here

  • SQLite
  • Luv
  • libsodium (for server)
  • ffmpeg (for video export)

These dependencies may have dependencies of their own.

Building

There is a CMakeLists.txt for installing most of the dependencies and building the c code for the video export. It requires the following dependencies to work:

  • cmake
  • make
  • gcc
  • git
  • libsodium
  • pkg config
  • lua 5.1
  • ffmpeg

On debian-based distributions they can be installed with this command:

apt install \
    cmake \
    make \
    g++ \
    git \
    libsodium-dev \
    pkg-config \
    liblua5.1-dev \
    libavformat-dev \
    libavcodec-dev \
    libswresample-dev \
    libswscale-dev \
    libavutil-dev

(Keep in mind that the packages should not be too outdated for the code to compile.)

On arch based distributions they can be installed with this line:

pacman -S cmake make gcc git libsodium pkgconf lua51 ffmpeg

Then you can proceed with building

mkdir build && cd build
cmake ..
make
make install

The last command will put the libraries inside the repository folder where the game will find them (it will not attempt to put files in standard system directories).

Instead of cmake .. you may also run cmake -DVIDEO_EXPORT=0 .. to skip building the video encoder.

Server

If you want to run a server with the web api you also need to install other dependencies. To install openssl headers on a debian-based distribution execute: apt install libssl-dev. On an arch based distribution you can use pacman -S openssl. Then install the lua modules using luarocks: luarocks --lua-version 5.1 install luasec

To run the web api server with tls you need to set the environment variables TLS_KEY and TLS_CERT to point to their respective .pem files.

Tests

Run tests with luajit test/main.lua in the source directory. Generate coverage statistics with luajit test/main.lua --coverage

oh3's People

Contributors

bauumm avatar theepicosity avatar ena-shepherd avatar syyrion avatar vindowvipre avatar

Stargazers

Luka tv avatar Koolen Dasheppi avatar  avatar Apeirobyte avatar Skye Fentras avatar  avatar  avatar

Watchers

 avatar

Forkers

viciscat

oh3's Issues

Levels with lots of random string concentration lag a lot with the ui

When the game uses a lot of memory (unrelated to the level) any level that concentrates random characters to a string a lot will start lagging a lot.

The only part I could reproduce in a minimal example is string concentration becoming slow with more memory usage, but in the game this only seems to happen when the added characters are randomized.
Here is said minimal example:

-- this part allocates a lot of useless memory
S = {}
for _ = 1, 1000 do
    local t = {}
    for _ = 1, 10000 do
        t[{}] = {}
    end
    S[{}] = t
end

-- this part concentrats a string and prints the time the operation took
local uv = require("luv")
local start = uv.hrtime()
local t = ""
for _ = 1, 10 ^ 5 do
    t = t .. "1"
end
print(uv.hrtime() - start)

on my pc the result is 6906122093 nanoseconds, if i remove the useless allocation at the top the result is 244013567 nanoseconds so more than 28 times as fast.

The issue in the game does not happen when running a replay as it bypasses the initial loading of the ui which makes it allocate less memory initially. However as I said earlier changing the level script to use a hardcoded character instead of a random one seems to make the issue go away, so I'm still not certain about the cause.

Any help with finding why this happens or even a way to fix it would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.