Showing posts with label game. Show all posts
Showing posts with label game. Show all posts

Sunday, 19 February 2023

Home Game Engine : Physics Debugging Tool Progress

The last week has been invested into the Physics Debugging tool, it connects to the main game world; whether that is running in the client with it's own vulkan renderer, or into the server, for I am planning to have the server be authorative over player position at least, to prevent some of the strange hackery doo of the client being in charge.

Here's a silent video of that progress, as I'm recording from my Ryzen Workstation and I don't have a mic in here.

There is actually a lot going on in the background here, though the scene looks largely unchanged.

The most obvious addition since the last scene update is the replication of the rotating object, which is just a box, but that is being rotated on the client.  My controls here send a message to the client, which then sends the status update to it's GameObject.  The same frame the GameObject queues a message out and the scene updates to the physics representation; which means I get near real time (minimum of network delay + 1 frame) of the replication of an object back and forth.

However, I don't plan on expanding that too much, the number of messages is getting silly.  For example, I have an object for a position update (3 floats) then I have one for a position and a rotation (6 floats) and then a whole other one for position, rotation and scale (9 floats) which I call a transform.  I could just replicate a transform each frame, but then the amount of data gets very much larger.

I also have flash backs of delivering data from a server on a provisioned box, where you pay by the megabyte per monthly usage (and I honestly don't know why I couldn't host a service like this server publically on my massive 500mbit home fiber, which has no cap on data, it's all I can eat) but practically, I'd not like to host this here, except for debug, and if I were to make a game, it'd need to be on an AWS instance or something.

Anyway, that's all very much future stuff, my next problems are all about the game, improving and cleaning up my game object authoring, improving my model making skills (I might actually have to double down and actually learn Blender) and the working out a few issues I know exist in my control scheme.

More about all that in March though, for the rest of February, I have to tidy this stuff up.

If you want to know more, or follow some of my other older projects and videos, my YouTube Channel exists https://www.youtube.com/@LordXelous and of course this blog is always ticking over!

That Subscribe button really helps!

Sunday, 5 February 2023

Physics Debugger in my Home Game Engine

It may not look much, but this is a huge step forward in my home game engine development.  This is a physics visualization tool I've written, to show me the shapes I register with my physics simulation, it communicates with the game client one frame behind the client, and lets me zoom a camera around the world to see whether shapes line up and to take a snapshot of the physics/collisions being resolved this frame.

The whole physics system is pretty much a bag of spatial checks at the moment, for instance I ray cast from a given point to the four corners of a cube to test whether the point is within, that's pretty compute-intensive.

But at least now I can see there is only one such cube (the purple/pink) one in the scene.

I can also clearly see the ground mesh (the yellow/red triangles).

Infinity is just the blue.


Also, this rendering of the physics world is using yet another renderer I've put together, again integrating ImGui as my defacto GUI in such circumstances.

I need to do a lot of work on this, but it's just a fun project.

And recently having a bit of run, something you can tinker with, something which just makes you think and relax is perhaps key to improving ones skills.

Before I started this whole home game engine (despite working on games at work) I had no idea how to put a renderer together; even as badly as I have; and certainly no idea about a physics engine, now I have the rough knowledge of both.

My home project backing up my experience at work, and also the home project lets me try things I might not otherwise do at work, like totally break things... Oh no wait, I break things all the time....

Monday, 29 August 2022

Home Engine - Bank Holiday Camera Controls & More Models

After the silence earlier in the year I'm so happy to be blogging more often, and I hope you are all enjoying it too; I can see some regulars popping by and a few new faces in the stats list; but still far too many of you are totally anonymous, drop me a comment!

Anyway, what I have I been up to?

Well, under the hood I've totally revamped how the uniform buffer objects are passed to the rendering operation in the vertex shader.  I've also moved the view and projection matrix calculations into a nice camera system class, so they're contained and sensible to use.

As a result I've then added some key bindings to move forward, strafe and rise/drop the camera on the plane of x-z.  Likewise I've added a free mouse mode to let me move the mouse and fly over the terrain.

Speaking of terrain I've added a checker board to show me the X-Z plane at about -0.5 Y.


I also noticed a winding order in my Blender exporter tool, I've not fixed that in the python, just patched it in my loader and created a few more models to start building out a play space.

Technology wise I need to make the camera more usable - a full third person camera basically.  Then I would like an orbit cam, which moving in the strafe would move it around the locked object.

Then I'm going to think about texturing and lighting.

The solid coloured aesthetic is intentional though, so anything more fancy is a low priority for me.

I am feeling much more comfortable in Vulkan though; and of course enjoyed moving all the glm implementation from the first (and second passes) over this project.

That's perhaps something I've not mentioned to you before, this project as a home engine... Well I've started and restarted it a few times.  The original was in DirectX9 way back; I wrote a page about it in 2004.

Then I re-wrote that in fixed function pipeline OpenGL; that didn't go very far, indeed I received a letter to cease and desist from an IP owner for that particular project's name was known in the wider world.  That IP has moved onto yet another owner now, so best of luck to them.

I however was knocked for six and it wasn't until 2018 that I started to look at a game engine at home again, spurred on by my change of job; and I really enjoyed that first pass, but it didn't focus on the graphics side of things, it was far more about the technology such as threading, memory management, and something you may have heard of, an Entity Component System.

All those pieces remain.

But this new project is very much just about my putting features together into a renderer, indeed the application level item is called "renderDemoApplication" and that is all this is.

What might the game be?  I'm still thinking about that, but I have three strong contenders and when I've picked one, you folks will be the first to hear about it.

Thursday, 25 August 2022

Home Engine - Blender Export & Model Loading

Some progress in my home engine has been had, first of all multiple geometry rendering through my fixing up and better understanding both render passes and descriptor sets.

All of this is nuts and bolts, what I want to get to; just like the DirectX 11 rendered version; is to play with 3D geometry and placing objects into a scene.

To this end my hand written geometry is no longer hacking it, and you will have seen from my raw game engine posts I did use Milkshape 3D.

Milkshape, lovely as it is to my eye, is not a modern well featured 3D suite and sadly does not let me easily plug into the geometry live within it (one can only export and perform post-processing).

To that end I delved into how one might write a Blender add-on to export your own format...

Long Story short, here's my text intermediate output from just such a plug-in written in python.

The plug-in is far from robust, I followed the lines of another open source plug in and applied my own, copying it into blender with a batch file and clearing the pycache each time I perform an edit.

But it is doing the job I initially want, and I get my own format of file output.

And indeed I can load these into my engine...



I can work on the axis for the data output and start to ensure my camera system from the main client works as expected in vulkan; since the maths here is exactly the same code I don't anticipate any issues.

This should free my mind up to think about a lighting system and to finally get back to where I was with the coloured cubes in the DirectX 11 version and ultimately onto a full scene.

I have four constant things in the world, a ground plane, a skybox and a center marker flag (showing X, Y and Z axis respectively) with a quartet of boxes in the center of the scene.  This is the test scene for the "world" loaded into the scene graph.  And it's where I want this to be this time next week perhaps.

Since progress has been much quicker now I'm past the deep dive into learning the initial set up of vulkan.

I can also appreciate much more why folks just pick up an off the shelf engine, I myself make little prototypes in Unreal Engine 4.  But this kind of denudes me of the walk through these technologies.

For the most part creating an engine like mine, which is planned to have solid shaded low poly vehicular combat, well it's a solved problem, so I'm enjoying following in a lot of well trod foot steps to better my understanding of the processing, memory, mathematics and challenges in writing a game engine.

Friday, 19 August 2022

Home Engine - Set Course for Vulkan

Over the last year I've been experimenting with writing my own home game engine, initially I spent time writing my own line rendering and then a wrapper with SDL2 all using my own mathematics library as a refresher.

Then I set up an engine framework, switched my own none-peer reviewed and frankly shaky maths for glm and started to use DirectX11. You can see a clip in my earlier blog post here.

I dabbled with other graphics interfaces, but ultimately I wanted to land on one of the two big modern interfaces, either DirectX12 or Vulkan.... And since I'm a linux guy at heart Vulkan won out. The difficulty? Well, setting up a Vulkan renderer just to render the "Hello World" triangle is over a 1000 lines of code.... And well, I wanted to write a framework as I went so I could just port this Vulkan back-end work into my abstract renderer API for my existing DirectX11 driven engine. That is my next step, but tonight, after a few hours each night this week I've finally gotten to the 3D step and I'm so excited I wanted to share with you.
So here we see I have multiple pipelines & render passes. It's creating and submitting multiple command buffers, I have integrated ImGui very roughly too.

But this is the first time I've used the uniform buffers, descriptor sets and descriptor layouts to send a uniform buffer (MVP) to the shader and get actual 3D.
I'm strongly following this online tutorial.

Though I also have the Vulkan Programming Guide official book and I'm writing my own functions as I go so the porting to the existing Home Engine API is minimal (or rather as minimal as I can get it).


One of the key pieces of tech in the base engine (driven happily by DirectX 11 when I switch to it) is a full camera fly mode system and a scenegraph rendering models.  I've also got a python driven exporter written for my own model format from Blender (and desperately need to get better with using Blender).  And I have a Python driven project generator (which calls down into CMake quite neatly).

The engine is structured into six major modules:

Base - which contains a host of utility functions, data types and tooling assistance.

Ecs - yes, I'm writing my own Entity Component System.

Renderer - The abstract renderer API which the application level creates and uses in the main game loop.

Application - Main app & game loop, I'm using SDL2 as the main interface here for input & window management in a cross platform manner too.

Physics - A basic hand written rigid body physics implementation, at the moment it really only supports rays, cubes and sphere intersection tests and I'm thinking of shopping around for an off the shelf something.

Game - Contains specific game logic, like spawning, camera controls, input mapping and uses base to provide timing.

This is all very rough and ready, it's a project to keep me interested in my craft really.

And putting Vulkan into the mix has been a real nice way to resurrect where things where, as you may gather I had the DirectX 11 and basic camera system all working in October 2021; but I've been a busy boy since then, both with work, life and moving house....

Now the new office is done and I'm building models in real life, I figured it'd be a nice time to build them in virtual spaces too.


P.S. I have no idea why some blocks are in white backgrounds, very annoying of Blogger to do that?

Monday, 20 September 2021

Home Engine - Lines and Camera Interaction

 Yes, yes, it has been a while; both here and on the YouTube channel, I've just been very busy okay?... Okay.  Friends?... Friends.

So what have I been up to in code?... Well today I added line rendering to my home engine, this is still using the underlying "Triangle" raw data, so I have to always have a cleanly divisible by 3 (for the sides of a triangle) number of indices in the data, but otherwise it just seamlessly integrated.

Its using "LineList" as the underlying primitive type, which maps to the D3D11 type under.


I also noticed that these lines from 0, 0, 0 to 1, 0, 0 and 0, 1, 0 and 0, 0, 1 respectively are "backwards", that is my unbeknownst to me at some point my camera has started to spawn around in front of there my scene objects are, so I'm looking back along the Z axis not "up" along it... Am I making sense?

I also improved the camera some by linking the rotation of the camera to the mouse, which makes it super intuitive.

The failed part of the work this last month was an effort to update both the Vulkan and the OpenGL renderer implementation.  This was an utter failure, the simple reason being that I've gone too long with my limited knowledge with DirectX.  I'm sure the "port" to DirectX12 will be easier, but yeah, I've already gotten the other API's so far from my implementation (abstract base classes) that it's quite alien to return to them.

I'll circle back on that, maybe break down the API's with failed/broken builds until I can slowly etch away at the challenge.

Saturday, 20 June 2020

CubeWorld - Where's my key?

I bought CubeWorld back in the day, and I just heard it was actually released, this really annoys me that I've heard it's been out ages... and apparently wasn't as good as the demo even in the end.

But the really annoying thing is that apparently early buyers like me were meant to get a code to play the game?!?!

Where's my game key?.... What a total cock up he made of that game.

Thursday, 14 December 2017

Manifold Garden - Chyr's Update

I've previously mentioned William Chyrs work of art that is Manifold Garden in previous posts, however, he's just released a development update to the world that the game is slightly behind schedule, but he is hopeful of an early 2018 release.


You hear more from William himself on YouTube below:


Or you can get the low-down via the Steam app entry here.

I'm sure, if you're anything like me, you'll still see this amazing development as worthy of your attention.

Enjoy!

Friday, 3 February 2017

Games : I don't get...

I don't Diablo, there I said it, I don't get it... I play D&D, I play Pathfinder, I played World of Warcraft, I played loads of other RPG stuff, but never Diablo... There... I'm out, I'm officially out...

To Paul and Max whom both told me I should play Diablo, and indeed I think Paul you lent me the game, I never played it... I don't get it.

Tuesday, 16 August 2016

Programming : SDL_Window* into std::shared_ptr

I've had a little bit of a brain fart this morning, so to save you all the trouble, I'll go through it... First of all, I am working on an isolated system, therefore I had no internet, no clues, and importantly no books... This is a drag, because mainly I'll check things out look things up and just make sure I get things right... When things go wrong.

Unfortunately, things went wrong, and it was very early (for me) and I was unable to see the problem.

extern "C"
{
    #include <SDL.h>
}
SDL_Window* theWindow = SDL_CreateWindow (
    "The Window Title,
    SDL_WINDOWPOS_UNDEFINED,
    SDL_WINDOWPOS_UNDEFINED,
    800,
    600,
    SDL_WINDOW_SHOWN);

This code will create an SDL window at a unspecified location, with a size of 800x600 and the imaginative title "The Window Title".

This is fine, however, I hate seeing raw pointers, that "theWindow" variable irks me, it's just wrong to see that in modern C++ code; even if I am using a C based library.

So, I wanted to set about wrapping that into a smart pointer:

#include <memory>
namespace Xelous
{
    using SDLWindowPtr = std::shared_ptr<SDL_Window>;
}

This is my wanted type, "SDLWindowPtr", I know what this means to me, and I wanted to have a creating function wrap this for me:


The trouble?... This is considered an incomplete type, when we pass "SDL_CreateWindow" to the smart pointer ctor, it reports "incomplete type".


You can see the full error above, click to zoom in on the image.

So, what have I done wrong?... Well, the brain fart is to forget that "SDL_Window*" does not contain a standard destructor, it actually needs to be passed to SDL_DestroyWindow to close it down & release all resources.

I had totally forgotten this detail, I was too focussing too much upon the creation step and not thinking about the window objects life cycle.  The result was about 20 minutes wasted time banding my head wondering why this was happening.

Two cups of coffee and a pint of water, plus a wander down the corridor later, and I had that moment of realisation about this.


And so my code evolved, giving the solution to create a nullptr smart pointer result, then reset it to use the newly created window and instruct the smart pointer to use the SDL_DestroyWindow call for the clean up.

The complete code for a user might be more like this:

#include <string>
#include <memory>
extern "C"
{
    #include <SDL.h>
}

using SDLWindowPtr = std::shared_ptr<SDL_Window>;

SDLWindowPtr CreateWindowPtr (
    const std::string& p_Title,
    const unsigned int& p_X,
    const unsigned int& p_Y,
    const unsigned int& p_Width,
    const unsigned int& p_Height)
{
    auto l_result = SDLWindowPtr(nullptr);
    l_result.reset (
        SDL_CreateWindow(
            p_Title.c_str(),
            p_X,
            p_Y,
            p_Width,
            p_Height,
            SDL_WINDOW_SHOWN),
        SDL_DestroyWindow);
    return l_result;
}

int main ()
{
    SDLWindowPtr theWindow = CreateWindowPtr(
        "Hello World",
        10,
        10,
        800,
        600);

    SDL_Delay(5000);
}

We don't need to remember to SDL_DestroyWindow, we don't need to worry about forgetting to clean up, the smart pointer will do it for us when the reference count drops to zero.


Friday, 29 July 2016

Gaming : SuperSnake.io - New Personal Best


Just shy of 20 minutes growth... Not bad... Died to a super snake, he clipped the last of his fifth gold tokens as my venom spit struck, and... boom I popped, but I was quite happy with this performance.


Saturday, 9 July 2016

Supersnake.io - Still Going

New High score... level 50...


I actually made it to level 55 before something lagged out and I hit a wall... 

Sunday, 26 June 2016

World of Warships : Cruiser Grinding

I've been, between lots of work, playing some world of warships this week.  I've actually been pushing my German Cruiser grind from tier IV to V.  Which I completed earlier...

I've had some excellent games, admittedly I've only been playing Cooperative, but it has been great fun.  And I love the option in Warships to play cooperatively.





Thursday, 19 May 2016

Blog Update: Mid-Session

Yeah, so what do I mean by mid-session?

Well, I'm midway through an awful lot of little projects, and right now (well about 5 hours ago) I actually just got home from a holiday (vacation to our American cousins)... So, lets just go over what I'm working on, what I'm planning for you guys, and when I plan to do it, saving time slips.

First, the server fan project, the fans have been modded with new resistors, they all still work, and the server boots.  And it a LOT LOT quieter, however, the BMC does start to moan after a while and it ramps the fans up to 100% screaming again when they drop below 2250 RPM.  So, I'm still working on software patching that...

Second, I have an introduction for you guys for the servers, covering all the little bits of kit I found in them, including memory installation, RAID controller configuration & installation, DRAC set up, and even re-working an Intel Dual Gigabit 8x PCIe.  Well I say re-working, I took the heat-sink off and put new shiny thermal paste on it to help it run cooler with the slower fans... Anyway, all that is coming up.

Third, what am I actually going to be doing with the servers?  Yes I have two new things to announce, watch this space.

Fourth, again a server item, racking them... I'm planning on building my own mini-coffee table style rack from some ikea items... However, this is a very low priority and depends on Pay-day coming around.

Last Server Item, it the new drives and RAM upgrades I've order, yes a whooping £20 has been spent!  However, I'm reaching out to several ebay and Amazon traders looking for partners to bring you new and exciting content as well as giving them reviews for their kit... So, watch this space for more kit being reviewed in my unique style.  To those vendors I've sent missives to... Get back to be folks, first come first served... I've got a Server CPU provider already negotiating... I'm missing RAM and cable providers... (hence why I've bought the first round of items for review & use).

