🏠

Casting Rays. Smoothing. Texturing.

2025-01-19 / Mark Sowden


← 2024-12-22

Been a little while again, but I'll probably continue leaving a little bit between each update for now just to give me a chance to get more things out the way to talk about. Otherwise you'll just end up with my mindless dribble.

Recently I've been having my usual back and forth, trying to justify to myself why I'm writing my own engine. Then I'll usually take a look at other engines (without naming them), and usually remember some reasons why.

Don't get me wrong, I think a lot of the options available out there are great and I don't want to come across as some sort of smug bastard that thinks he can do better - I really don't! But nothing out there seems to provide the middle ground I'm looking for, so that's why I'm doing what I am.

I don't need a hyper-advanced engine that does literally everything, I just need something for making games where I can easily dive in, extend it however I want and easily maintain into the future.

And while it's great that other engines such as Quake are available out there, and I'm very much an advocate for open-source, in this case I'd prefer not to shared the code for this until it's completed and either no longer has value or enough time has passed that it's probably time to move on.

Which is already what I've done with previous iterations of this engine.

Though I'll say in hindsight it would've been a little more wise on my part to choose an existing framework to start from such as Irrlicht (despite its age), Ogre 3D or one of the many other frameworks available. This would probably be my advice to anyone looking to start their own engine, but it's a bit late for me to do that now.

Road to Milestone 2

At the start of the new year the deadline I'd set for the first milestone was hit with both requirements completed. So that meant a more comprehensive outline of the game design (rather than keeping it in my head and over assorted notes) and getting the editor to a point where it's possible to start building environments.

The following were specifically what I'd delivered for the first milestone:

For milestone 2, there are three major requirements; entity spawning and placement, basic collisions and room connectivity. The first of these has actually been delivered already, and in addition I've also delivered the following thus far.

At the moment I'm working on player spawn points, so players can actually be spawned in the game (rather than flying a camera around). And I'm gradually planning out how sub-rooms will work (place a plane between two areas, and automatically divide them into room A and room B).

Given the deadline for milestone 2 isn't even due until March, I'm very happy with the progress so far!

Smooth Surfaces

This had been something that I was really eager to add, because it's something I wished Quake/Source level editors had. You can certainly get smooth surfaces but it's not as easy as it should be.

So rather than setting up smoothing groups and then having to manually apply them to each surface, I decided to allow you to select a group of adjacent surfaces and then apply smoothing to them all at once.

It's possible to do the reverse if really desired too, so you can make the faces flat-shaded again after smoothing them.

Ray Casting

Casting rays against planes and polygons is now possible. This was one of many things I finally needed to get round to in order to get working collisions in the game.

It's one of those things that I thought was a lot more complicated than it actually turned out to be, so just kept avoiding it forever.

Screenshot showing a ray being cast within the engine against polygonal geometry. Screenshot showing a ray being cast within the engine against polygonal geometry. Screenshot showing a ray being cast within the engine against polygonal geometry.

Screenshots showing a ray being cast from another camera in the editor.

A while back I'd mentioned for the game that I'm probably going to go with static lighting and before the plan was to bake this into the vertex colours in Blender to give that early 3D vertex-shaded style, akin to Spyro. But for faster iteration, it's likely I'm actually going to use this to calculate the lighting in the editor at the press of a button in future.

In the longer-longer-term, I'm eventually going to implement lightmap support, but I'm not currently sure if it makes sense for the game I'm currently working on, so it's a stretch goal for now.

Smooth Shadows

Okay, this is something that actually went in just today because I was bored and randomly remembered I'd wanted to do it for fun.

Post by @hogsy@mastodon.social
View on Mastodon

Console Enhancements

You can now use the up and down arrow keys to scroll through your console history. Yet another thing that was on my list but ended up taking about five minutes.

Additionally, added support for notifications to be pushed through.

Post by @hogsy@mastodon.social
View on Mastodon

These notifications will be primarily useful for letting players know when another player has joined the server (or something has gone terribly wrong).

For now much of the input relating to the console is hard-coded, but eventually I'll move it over to use the action input system everything else is using which will make it customisable. It's not been high on my list as the console is obviously more of a development tool than anything else.

Public Editor Release

When the editor is a bit more stable, I'm considering releasing it as a public alpha for people to play around with and give feedback. This probably isn't going to happen before the end of this milestone, but it's something I'll certainly be working towards probably during the next one (so looking around June, probably).

← 2024-12-22