Some more gamedev shenanigans

So I've not done much work on the game engine I was playing with partly due to getting stuck on some annoying bugs which were more platform or tools level of code rather than progressing any sort of game. So I decide to put that aside for a bit and try something in a premade game engine where someone else gets all that underlying code right ahead of time and I can just focus on the game parts of it.

Now I could have gone with everyones favourite game engine unity but why be one of the degenerate masses when you can pick something weirder that is open source. Also there happened to be a new version out with improved capabilities.

So I started playing with Godot 3 a self contained game engine and development tool in the same vein as Unity although unlike Unity it's an open source project and free in all respects rather than just until you make money.

It can do 2d and 3d or combinations there in has an inbuilt scripting language called GDScript (which is sort of python esq) but also has bindings for C++ and C# using the Mono editor (same as unity) as well as a visual scripting system. It had physics both 2d and 3d full particle systems. It can deploy to PC / IOS / Android / Web. The editor comes as self contained zip no install just run it away you go pretty much all the tools are included inside and it uses the standard resource types with inbuilt primitives and support for things like collada glTF and the archaic but occasionally useful OBJ.

The main new features on godot 3 over godot 2 (which I did play with in the past) is a massively improved 3d engine with much better visuals things like PBR shading global illumination and the usual jazz for and idea of what it is capable of in the right hands this demo shows it off

The working system in Godot is based on scenes each with a series of nodes you stack nodes on top of each other to add behaviour so a basic 3d node is the Spatial this contains information about it's transform and not much else or you can get a more complex object that will interact with the physics like static or rigid or kinematic bodies. You can add a mesh-instance to that which contains meshes (either inbuilt primitives or imported) and materials (either built in material shaders or shader programs written in GLSL) then you can add collision shapes and collision areas to allow it to collide with the physics engine and detect objects approaching or hitting. Animation players that can animate with keyframes and curves pretty much any variable in the objects paths and path followers a whole multitude of inbuilt nodes that can accomplish a lot of stuff without touching any code.

On top of that you can then add scripts to add to or supplement the inbuilt functions to greater levels of flexibility it supports inheritance so you can make specific versions of objects that inherit behaviours from a base script. For example one enemy script that has all the base behaviours then specific enemies that have a unique look and unique behaviours that you only have to write the unique bits for

Where it really gets interesting is you can load scenes as objects into other scenes so you can make building blocks and then add them to other scenes to have them interact with other things for example you could make a light switch object that when clicked animates and signals it's been hit. You can then just add that object to a bigger scene just setting the options in the editor with multiple lights and multiple switches and you can even incorporate that object into another so using it on a toaster or tv or something the behaviour stacking together.

It means you can get some quite complex behaviour without a lot of extra effort.

Anyway it's a pretty powerful tool which I've been toying with and this is how far I've gotten.

I've been using simple inbuilt meshes and not put a lot of work into textures or look mainly focusing on mechanics. Mainly a sort of factorio or astroneer making building game the features I've added so far a 3rd person camera a basic stand in player object. Minable resource minable manually by clicking or with a drill machine. A vacuum machine that hoovers up any generated ore and then stores it internally (capacity indicated by a little 3d progress bar widget) or if connected fires it down a pipe which can be connected up to other connectors (in this I just have a test box object that destroys anything it receives). You can move and rotate objects in the world you can click connectors (red coloured for outputs green inputs) and connect them with pipes (mesh generated procedurally) and then see items move along them.

I've also been playing with a conveyor which has a procedurally generated belt not sure I'll use that or not.

So basic stuff but slowly building up. The various parts are mostly layered together so I wrote a script that handles moving the objects so anything that needs to move just uses that type and the behaviour is there. The connectors and the progress bar are scenes I made on their own so I can just add them to other objects and they more or less just work some minor hook up calling the functions to tell them things like what percentage to display or what object is being sent and they do the rest automatically. The pipes are procedurally generated I did the math to work out a box cross section along the vector at the moment they just go straight across and can go to any length but can only carry a single item along them I might improve them later make them rounder and perhaps of limited length maybe take multiple items. The little telephone poles are just two connectors very minimal code bounces items from input to output the simple way you can add stuff to scenes means you can easilly extend things if I wanted I could add more connectors to do multiple lines on one pole or things like splitters or sorters all sorts without a lot of extra effort.


This is ace! I looked at Godot3 recently as I hit a tutorial on network code. Looks really cool. I like that you're building the kind of game that you would like to play.

How's networking in it?

brainwipe's picture

it has a pretty standard network system with rpc calls etc at the high level an underpinning of tcp udp and websockets I've tried it out briefly with a set of tutorials to make a very basic networked asteroids although it only got as far as setting up the host and client and instancing ships that can then move on both screens.

networking is something I'd like to play with at some point but at the moment I think I'll focus on getting some sort of a game running first

Evilmatt's picture

added a few bits improved the pipes from a box cross section to a octagon added multiway connectors buttons and filtering based on object.

Evilmatt's picture

Bit more work added object slots and an inventory improved the furnace added the option to pick up certain building types and put them in the inventory or slots if compatible. Some alterations to the code that handles items to make things easier for the above.

The player control logic is getting a little convoluted so I might refactor that try and move the logic of what to do when into more of the inherited classes and make the main loops more generic. It's already going that way with some common base classes handling things like movable objects with general behaviour and then the specific additions on the inherited classes. Probably start looking at making things maybe look at having objects as stacks rather than single items

Evilmatt's picture

playing with the conveyors added code to put object slots on the conveyor and then additions to let objects get put onto or taken off. Also toyed with making the belt travel only in straight lines. The corners are wrong at the moment. Also made some changes to the vacuum tool to allow it to pick up from the belt and also objects in the world but that broke it a little.

Evilmatt's picture

How are you finding using someone else's engine rather than rolling your own?

brainwipe's picture

some things are good others I have less control or the way it's implemented is odd or weird but mostly it's good. One thing about it is assuming I ever finished a game completely I'd have more confidence it would work on most people's hardware or if there were bugs they were something in the game logic not some esoteric incompatibility I never saw because I'm running nvidia and they are running amd or some such

heres some more conveyor work

Evilmatt's picture