Sixth, this is a software project, one of my most popular post series is my old, original, "Write your own CPU" series, which I think is pretty crap, I never finished it, never went beyond the basic add & sum op codes.  The later 4004 tutorial is not as popular (despite it being vastly superior), so to help my viewers see more of my blog and sites I'm going to be making a video series about writing your own virtual CPU.

I've got a bunch of real Z80 chips lying around, and some LED's, and a breadboard, so I may very well make a simple Z80 stepping/tester board and then we can write something similar in C++.

Seventh, Java code, the java series I had gets a fair view YouTube views, but I never see those viewers come through to here, so we need to figure out someway to get them java folks to read more than one line of text at a time!


So that whole series needs a tidy up, and the game itself there needs some new loving.

Eighth, I have some more Socket 775 modifications to work on, these are very very low on my list of projects, as I bought them at exactly the same time as the new servers came in.  And since the servers work, and are dual socket quad core Xeons, they are far more performance ready.

Very finally, I need to sort out the work-area, I have a new lovely digital controlled soldering iron, I have the Z80 project to solder, and three different arduino powered projects for the father-in-laws DCC train-set hobby to work on, so all those are coming this way, the first will be to mount the arc welding effect lighting into a single board solution.  Then I have an RGB effect lighting board to build to emulate a glowing set of fires for him.  Then finally a 5v DC motor project to power with PWM and emulate a set of coal-mine head stocks turning.



Saturday, 14 November 2015

Human Resource Machine - Review

Another game I've been looking at, and enjoying, is one I saw Jacksepticeye playing abysmally on YouTube, I'd been aware of the developers of this game for a while, through their game "World of Goo", though I missed their second title.

So I was happy to pick up this, the third, the first game I've seen being a puzzle style game, based around what is essentially programming.  It's a form of assembler almost, as you have to really think hard to move values to registers, and jump for the comparisons, this is not your higher level language style thing at all... I'm about 1/3 of the way through, and enjoying it immensely.


The premise is to complete the task, so initially this is just to carry everything from left to right, "input -> output" over and over... So level 1 is easy, but then you can "optimise" it, using less commands might be "Start:   Input  ->  Output:  Jump to Start".


You run this, and it take just those three commands, but it takes lots more steps than just going "input -> output, Input -> output"... Giving you the end result challenges...

 


You can step through the "program" for your little man, and you debug what you're doing, and it does actually teach some very good lessons, I've had to teach myself to be ruthless, as I find myself very much programming verbosely, copying to place to place to compare things, when I could just hold one copy and compare to a value already stored etc, it's hard work to get things right, but then it's even harder to get the optimised number of instructions, but then sometimes harder still to get the right number of optimised steps, you literally (like a compiler) optimised for speed, or optimise for size...


