Upsilon Engine

Upsilon Engine

This is a game engine I’ve been working on for some time on and off, weekends and evenings, I don’t currently have the source code available to the public. The engines designed from the ground up to be simple, it’s not being designed as a general purpose engine I’m actually developing it with the intention that some day I may use it as a back end for some of my own games, not to mention Its an enjoyable project to work on.

The engine is the successor effectively to the game engine I developed for my dissertation while I was at uni, it is in every way what the other engine should have been. Part of the issue with my first engine was I was very new to OpenGL and graphics API’s in general and so I didn’t necessary make the best decisions or have a good grasp of how to best utilize these API’s.

 

 

High level overview:

While planning out the basic architecture of the engine I produced a rough layout of the key interactions in the engine. This was only designed to be a rough layout there has even in fact been a number of additions and alterations to the architecture since then that are no detailed in the diagram below.

 

Third Party SDK’s and Libraries

The engine makes use of a number of third party libraries, so far the list is as follows.

  • OpenGL – For all my graphics api needs
  • SDL2 – For window & input management
  • SDL2_image – Good clean/ simple solution for loading png’s
  • libpng – used in conjunction with the sdl image library
  • GLM – Maths, matrices and vectors, in the past have rolled my own solutions but isn’t worth the debt
  • Fmod – Great low level alternative for OpenAL for handling audio

 

Whats In the works, whats cool?

  • I’m working on my own simple physics system, using a dynamic AABB tree for broad phase sorting.
  • Rendering is fairly simple, you create a mesh rendered and you create a mesh, you assign your normal’s, vertex coords and texture coords to the mesh and your good to go.
  • Still in the process of adding fmod though not too complicated have not yet got round to finishing it
  • It has an entity centric architecture, create an entity add your components, add the entity to the scene
  • It has multiple window support thanks to SDL 2, though I haven’t figured out what to do with this yet, I originally planned to develop my own GUI system with dock-able windows but more recently have decided I want to have a semi functional engine this side of the century so will probably opt for third party solutions, if at all!

 

Rendering example using the sprite renderer:

#include "PlayerController.h"
#include <Material.h>

namespace UpsilonGame {

	bool PlayerController::init()
	{

		/// Create the players sprite renderer
		this->spriteRenderer = this->getParent()->addComponent<UpsilonEngine::USpriteRenderer>(); 

		//hack for now
		UpsilonEngine::Material* _mat = new UpsilonEngine::Material();
		_mat->init("assets/steve.material");

		UpsilonEngine::USpriteAnimator* animator = new UpsilonEngine::USpriteAnimator();

		UpsilonEngine::USpriteAnimation* run = new UpsilonEngine::USpriteAnimation();
		run->pushFrame(0);
		run->pushFrame(1);
		run->pushFrame(2);
		run->pushFrame(3);
		run->pushFrame(4);
		run->pushFrame(5);

		animator->addAnimation(run);

		this->spriteRenderer->setAnimator(animator);
		this->spriteRenderer->setMaterial(_mat);

		return true; 
	}

	void PlayerController::unload()
	{
	}

	void PlayerController::update()
	{
	}

	void PlayerController::render()
	{
	}
}
Sprite Renderer

 

Then adding to the player to the scene is as follows:

#include "Game.h"
#include "UScene.h"
#include "PlayerController.h"

using namespace UpsilonEngine; 

namespace UpsilonGame {

	Game::Game(){
	}


	Game::~Game()
	{
	}

	/// Performs game initialisation - game will exit on return false
	bool Game::init() {

		// Get the scene manager service 
		USceneManager* _sceneManager = UServiceLocator::getSceneManager();
		UWindowManager* _windowManager = UServiceLocator::getWindowManager();
		UWindow* _mainWin = UServiceLocator::getWindowManager()->getMainWindow();

		this->scene = _sceneManager->addScene();

		this->camera = new UEntity("Main Camera");
		this->player = new UEntity("Player");

		Material* _sky = new Material();
		_sky->init("assets/sky.material");

		UCamera* _cam = this->camera->addComponent<UCamera>();
		this->camera->addComponent(new UBasicSkyBox(_sky));

		this->player->addComponent(new PlayerController());

		_mainWin->setActiveCamera(_cam);

		this->scene->addChild(this->camera);
		this->scene->addChild(this->player);

		return true;

	}

	/// Update game logic 
	void Game::update() {

	}

	/// Render game 
	void Game::render() {

	}

}

 

And finally starting the engine!




/**  Main entry point for the application.*/

#include "Game.h"
#include <Upsilon.h>


int main(int argc, char* argv[]) {

	// Create the game object, add to engine instance 
	UpsilonGame::Game* _game = new UpsilonGame::Game();
	UpsilonEngine::Upsilon* _upsilon = new UpsilonEngine::Upsilon(_game); 
	_upsilon->start(); 

	delete _upsilon;		_upsilon = nullptr; 
	delete _game;		_game = nullptr; 

	return 0;
}

Leave a Reply