Coder Social home page Coder Social logo

2dplayground's Introduction

2dPlayGround

A small playground 2D game engine to create a mini-game that is based on SDL2, ImGu, EnTT and an minimal custom made OpenAL sound-engine.
In principal I tried to stick modern C++ wherever it made sense, mainly to keep myself up2date with new possibilities to make the code more readable, efficient and safer.\

Prerequisites

The project uses CMake Package Manager
As the project uses some advanced C++ features (aiming to use C++23) a recent compiler is needed. See next section for details

  • CMake > 3.22
  • GCC > 14.1 or Clang 17.0.3 or the MSVC 2022 compiler

It is tested on Windows using VS2022 and inside an Ubuntu environment (24.04) but might also work on other distributions.

Build

The project uses CMake and comes with presets, so building is a trivial as:

cmake --preset=unixlike-gcc-release
cmake --build --preset=unixlike-gcc-release

All available presets for your target platform:

cmake --list-presets

Visual Studio and VS Code will also work either directly for Windows or using WSL.

Project structure

The project currently consists of 3 major parts/folders

  • libs
    • pgFoundation
    • pgEngine
    • pgGame
  • apps
    • sandbox
    • galaxy
    • asteroids
    • ... some other
  • tools
  • tests

tests

Catch2 based unittest. By far not complete.

tools

All tools for creating resources etc. Currently there is only a collisionShape generator that produces convex hulls from sprites.

libs

pgFoundation

Comprises of some classes and facilties that are not directly specific to this. Is a candidate to be moved outside the project

├── caching      
├── imgui
├── paths
├── serialization
└── strings

pgEngine

Some attempt to build a minimal game engine which in principal is based on SDL2 (in detail it is using sdlpp). It provides core an core architecture by abstracting an application, event loop, math and rendering primitives.

The math library contains a minimal linear algebra library (as i found GMTL/my GMTL fork clumsy and outdated and eigen to much for what I wanted initially. I've also considered GLM ). With it I added some minimal space partitioning (a KDTree) and some minimal collision code.

pgGame

Extends the pgEngine using ECS (EnTT) to provide basic entities, a system abstraction and basic resource and scene management.

apps

Asteroids

This serves as a simple tech demo and concept playground. It is based on pgGame and therefore is a based on an EnTT. There is still a lot to learn and to experiment with.

Galaxy

A small portion of a game idea I developed some years ago. It basically revolves around vonNeumann probes and is currently developed into a working game.

Sandbox et al.

All other folders are for testing, messing around and minimal tech demos.

Running

If you want to try, you can use the install targets created by the cmake-configure step. They will install all resources, libraries.

Troubleshooting

2dplayground's People

Contributors

psyinf avatar messers2 avatar

Watchers

 avatar

2dplayground's Issues

proper drone movement properties

The movement needs to honor the maximum speed and acceleration
This also requires some definition of units. E.g. a distance should be in lightyears and time units defined.
With this we can define the maximum speed as percent of 'c'

Starsystem handling

Starsystems need:

  • resource abundancy
    ** time to build drones (exponentially decreasing? due to harder to extract resources)
    ** number of drones that can be built
  • hazard situation
    ** how much can production be hampered by solar storms etc.
    later:
    defense platforms/drones to avoid being captured by enemy

Conceptualize balancing

Factions follow different strategies

  • trade-off speed over reliability (higher speed equals higher prob and effect of collision incidents
  • max distance vs speed
  • idea: if a drone cannot find a target within range, trade range for speed

combat strategies:

  • sub-drones for attacks
  • directed weapons
  • attack production vs drones
  • suicide attacks vs facilities

production strategies:

  • facility vs resource vs drones

later:

  • aggressiveness vs avoidance (when searching for new systems, drones can choose free over hostile planned systems)

idea:

  • attack, defense, speed tradeoffs

tradeoffs:

  • speed/acceleration vs max distance
  • reproduction rate vs failure rate

Quadtree circle query

The Quadtree implementation needs a circle query
[ ] add circle primitive
[ ] add interface

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.