At £7, this has been a great buy, and the music is nice too.

Saturday, 26 September 2015

Chess - Win

In my prior post I had posted that the en.lichess.org community was a little toxic, well, I'm happy to announce the registered community is actually quite nice... so far...

I decided after doing a bunch of the "openings" training (and being bad at it) I'd try a rated game...


I won, and not only did I win, but I had the opponent "Vecky" chat back to me, and it was a nice game, I enjoyed it.

As I said in the chat there, I celebrated with a nice coffee :)

Friday, 25 September 2015

More Chess - Toxic Players

I'm beginning to find the online Chess community a bit more feeble than I remember... I used to play on Yahoo Games Chess, years ago... I even met a lass through it once, seriously, chess got me laid... However, playing on en.lichess.org, I keep having my opponents leave the match!


In this case the chap had the upper hand, my opening went wrong, he moved his bishop aggressively into my centre, but then my knights rescued the situation and he left?!?!?!  Leaving me to just have to wait for his time to end or "claim victory".


Wednesday, 1 July 2015

World of Warships

How absolutely symbolic of the shambolic lack of clarity from WarGaming... World of Warships is released to the public... You can download and play the game now... 

And it's an excellent game, one I've been waiting for for months... However, they announce this and that as public, then when you check it's not and then finally when you do find the public release it's already gone midnight and one has work in the morning... GOD DAMN IT!

