Skip to content

IWeidl/ExGameLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExGameLib

Description

Game Engine written in C++ with SFML and ENTT.

I am using this project as a means to learn new technologies and systems. As such, the code is constantly being refactored and played with.

The engine currently has the following features:

  • ECS using entt
  • Scripting these entities with ChaiScript
  • Texture Rendering
    • Layers
  • Keyboard Input

Getting Started

Installation

You will first need SFML, ENTT, chaiscript and nlohman JSON (links to both found below). You can include manually, but using vckpkg you can run the below commands to install each package:

vcpkg install sfml:x64-windows
vcpkg install nlohmann-json:x64-windows
vcpkg install entt:x64-windows
vcpkg install chaiscript:x64-windows

Usage

Currently, you can show a window, load entities from a JSON file (including textures) onto the screen, and move them around with custom input mapping.

From Source Code

To do this, #include "Game.h" then insert the below in to your main function:

EGL::Game game;

Create an entities.json file and put in the entity attributes in similar to below: You will need to ensure the referenced texture files are present.

{
  "player": {
    "name": "Jimmy",
    "health": 10,
    "texture": "player.png",
    "position": [ 200, 200 ],
    "inputs": {
      "w": "EGL.Move(\"player\", 5);",
      "s": "EGL.Move(\"player\", -5);",
      "a": "EGL.Rotate(\"player\", -5);",
      "d": "EGL.Rotate(\"player\", 5);",
      "r": "EGL.SetPos(\"player\", 0, 0);",
      "t": "EGL.Delete(\"skeleton\");",
      "q": "EGL.Shift(\"player\", -5, 0);",
      "e": "EGL.Shift(\"player\", 5, 0);",
      "p": "EGL.AddPositionComponent(\"player\", 0, 0);" 
    }
  },
  "villager": {
    "name": "Fred",
    "health": 10
  },
  "skeleton": {
    "health": 5,
    "texture": "enemy.png",
    "position":[100, 100]
  }
}

When run, the file will be loaded into the game state and the screen will output the entities at the correct with position with the correct texture. The entities can then be moved, rotated, and modified, depending on the player input.

From Executable

Once the executable file has been built, new compilations aren't required. Simply modify the relevant json files and rerun the executable.

Future Plans

  • Replace SFML with lower level graphics implementation, OpenGL most likely

Libraries Used

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages