hTech
A downloadable engine for Windows
A 2D custom game engine written in C++.
hTech is a standalone 2D game engine written by myself that allows you to create and play games in a single application. The engine and project folders are built in such a way that allows them both to work independently and allows for the easy sharing of projects. The main branch of the repo is only updated for major changes
with all active development being done on the 'dev' branch. Future planned features, bugs and to-do's can all be seen on the Trello board.
Core Features
External Projects
The engine and projects exist independently of each other and can be shared and updated seperately as long as the engine filepath remains the same (although this is fixable manually). When you create a new project, the folder can be located in the 'My Documents' folder inside the hTech folder, i.e. "Documents\hTech\Projects\XXX". You can drag and drop the .hProj root files ontop of the engine .exe to launch the game in "Player" mode which hides all of the editor windows and immediately starts playing the game.
The project folder hierarchy exists as follows:
Assets: Contains all the assets and any path locators in the editor will be based from this folder.
-
ProjectName: This folder shares the same name as whatever you have called the project and currently contains all of the script building data such as the .pdb files, any scripts that are to be compiled as well as the external DLL which you more than likely do not need to touch at all.
-
Logs, Scenes and Scripts: Currently unused folders, see the Trello for future plans.
-
XXX.hProj: The hProj file is the root file that contains all the information that is used for loading the project and world into the engine. This file is also what can be dragged on top of the engine file to launch into player mode.
-
XXX.sln: This is the Visual Studio solution file for the project. It is not necessary to be used inside visual studio but this file contains all of the build information used by the engine to produce the code DLLs and so it is needed.
Scripting
The custom scripting solution works using a separate visual studio solution that builds the scripts into an external DLL which the engine loads.
The user has access to a number of headers and exposed functions that can be used to create functionality within the scripts. The engine exports a number of these headers and functions alongside its own .exe file and are linked to the external script solution when the project is created.
Entity Component System
To build up your game within the engine, you can expand the entities using the various built-in components. The current components available to the user are:
- Transform - Every entity starts with a transform component that cannot be removed. This is what defines the position and rotation of everything in the world.
- Sprite - Allows for the addition of a sprite that is centered on the transform component's position. The sprite is loaded from the assets folder and can be altered at runtime by setting the name in the editor or in code. The path used by the asset loader is relative to the asset folder within the project folder.
- Animation - Similar to a sprite component but rather than being a static sprite, this component provides extra editable details that can be altered to turn sprites into animations. The path used by the asset loader is also relative to the asset folder within the project.
- Script - Script components allow for the assignment of custom scripts to entities which can be used to control the entity as well as attach and modify any existing components, create and destroy entities and interact with other objects within the world. For more details on custom scripts, see below.
- Rigidbody - A rigidbody component gives an entity physics properties as well as adds the option for a collider, overlapping and setting up triggers in code. There are functions exposed in the scripting that allows for code to be run on collisions or overlaps if setup in this component.
- Text - A text component allows for an editable string to be added to the world to display information to the player. The text component can be updated during the game through the use of a script.
In-Editor Testing
As you build your game, you're going to want to test it.
Using the start/stop button within the editor you can test your game on the fly, however currently the changes made during playmode will last when it is stopped unless reset using the Reset function in a Script Component (see the trello card).
References
Physics / Collision
- Real Time Collision Detection - Christer Ericson - The best book I have found on collision detection. There is so much content in this thing.
- Game Physics Engine Development - Ian Millington - This was good up until I realised it didn't actually cover 2d rigidbodies and it was all 3D.
- Physics for Game Developers 2e - David M Bourg - This was the second attempt to find a good book book to replace GPED and this covered alot of the right stuff but there were alot of formulas that felt unnecessary but it was indepth.
External Stuff
- SDL2 - The core of the engine is currently built upon SDL2 for input capture and rendering.
- DearIMGUI- The editor windows are all using DearIMGUI, specifically the docking branch to allow for users to move them around.
- Build Counter - I used nothke's build increment scripts in my pre-build step.
Status | In development |
Category | Tool |
Platforms | Windows |
Author | Hal |
Tags | 2D, Game engine |
Links | Source code |
Install instructions
To build and use any custom scripts, the Visual Studio 2022 build tools need to be installed. These can be found HERE under All Downloads -> Tools for Visual Studio. Alternatively, you can install a Visual Studio 2022 environment and the build tools will be included.
The solution will also try to open Visual Studio 2022 as the default editor but this is not necessary as you can edit code externally and use the script rebuild buttons to rebuild the DLL outside of Visual Studio.
Leave a comment
Log in with itch.io to leave a comment.