Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
arrowPress Releases








If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Sans voir: generating procedural chess pieces

by Yanko Oliveira on 03/31/16 02:29:00 pm   Featured Blogs

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

Part two of the “X: a Game of YZ” Postmortem. You can read part one here.


There are two main approaches in procedural generation: Teleological and Ontogenetic. Basically, one of them tries to accurately emulate a “natural” process to achieve a result, while one tries to directly create the result. 

Having a piece that looks like a Rook but moves like a weird version of a Knight would just add confusion to an already confusing game, so this means I would have to create my own piece designs. And who am I fooling, I obviously wanted to play around with doing procedural chess pieces.

Just like I did with the game design itself, I started by trying to dissect what typical chess pieces have in common. What came to my mind immediately was the difference between base, body and the “headpiece” that actually defines which piece is which. The classical design is given by the way that they were usually sculpted: by using a lathe. Which, fortunately for me, is a modifier present in your average 3d program, so I had a first approach to try.

If you’re doing that in a 3d program, you’d create a spline, then use a lathe modifier to rotate it around an axis and create the polygons based on that. In fact, a chess pawn is even a very common example for lathe modifier tutorials. So I naturally started with a teleological approach: I’d simply have to implement a small spline system and then a runtime lathe.

And then that’s the thing about teleological processes: they can be too complex for the result that you need. After thinking some time about it, I realized that the research and dev time for a spline and lathe system would be a bad tradeoff, so I took a step back and asked myself: what do I need? The answer is: a cylinder that has segments with variable segments, i.e., the end result of a lathe operation. Luckily, there are several procedural cylinder code examples around the web. Ontogenetic kludges, gotta love ‘em!

So then I’d only need to create a cylinder, randomize the radii and height of segments and… voilá!


Oh. Ok. Maybe I should also make sure that the random segment height delta is not negative.

There. I have invented table leg chess!

Ok, time to get back to the original dissection: for our chess pieces, we need something of the head, something of the dead, something of the body, and something of the thr… I mean… a base, body and head. So instead of simply randomizing all segments, I separated them into sections. After some tweaking, this is where I was at.

Neat! However, all pieces look like queens, so I guessed more tweaking was in order. As I mentioned in the previous post, each piece belonged to an archetype, so I’d create different configurations based on those: Pawns are plain and stubby, Support pieces are tall and have complex heads, Heavypieces are wider, stubby and have a rook-like headpiece (with a “hollow” center), and Royal pieces are pretty much the same as Support, but can have a “panache”, i.e., that little extra ornament over the headpiece. 

I ended up adding a bunch of parameters, including a curve that modifies the segment’s radii, defining the overall shape of each segment. That took away some cool variations, but kept pieces cohesive: the base of the pieces always tends to be wider at the bottom, while bodies vary a lot in the middle, but little where they join with the base and headpiece.

 You can notice that there’s a flag for the panache  and “tube head”, which creates the hollow, rook-like  headpieces. One thing that I wanted to do was  having several pre-modeled head pieces that could  be picked at random, that’s why the “has head” flag  exists, but it ended up not being used.

 Since I couldn’t reach that much variation within  piece categories, I made sure that each archetype  had a basic silhouette that was easy to identify  - character design 101 still applies to chess pieces!

 

Procedural generation in the end is about iteration, about “sculpting” your algorithms until they get to a point where they have varied results, but also achieve what you need them to. I opted for sacrificing variation for the sake of cohesion. I’m pretty sure with more time (days/weeks, not hours) it would be possible to reach a better compromise - I could even create several headpiece generators with more interesting shapes. 

It’s kind of ironic that my first game jam project while living in Germany was a chess game and there were still many moves to be made - but I guess near the end all game jams are a zeitnot.


Reblogged from my personal blog. You can read the original post here.


Related Jobs

Pixar Animation Studios
Pixar Animation Studios — Emeryville, California, United States
[05.24.19]

Animation Tools Software Engineer
Disbelief
Disbelief — Chicago, Illinois, United States
[05.24.19]

Senior Programmer, Chicago
Disbelief
Disbelief — Chicago, Illinois, United States
[05.24.19]

Junior Programmer, Chicago
Deep Silver Volition
Deep Silver Volition — Champaign, Illinois, United States
[05.24.19]

Senior Animation Programmer





Loading Comments

loader image