But this game is really good...

I've played just two games and it's really nice, I guess later it will be a huge grind but I took my USS Erie level 1 US Cruiser out for two spins and it's been brilliant... I will have a play about with this first ship before I rush up the tech tree, I'm in no hurry... But so far this is a WarGaming title I think I'm going to really enjoy.


There's my first battle results, a victory, and I sort of knew what I was doing; having watched so much youTube footage from the likes of Jingles.  But I kept my head down, no torpedo's in the game, and I got hits learning the controls.

From this one game I got enough XP to unlock the heavier guns for the ship, they fired slower, so I'm going to go back and experiment with the two types, but with the heavier guns I immediately did more damage and sank two ships... in just my second game... I don't see many YouTubers nailing two ships like that often.


So, yeah, new game for me to enjoy...



Friday, 24 April 2015

Dungeon Crawler - C++/SDL - Loading Maps

Very quick update, I've been taking the XML Maps from the Editor in it's current form and loading them into the actual game now, this has required a change of several subsystems inside the Grid/Map loading code.

The most important change has been caching one copy of each image, so minimising memory use, and then customising them at a surface level to add walls, drawing all this once and then just rendering the one single image we hold in RAM, whilst the rest of the images can be dropped out of memory to again free more resources.

Anyway, here's a screen shot of the game (background left) with the map editor open showing the map in design.


Path finding of course routes around the walls, and tiles can be toggles as blocking or not, opening up the ability now to add doors or even hidden/false/magic doors.

Thursday, 16 April 2015

Dungeon Crawler - C++/SDL - VLOG 3

The third VLOG in this on going series, see's me finding I've unexpectedly broken token collision detection.... But I'm; at last; loading maps from the MapEditor.

I've also fixed scaling issues which were causing the map to scale to the screen when it was a map which was intended to be smaller than the view area of the screen.



Update 3.5