AuthorPhilipp

Blender Addon: Normals to Vertex Colors

I needed to store both original and smooth vertex normals in a mesh for a shader-based effect, so I was looking for a way to bake normals to vertex colors in Blender 2.8.

Turns out baking to vertex colors didn’t survive Blender’s transition to 2.8, at least as of 2.81. There are workarounds like copying the contents of a texture to vertex colors (like this addon), but that seemed a bit clumsy for my needs.

Instead, I found a Python script on stackexchange that did pretty much what I needed. I figured this could be a good exercise for getting into addon development and turned the code there into a simple Blender addon. In the process, I also added the ability to swizzle the normals as they get stored in vcols, and an option to “bake” in either World Space or Local Space.

You can download the addon here.

As it’s really small, and all the code is contained in normals_to_vertex_colors.py, it’s probably a decent reference if you’re looking to learn how to write your own addons.

Quick tutorial: Create Your Own HDRI Skyboxes in Unity

HDRI skyboxes are used for reflections and for lighting your scene. Here’s a three minute tutorial on how to create your own by baking reflection probes.

Steel Circus: Rendering The Floor

Steel Circus is a futuristic ball sport with MOBA or “Hero Shooter” elements. Each champion has two unique skills, such as placing defensive walls or stunning enemies.

The arena floor is one of the most prominent assets in the game – a giant display that shows player UIs, skills’ areas of effect, and things like goal animations or customizable spraytags. We really like how it ties elements into the game world that would traditionally be presented as UI overlays.

Players spawning from inside the floor at the beginning of a match.

There’s quite a few things going on in rendering the floor, notably raymarched light scattering under its surface, and indirect lighting of the characters. In this post, I’ll break down all the different parts that went into it:

Continue reading

AI in “Steel Circus”, Part 4: Optimization and Future Work

The AI initially took an average of around 7ms per tick to process. Though the AI only runs on the server, and our server tick rate is 30hz, this would still have severely limited the amount of games we could run on one machine. As a side note, the amount of time spent on AI didn’t vary much with the amount of AI-controlled players, because the heaviest state was Ball Ownership, and only one bot can hold the ball at any time.

I spent a couple of days on optimizing and brought the AI tick down to below 1ms on average and 3-4ms peak:

Shared AI Cache

Each bot has access to a shared cache that can be queried for information like lists of alive players, players with active status effects (“stunned”, etc.), players’ current stamina, bumper positions, the current ball owner, etc. etc. The cache is updated once per tick and stays valid throughout the tick.

Continue reading

AI in “Steel Circus”, Part 3: Other States

The “Team Mate Has Ball” State

Influence map for when a team mate (orange bot below) owns the ball. Note the cone-shaped darker gradients going out from the bumper and enemy bot – these are penalties for positions where there’s no clear pass line.

After implementing ball ownership, the logic for when a team mate of the AI owns the ball was pretty trivial to implement: I mainly reused the same influence map sampling logic and position evaluation gradients of the ball ownership state, with a few modifications:

  • Clear pass lines are even more important than when it’s you who owns the ball
  • Spreading out is more important, particularly when the AI is in the middle of the field
  • There’s a penalty for positions that are too far ahead or behind the ball owner across the field’s horizontal axis.
Continue reading

AI in “Steel Circus”, Part 2: The FSM and Ball Ownership

The State Machine

Gameplay in Steel Circus decomposes into just a handful of basic states:

  • You have the ball
  • Your team mate has the ball
  • An enemy has the ball
  • Nobody has the ball (it’s either lying on the ground, or it’s in flight after a shot)

Exit conditions for these states are also trivial:

The exit condition for the first three is that whoever had the ball now doesn’t have the ball anymore (i.e. they shot it, or it was taken from them). The exit condition for the “nobody has the ball” state is that the ball now has an owner.

Continue reading

AI in “Steel Circus”, Part 1: Overview

The Game

Gameplay from a 3 vs. 3 Steel Circus match with one bot on each team.

Steel Circus is a futuristic ball sport with MOBA or “Hero Shooter” elements. Each champion has two unique skills, such as placing defensive walls or stunning enemies. There’s no automatic passing – passing the ball requires precise aiming. Players also need to manage their stamina, which is used for sprinting, tackling opponents or making quick dodge maneuvers when you have the ball.

Background and Scope

We originally designed the bots as backfill for human players leaving in the middle of a game. When Steel Circus launched, we were fortunate to receive a main header feature on Steam, which brought in droves of new players for the week that it was active. However, many of these players decided to quit the game during their first match, which ruined the game for everyone else. While we had anticipated this could be a problem, the scale of it surprised us.

Continue reading

© 2024 Philipp Seifried

Theme by Anders NorénUp ↑