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!

Saturday, 18 February 2023

Programming the Thought Triangle

As a programmer I spend a lot of time with my mind on the problem space I'm tackling, my hands are on the keyboard, my eyes are on the screen and this trinity is my creative process.


If you start to talk to me from a room away, if you come to my door and start to wave at me to get my attention, if you keep calling my name, if you keep calling my phone or sending me texts... Do you know what you are doing?

That's right, you are totally derailing my thought process and creative flow.

You, the interrupter are pretty much responsible for costing me a complete mental problem space unload and a complete mental space reload.

That is very stressful for a programmer, it's a huge amount of mental gymnastics, which is tiring, difficult and above all unnecessary.

If you have a child at home who shows any interest in programming, and they're busy doing it, or "playing" on the computer, but there's no actual game showing, just let them, leave them be.

You don't need to train them to program a computer, you need to train yourself to not interrupt them, that screen to fingers to thought triangle needs to be left where it is they need to be left alone.

Social Media!!!  Now, I have to add a prickle problem into this, you maybe training yourself to leave a creative alone and leave them in their screen to fingers to brain triangle of creativity.  Now, is the same true of someone deep into social media?

Well, sort of, the key different I find is creativity, are they being creative in their little bubble?  Are they learning?  There are clear flagging indicators of a problem, where you do have to step in.

Communication?!?!  Even more confusing is where we come to the screen to fingers to brain communication items, I can certainly relate to being deep into typing an e-mail and someone is saying my name over and over; that person does not respect that I'm actually doing something, they do not lend any value to the fact I am trying to write an email.  Immediately I point out that I am in the midst of a creative effort, that person therefore needs to train themselves to not interrupt.  They're being rude and disrespectful.

However, is the same creative tag so easily applied to having a chat?  To having a visual chat with someone over WhatsApp for instance, no.   I don't think it can be, when two people are talking face to face you can interject; you can say excuse me I just need to tell you.... and speak, this is completely normal interruption.

The distinction interrupting someone on WhatsApp talking to a friend is simple, it's a leisure, it's not live and death.

Until it is life and death!  I had this argued with me, that you can't interrupt someone if it's life and death, and I agree.  But you know what, if you're telling someone something on the "live and death" scale of humanity over WhatsApp... Get a life!

In short, I think I keep meeting with rude, self centered, selfish people, who lack empathy and don't value that when I'm sat at my computer; I am actually doing something.  And I work at my computer, and I work at writing computer games, so you can not assume because there's a game on the screen I'm not busy.

However, if you see that 2 foot fixed gaze, my fingers flying and I am clearly engaged with the work a head of me... well it's pretty safe to say you should GO AWAY!

Tuesday, 7 February 2023

The Old Lady and the Server

No, this isn't some strange nursery rhym (though I wonder if it could be) no this is a story of a literal old lady whom I believe was trying to collect as many notches on her bed post as possible...

Let's start at the beginning, I lived in a house I rented, I had a spare bedroom and my younger brother broke up with his long term girlfriend.  He came to live with me, quite unsuccessfully, as his life was very chaotic, and indeed in the end I threw him out in the end.

But in the nine months he inflicted himself upon me he had a few lovers through his door.  One of them was said "old lady".

I say old she was maybe early to mid-forties, with children, but that was old, my brother was nineteen... heck I was only twenty two.

He was going through a series of different jobs at the time, and somehow he met this woman, who promised him a bunch of things; like a car, and MR2 if I call correctly.  Which he went on about constantly.

These rewards never appeared, but one day she did, one morning to be precise, I came down into my own kitchen and there was this woman in my non-smoking house smoking.  If looks could have killed she would have murdered me when I asked her to go outside to smoke.  Until she realised this was my house; so the stories clearly went both ways between them and my brother.

"Where does server come into this xel?"

Well, when my brother broke things off with her she continued to communicate with me, I'm not even sure how she knew my contact details to be honest, I think she had a nominal business address or something, in fact thinking back now, I think one of the mysterious things she promised my brother as she bedded him was to get me a job; despite my not asking.

But it seems she was looking for a NOC engineer.

Indeed, I spoke to her briefly where she was talking to me about setting up BSD servers, "My servers run BSD".  She never explained what her servers were doing (I suspected porn).

She did however offer me a job, at £4,000 a month.  That's £48,000 a year.  At the time I was in a £21,500 job doing network maintenance (which I hated, and have commented about in earlier posts).

So her offer was interesting, I took a weekend to expose myself to BSD.  I'd not really used it before, just early versions of Linux, ScoUnix and Windows.  BSD was interesting, different, but nothing I had experience with.  She kept talking about her current NOC guy.

Either way, it came to nothing, and I think that's because I never came...

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....

Wednesday, 25 January 2023

No Rack, but definitely an IT mistake

I sat down to write this on Christmas Day, but things went wrong... so here it is a mere month late!

It has been twenty years, so I feel comfortable sharing this one with you.

Christmas Eve afternoon my landline began to ring and ring and ring, foolishly, rashly I answered to hear an unfamiliar accent telling me to explain to them the complete inner workings of an intranet web service.  No hello, no explanation who they were, just a desperate voice asking, nay demanding, this information....

It took me a few minutes to collect my thoughts and realise what they were talking about.  At the time I was contracting in short sharp sprints between projects for various folks, I'd actually written three different web based systems in the prior three months; so i was trying to figure out which of the recent ones it was..... Only to then hear the name of the company and realised this voice was asking about a project I had been contracted to write nine months prior.

It was a very long ways away in my memory.

