Thursday, 8 June 2017

Game Engine 08/06/17

After a week of trying to get CSM (Cascaded Shadow Mapping) working I finally did it. :P

I had a lot of problems finding info about it on Internet because most websites didn't have everything I needed so I had to scavenge a little.

Here is a video of the new shadows:



Now I'll finally start working on the Game Logic. Me and a friend of mine are creating a document containing basically everything the game will have and how it will be. It's a kind of a mix between Supreme Commander and Tower Defence genre but it's played in 3rd person (we have a character).
More info will be released with the document.

Wednesday, 31 May 2017

Game Engine 31/05/17

I've finished implementing shadows + deferred rendering and I had some frustrating errors relating to shadow acne and transforming camera view space to light space, but I managed to go fix it all.

Here is a video showing the new looks of the graphics:



For shader loading I wrote a "compiler" from a customised version of GLSL to normal GLSL.
For example, I can write this:


$$VERTEX
// This becomes the vertex shader

$Position$ in vec3 vertPosition; // Automatically assigns this attribute to the vertex position

void main() {
    [...]
}

$$FRAGMENT
// This becomes the fragment shader

out vec4 fragColor;

void main() {
    [...]
}

All of this makes it easier to write and store shaders (single file, instead of multiple).
I'm might add CSM (cascaded shadow mapping) as it is better for large terrains and spaces.

Tuesday, 30 May 2017

Game Engine 30/05/17

Okay I just finished implementing SSAO (Screen Space Ambient Occlusion) with OpenGL and GLSL on my Game Engine and it's working pretty fine.

Now there is a feel of depth that wasn't before. Here are some images to compare before and after SSAO.

Before


 After

As you can see it's way better now but I think it still looks strange. I'm planning to add shadows to make it look nicer.

Monday, 29 May 2017

Game Engine 29/05/17 - Part 2

Here goes the part 2 of my Game Engine showcase.

More systems and functionalities I have in my engine:
  • Framework: Basically this is the engine core, everything depends on this chunk of code to work, here we have things I already wrote about such as the FileSystem.
    • Locator: Maintains pointers to services, for example, the moment I startup the Graphics system, it provides itself to the Locator and the Locator stores a pointer to the system. Now when I call Locator::GetService<Graphics>(), I get the Graphics system in return.
    • Service: Used by Locator as described above.
  • Physics:
    • Physics: Manages Rigidbody's  and updates them.
    • Rigidbody -> Component: Applies basic physics to GameObject, for now its only used to apply forces to a GameObject, such as gravity and drag. I didn't add collisions because i wont need it for the game I'm making.
  • Collisions:
    • Collisions: Manages Collider's and updates them.
    • Collider -> Component: Tests collisions between other colliders, if there is a collision, notifies other components of the GameObject of it.
    • Derivatives of Collider: Tests for multiple shapes of collisions (BoxCollider).
Here is what I'm already able to do:



As you can see I can now load models (with skeletons, meshes, materials, textures and animations) and render them unto screen. In this case I'm not loading an animation, this animation is done on the fly.

It took me a week to only get skeletons up and running because there is little documentation on the internet about it.  What really helped me the most was this website I found after some digging. I had already done some stuff with skeletal animation a year ago and I had the same problems.

I'm planning to add deferred rendering which I will talk about in the next post.

If you have any questions or suggestions post them in the comments or contact me through email: riscado.antunes@gmail.com

Sunday, 28 May 2017

Game Engine 28/05/17 - Part 1

I didn't upload messages to this blog for a long time because what i was making wasn't really visible.

Now I have made a lot of progress and I'm planning to start working on game logic in a week or two.

Here is what i've already done:

  • Messaging System:
    • MessageBus - Handles messages and sends them to the message listeners
    • MessageListener - Receives messages to MessageBus. Can also send messages to other listeners through MessageBus.
    • Message - Has a void smart pointer pointing to its data and also has a type. MessageListener's can subscribe to certain types of messages.
  • Resource System:
    • ResourceManager -> MessageListener - Stores resources and sends them as needed. A resource can be requested through messages.
    • Resource - Used to store data about many things such as Model's, ShaderProgram's, etc. Also used as an interface to load the data.
    • Multiple derivatives of Resource (ModelResource, ShaderResource, etc.).
    • ResourceRequest - Serves as an interface to sending messages and requesting resources, making it much easier.
    • FileManager - Platform independent class to read resource file tree and load files.
  • Graphics System:
    • Graphics - Handles Renderer's and everything relatable to graphics
    • Renderable - Anything that can be rendered unto screen (pure virtual class).
    • Renderer -> Component - Used to draw a Renderable (BTW Renderer's have layers, such as the Transparent layer, the Default layer, etc.).
    • Window - I'm using the SFML library for handling windows, UI, networking and other utils. If you haven't checked it out, you should, it's really useful for small projects.
    • I also have derivatives of Renderer (ModelRenderer, etc.).
    • That's it for now. I'm planning to add AO (Ambient Occlusion) in some time.
  • Scene System:
    • Scene - Handles GameObject's and Component's. Also updates Behaviour's.
    • GameObject - A bunch of Component's tied together with a Transform and a parent GameObject. Also serves as a mini MessageBus for components.
    • Transform - Specifies a transform for anything (Translation + Rotation + Scale).
    • Component - Basically every functionality of the Engine uses this. Basically, it's just a piece of code to be executed by some System (for example, Renderer -> Graphics).
    • Behaviour -> Component - Everything that is related to game logic derives from these. They are updated by Scene.
I also have made a basic Physics and Collisions systems, which I will write about in the next part.

Feel free to write suggestions in the comments or ask questions. You can also send an email to riscado.antunes@gmail.com if you want to ask anything.

Monday, 24 April 2017

Game Engine 23/04/17

So i've restarted the work on my game engine and i'm taking as basis the following books:
  • Game Engine Architecture (2nd edition)
  • Game Programming Paterns
My engine is message based and will use game objects/component architecture. I already have the basis for the system, such as the MessageManager class (sends messages to the target systems) and System class (receives and sends message from/to MessageManager).

I also created the following systems (classes that derive from System):

  • Console: receives input from the player and allows me to fake other systems by sending messages and receiving them;
  • Graphics: handles window creation and destruction, handles OpenGL calls and Renderer components (a component that can be put on GameObjects to draw them);
  • Resource Manager: handles resource loading and destruction, manages file tree and prevents resources from being loaded twice.
I will continue posting here the changes i make.

Tuesday, 15 November 2016

Game Project - 001

I've been programming a new game lately, and it is yet in a very early stage. It is mainly about surviving in a hostile world, but i'm still designing it. It will be also played with a top-down view, and you will control a player. I'm planning to make temperature, food and water the most important aspects of the game.

The problem is that i'm being slowed down by the need of textures. I'm hoping that some of my friends can help me making them :P

Here is a pic of what I've already done:

As you can see I already have "smooth" transitions between different types of terrain
I still need to improve the transition textures.

I will be keeping you updated with what i do in terms of progress. Currently, I'm trying to implement "entities", for example, trees, players and animals.