Skip to main content

Posts

The basics of A Star Pathfinding

Someone wanted to know how the code works for basic A* path-finding. Rather than reply in Facebook, I've made a quick post for it here. 1. create an array of nodes to represent your level.  It can be nodes with connections, or it can be a list of co-ordinates where connections are assumed to be NESW where a node exists.   Example 1:   level = {"001":[["002", 5.0], ["003", 5.0]], "002":[["001", 5.0], ["003", 5.0]], "003":[["002", 5.0], ["001", 5.0]]}    This is a dictionary based "mesh" type array, for easy reading. You can see it has 3 nodes arranged in a triangle. Each node is connected to two others, and in this case, the distance between each is 5.0 units.    It's easy to see how this mesh could be expanded. You just need more points. Each point must include its two neighbors and the distance between them.   Example 2:   level = [[0,1,1,0], [0,0,1,1], [1,1,1,0], [1,0,0,0
Recent posts

Emotional faces

  For a while, I've been trying to decide whether to go ahead and add facial expressions to the characters in the current project.  It's not something I've done in the past, because it's a lot of extra work. And I have to wonder if the result is worth the effort. I'm not a great animator, and you need a *lot* of extra geometry, bones  and rigging to make a face show emotions naturally. I think the result of this experiment is that I'm going to leave facial expressions out of this project. It's easy enough to edit the static character portraits to produce a couple of different "feelings" to show how characters are responding to dialog. I may use the more detailed rig for a mini-game in the story though. The player should try to guess the character's emotions while they deliver a message, and guess if they are telling the whole truth by how well their visible emotions match the content of the text.

Character Assets

 For the last month or so, I've been working on making the character Assets for my game. From the start, I had a number of design specifications that I had to follow. 1. The game is supposed to be playable on low end computers, running directly on an embedded web player. This puts a limit on the texture sizes and number of polygons. Each character has a strict budget; around 2000 triangles, and a single 512x512 texture. 3. The characters should share a small number of armatures, so that as much can be reused as possible.  4. Character design is modular. The heads occupy a 256x256 square in the top right of the texture. Hands have a 128x128 square just below. 5. Texture detail is focused on the face.  The body takes up the rest of the texture space. 6. Polygon detail is focused on the face and hands. Together they have nearly half the budget for polys (face:500, hands:250 each). 7. The models are painted in Blender, using the projection painting technique: When I started using this

Automating Level imports from Blender to Godot

  Recently I've been making some levels in Blender an importing them into Godot. There are only about 7 or 8 shaders for each level, not counting dynamic objects which will be added later. But to improve rendering performance, it can be a good idea to split the meshes up into sections. At that point you might be faced with a list like this: Or it might be even more chaotic, if you didn't use simple names for the objects in your level. So it can take a long time to sort out all the meshes, make them unique and add textures and so on. Blender imports with simple Blender textures, or with placeholder materials. This is sometimes OK, but if your Godot shaders are very different to those used by Blender, it means applying new materials to every mesh object in the level when you import the scene. I found that during the design process, I was importing and readying a level several times before I was happy with the final layout. So at first I was wasting a lot of time. In Blender, I us

Fake "reflective" material shader.

GODOT has a great shader system, and the roughness/metallic settings do a great job of representing a range of materials... but sometimes you want something a bit different. It is possible to have object specific "reflections", using a fairly old technique called "matcaps". It's not a particularly realistic looking effect, but if you want to go for that stylized effect, it can be a fun throwback. vec2 offset = (normal_map.xy) - vec2(0.5); vec2 v_n = (normal.xy / 2.0) + vec2(0.5, 0.5); v_n.y = (v_n.y * -1.0) + 1.0; v_n = v_n + offset;     vec4 refl = texture(mat_cap, v_n); Here 's the code you need for making the matcap project properly on your model. I've included a section to make sure the normal map will distort the reflections, just like with the metallic effect in GODOT. You can see in the image above that if we don't do this (left) the effect doesn't look good. Be sure to use the right import settings on your normal map textures, so that th

Text crawl and other effects GLSL shader

For my project, I've been working on a kind of 80s style sci-fi monitor display.In game, this is going to be handled by a single texture effect with a GLSL shader. Different sections of the texture will be cut down and used on different view screens. Here's a preview of how it looks in action: Screen capture in Linux Mint is always a bit buggy. :( Or maybe it's because my computer is over ten years old... Here's another set of screens with different colors and contents, for the planet that the player gets to visit in the first episode (you can see in this preview how the "alert effect" is activated to change colors of the scan): You can see the original effect I'm trying to duplicate in the Star Trek movies: Anyway, it's a nice set of old school effects, and I'm going to explain how they are achieved in a game engine with a GLSL shader (In this case, GODOT, and awesome free game engine). First you need to set up the different layers of your image.

New Project: Basilisk

 I've been working on a new project this month. It's a serial point and click adventure, set in a familiar universe. It's going to be a non-profit project, to stand as a showcase for everything I've leaned in game design and programming. The setting will help to make it more visible.  This was a tactic I used with some success in the past, when I made a battletech fan game. The number of views and downloads for that game were roughly ten to twenty times higher than for any of the games which I made based on my own ideas and settings. I'm going to be able to reuse a lot of assets I originally designed for a previous sci-fi project, so that should save some time. There are going to be new assets, and I've already made some of the characters. There's a story, with an arc which covers a whole season of mini episodes. Godot is a great game engine for this kind of project. Very light weight and easy to use, but with a full set of features. Godot 4 will include an