Not only was my memory foggy but I had ensured everything asked for in the contract was documented,  all the work was carried out at their offices, on their own machine, I didn't even hold a copy of their system.

Above all it was Christmas Eve!!

I explained that not only was I not contracted to support the project (a sore spot, as I usually made as much money supporting a project as doing it at that time); but this project had actually been a bit of a squeeze, for it had been two weeks work and absolutely no more.

Long story short I'd been contracted by one chap, the manager, because his in house analyst was overwhelmed and unable to cope, so he'd had me to quickly deliver this project for them.  It was a simple view over data on a few pages, driven from a server that the analyst knew and who deployed it out for himself.

The manager and this analyst signed it all off as I went, and I documented the whole thing, critically including how to edit the pages... So they only needed to know a bit of HTML, JavaScript and CSS to change any part of it as they felt suited themselves... and I left.... Getting my money a month later and never hearing anything from them.

On a shoe string I thought I had delivered them a real bargain!  Not hearing anything for all that time had made me confident they were happy.

So what was this desperate emergency?

The colour!  The guy wanted to know how to change the colours in the cascading style sheet...

It is Christmas Eve!  And this £100k per year analyst is calling me to ask for a crash course in CSS!!!

To say I was not amused is perhaps the understatement of the decade!

I politely explained that I was available (at an extortionate price her hour) from December 28th onwards and then regular rate January 3rd onwards for contracting, but right now I was not available.  And all this was available through my then solo contractor company.

The reply?  To be honest he was quite rude, at which point the telephone was returned to its cradle and the TV remote rediscovered.

The trill ring carried on until I unplugged the phone... and my mobile started to ring, my inbox fill, and my patience ran wafer thin.

But I was simply not going to be talking to this guy, my opinion all these years later was that the guy was a paper suit, he sat there getting others to do all this work for him, not even delivering to his own manager and said manager was just accepting of this for some internal political reasons I could guess at, but which were lost on me at the time.

I decided however to be proactive, I wrote up a couple of paragraphs on my headed PDF, attached the original contract, attached a proposal for employing me from the 28th for 2x8 hour slots and then from the first week back in January for 5x8 hours as a starting point.  I put this all together, with an estimate and I sent it in triplicate.... To this analyst, to the manager and to the HR department at said company through whom I had worked for them.

I then had the most interesting email, which only reaffirmed my paper suit opinion of the guy.... For this email was from the manager saying "Why are you sending me this on Christmas Eve?"

And I replied "because your analyst <insert name here> is contacting me, phone off the hook on Christmas Eve to ask me about that work I did in March".

I heard nothing more.... Until the week following the week back, I was at another contract and my mobile rang... It was a very polite voice, the manager, he wanted me to come work for them.... because Mr Analyst had left his role.

I asked a few poignant questions; essentially the chap was earning an absolute fortune (for 2002) at nearly £136,000 a year and he did nearly nothing, nothing.... he'd sat on projects, say on code, couldn't script, couldn't program, couldn't even communicate properly.  Quite how he'd got into the role I will never know.

I however simply kindly declined, I was due to go to Egypt on Holiday so I did that rather then try and fix that guys mess.

Wednesday, 18 January 2023

ChatGPT Poetry

I've had a play with ChatGPT, completely away from asking it to write or improve code snippets I asked it to generate some poetry...

Could you tell me a poem in the style of Wilfred Owen but about Strawberries and Skunks?

And here's the reply....

The strawberry fields, so red and sweet,
Are guarded by the skunk, so discreet.
He sprays his scent with such disdain,
To keep the birds and beasts at bay.

But man, with greed in heart and mind,
Does not let the skunk's defense bind.
He steals the fruit, so plump and ripe,
And leaves the skunk with nought but spite.

But in the end, the skunk prevails,
For though the berries may be hailed,
The smell of skunk, it lingers still,
And serves to remind us of our ill.

So let us honor the skunk's defense,
And give the strawberries their due recompense.
For in this balance, all is fair,
And all may share the bountiful air.

Tuesday, 10 January 2023

Prodj, Praw or Pro?

I've just had one of those moments, I speak with an accent from the British Midlands.  I've been told my accent is fairly neutral, but I know I have a Nottingham twang to certain words, and when I'm being lazy I can sound right common (that is lower-class).

The vowel constructs I know I'm worst at are "Op" such as "Open" and "Operation" and "Ov" as in "Over", and I often made even my wife's eyes twitch when I say "it's upen uver there" pointing at a shop or parking space.

Today however I'm picking on "Pro".... Now, as a British English speaker I've never had this issue locally, we all say "project" with a "prodject" sound, we don't stress the "pro"... It's a prodject, not a PROject to my ear.  It's like saying "podge" as in stuffed full of food, but with an 'r'.

Right or wrong this distinguishes that word with "Projector" and "projection", you know the habit of shining light through something to put an image on a screen or wall... that is "PROjection" when I say it.  And this has been automatic to me all my life and I've known what my peers at school, home and work meant we were all very local, so we all knew the distinction and never really thought about it.

However, working in game development with a very wide range of folks I've just been called out.

Talking about a project with graphics the projection matrix came up.... And yes, you guessed it, in the meeting I said (something like) "the prodject is coming along well, I'm using the inverse PROjection matrix to check a ray intersection".

I literally got called out at that point, never noticed it before, I've heard folks saying "PROject" but ignored them... The problem?

One of the folks happened to be from the North West of England (Manchester I believe) and he said... "PRAWject".... and "PRAWcessing".... Yeah, even I was twitching then.

Either way, it was an interesting moment.