Giter Site home page Giter Site logo

rover656 / ngine Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 24.29 MB

A C++ 17 library for producing 2D games.

Home Page: https://www.nerdthings.dev/ngine

License: Apache License 2.0

Batchfile 0.16% C++ 95.78% CMake 4.06%
game-engine 2d 2d-game-engine windows windows-10 xbox-one linux cmake cxx17 cross-platform

ngine's Introduction

Hello There ๐Ÿ‘‹

I'm Reece Mackie (by the handle Rover656), a .NET Placement Software Engineer and 4th year Robert Gordon University student who is passionate about game development and tooling.

Rover656's github stats

Rover656's trophies

GitHub followers Twitter Follow

Primary Languages

C# Java JavaScript TypeScript HTML5 CSS3

Other Languages

These are languages I have used in the past or am learning.

C C++ Go Lua PHP Python R Rust

Familiar Technologies

.Net Git GitHub CMake Docker Apache Nginx Electron.js NodeJS Next JS Unity OpenGL React TailwindCSS MongoDB MySQL MicrosoftSQLServer

ngine's People

Contributors

rover656 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

anexus7 ultimabgd

ngine's Issues

Tileset's on Nvidia

The problem

When using a tileset canvas, alt-tabbing from the game when the state is not active causes the framebuffer to render completely blank.

Repoduction

Steps to reproduce the behavior (on Nvidia hardware only from what I can gather):

  1. Open Waterlogged.exe (Available from here)
  2. Click new game
  3. Quit the game
  4. Alt-tab
  5. Click continue or new game, everything tile wise is black.

What is expected

The framebuffer should NOT be blank.

Example Screenshots

Not available.

Platform information

  • OS: Windows 10
  • Device: Laptop running Nvidia GPU
  • Version/Commit: 2f62394

Full Physics Integration

Proposed Features

We need to properly integrate the Box2D physics engine as right now, it simply uses it for collision checking.

Grounds for change/addition

This should be added as it takes a massive load off a developer, allowing them to focus on building the game, not the physics engine.

Trade-offs

None foreseeable.

[Research (features-oldtodos)] Rework new renderer (for like the 6th time)

The renderer at the moment is very stable and works well with the current engine structure. The problem is that the renderer is not very expandible and while looking at implementing a HTML UI engine (RmlUI), due to the structure we'd not be able to have the renderer run this. The problem is the Renderer's support for indices, currently only a vertex buffer exists making indices extremely slow (We'd need a system similar to the vertex conversion code).

The Solution (I think/hope)

Rework the renderer to support indices (optionally) and have an index buffer alongside the vertex buffer. In order to ensure that the renderer does not slow down due to writing another buffer, we need to investigate ways of multithreading the renderer where possible (such as processing vertex conversions or buffer writing). This would both allow indices to be used in the renderer and could also speed up the conversion process (Currently only quads and triangle fans to raw triangles) and would involve far less data being passed to the GPU. This implementation shouldn't break anything that is currently in the Engine, but would change (again) the API for pushing batches of vertices.

In addition to this change, the matrix stack should be made available to the batch Add function to allow for easier translations of massive vertices.

Additional changes to Engine to make this smoother

The update loop can be moved to a second thread (for release builds) to allow for drawing to be uncapped to an FPS (If options allow for this). This will allow for updates to use a full frame and drawing to use a full frame, not whatever ratio there is currently for both in one frame (i.e 2 parts of the frame to update, 1 to draw).

UWP Support

Proposed Features

UWP Support is still to be added to Ngine, this is available in raylib. This will need to be done through a bootstrapper App, this will be added as part of raylib in the platform specific code namespace.

Grounds for change/addition

This is a planned feature, so it is being added to the issues system for tracking.

Trade-offs

N/A

Want to help out with this? Feel free, this is a medium priority issue as we need to get platform support to a good standard, and it would be a great help!

Better Resource Manager

Proposed Features

The resource manager could be rewritten to allow fine tuning of what assets are loaded and/or skipped. This will make loading of assets more trivial and easier to refine.

Trade-offs

None foreseeable.

Create Documentation

Documentation

Proposed Change

We need to create documentation for Ngine to make it more easy to use. This would involve either

  • Adding proper comments that are supported by doxygen (easier than the second option)
  • Or to add a hand-written documentation

Why this is required

This is required as currently the engine has a large number of classes, structures, enums and methods that sometimes can be unclear in their actions. This may also require a rework of class, struct and method naming conventions to make this more clear and predictable.

UI System

UI System

Proposed features

A new, panel based user interface system should be introduced into the engine. This panel based system will allow for all current input methods to work effectively. This will be heavily events based but will also be highly customisible.

Specific Concepts

Specific concepts will be added once features/spritebatch is merged as this will be heavily dependent on the new spritebatch system.

Windows ANGLE/DirectX Support

Proposed Features

Raylib just added a project that allows a windows game to run under ANGLE. We can try to support this.

There is nothing further to say at this time

Add a canvas system

Proposed Features

A canvas should be introduced. This will contain a render target and will only be redrawn when the contents of the canvas are modified. This will improve performance of large, more complex shapes or compositions by a substantial amount. This will also allow tilesets to be drawn with little to no overhead.

Grounds for change/addition

This should be added as it allows much more flexibility and performance benefits. For example if you were drawing the terrain for a game, each chunk can be contained within a canvas, and only when the terrain was modified in that chunk would the canvas be redrawn. This would have immense performance benefits.

Trade-offs

There are no trade-offs for this feature if used correctly. It must be made clear that the redraw method, whatever it may be, should NOT be called unless the canvas is changed, not each frame. This would be done within the update loop, protected by an if statement of some description.

Alternatives

There are no alternatives to this idea, as this does not fix any existing issues, but introduces a completely new concept.

feature/ui Anomaly

The problem

When a control is larger than the panel it is inside, the dimensions of the control begin to go wrong and will begin to misalign.

Repoduction

Create a control within a panel that is larger than the panel.

What is expected

The control should be constrained to a maximum size.

Platform information

  • OS: Windows 10
  • Device: Desktop PC
  • Version/Commit: ec56b7b

Refactor 17 lines occurring 3 times in TilesetCanvas.cpp

I've selected for refactoring 17 lines of code which are duplicated in 1 file(s) (1, 2, 3). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! ๐Ÿ‘

Here's the gist of this guideline:

  • Definition ๐Ÿ“–
    Do not copy code.
  • Whyโ“
    When code is copied, bugs need to be fixed in multiple places. This is both inefficient and a source of regression bugs.
  • How ๐Ÿ”ง
    Avoid duplication by never copy/pasting blocks of code and reduce duplication by extracting shared code, either to a new unit or introduce a superclass if the language permits.

You can find more info about this guideline in Building Maintainable Software. ๐Ÿ“–


โ„น๏ธ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the ๐Ÿ”ฒ next to them. The risk profile below the candidates signals (โœ…) when it's enough! ๐Ÿ


Good luck and happy coding! :shipit: โœจ ๐Ÿ’ฏ

Engine wide way to save states.

Proposed Features

The engine currently allows for developers to do basic save systems, but this should be integrated into the engine to allow this to be more seamless throughout the engine.

Rewrite Tileset Rendering

Rendering large tilesets with the canvas system results in massive textures being stored on the GPU. An alternative must be found, and the canvas system should be reserved for smaller sizes.

[Tracking] Roadmap Q3 2019

2019 Q3 Tracker

This is a tracker to allow me to see what needs to be done this quarter.

UPDATE: As we are proceeding with #15, many of these will be completed there, and the timescale has been pushed back. Closed as a result

Todo's

  • Fix memory leaks.
  • Improved resource loading, additionally allow directories to be marked by type instead of per-extension. Will be done in #15.
  • Tileset collisions (properly).
  • Type register, keeping track of all entity types, scene types etc. Dumb idea, not being done
  • Built in tiled support (with the ability for objects to represent entities).
  • Redo UI engine using canvases.
  • Scene wide saving and loading.

Refactor 12 lines occurring 2 times in EventHandler.h

I've selected for refactoring 12 lines of code which are duplicated in 1 file(s) (1, 2). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! ๐Ÿ‘

Here's the gist of this guideline:

  • Definition ๐Ÿ“–
    Do not copy code.
  • Whyโ“
    When code is copied, bugs need to be fixed in multiple places. This is both inefficient and a source of regression bugs.
  • How ๐Ÿ”ง
    Avoid duplication by never copy/pasting blocks of code and reduce duplication by extracting shared code, either to a new unit or introduce a superclass if the language permits.

You can find more info about this guideline in Building Maintainable Software. ๐Ÿ“–


โ„น๏ธ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the ๐Ÿ”ฒ next to them. The risk profile below the candidates signals (โœ…) when it's enough! ๐Ÿ


Good luck and happy coding! :shipit: โœจ ๐Ÿ’ฏ

SpriteBatch Attempt 2

New SpriteBatch

Grounds for change

Currently, the SpriteBatch added in commit 4234942 has a large impact on processor usage and therefore has an overall impact on the game's performance as a whole.

Proposed changes

We should redesign the spritebatch to be built away from raylib's drawing functions, and take a more Monogame approach. The files that we can base off of can be seen here:

If we were to implement this kind of system on top of the rlgl module (in more basic terms as Monogame has 3D support too) the we will be will (theortetically) be able to both fix all of our performance issues and add depth support. In addition to this, the default shader must have an alpha test added to it (https://www.khronos.org/opengl/wiki/Transparency_Sorting) to allow transparency to work to an acceptible level (This could be improved in a future PR, but for the moment we will not worry about true transparency).

Trade-offs

Drawing shapes will not be available through the SpriteBatch, this will need a separate canvas class. An advantage to this is the potential future support of SVG file types. Either way, this is a small trade-off for proper sprite batching.

What will happen in the short term

The current SpriteBatch will be removed from master, and the new SpriteBatch will be built and tested in the feature/spritebatch branch.

What will happen in the long term (2-3 weeks)

This will then be reviewed as part of a PR and then merged to ensure all correct testing has taken place. This testing will be run to ensure that this will not introduce game-breaking modifications to the engine past the usual API changes.

Potential Alternative

Another alternative that could be implemented instead of this is the ordering of entities within the scene. This would mean we would have to remove the event based draw events, but it would mean the current Drawing class can still be utilised while having proper transparency and depth support. This would allow shapes to be drawn in the same way that they currently are. This would potentially be less work and will mean the performance issues of ordering will be minimised as every single reordering will be run upon a change of depth of an entity, instead of every single frame. I feel this is the more preferred option as less modifications to the code will be needed and overall there are significantly less features lost through this implementation. I will try this system in an alternative feature branch feature-alt/entity-ordering.

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.