Challenge

Generate items for RPG games with Stable Diffusion

Author Photo

Tadeo Hepperle

· 5 min read
Thumbnail

Items for an RPG inventory

Let's define a list of 5 items that we want to make sprites for with Stable Diffusion. These 5 random items could be used in an RPG video game:

  • golden goblet
  • teddy bear
  • straw hat
  • magic scroll
  • shuriken (ninja throwing stars)

Our goal is now, to create these items in a style that is suitable for Game Sprites, which has a few requirements:

  • look good as small images
  • have a plain background that can be easily replaced
  • have a consistent style

Starting with simple prompts

First we generate images with the just name of each item as a prompt for 512x512 images, using 25 steps, a guidance scale of 25/50 and 4 variations per item. So the prompts simply are: golden goblet, teddy bear, straw hat, magic scroll and shuriken.

Golden goblets

golden goblet
golden goblet
golden goblet
golden goblet

I think the 3rd and 4th Picture most closely match what we want. Also the background is not too bad.

Teddy bears

teddy bear
teddy bear
teddy bear
teddy bear

All teddy bears look pretty bad, depending on the style of the game maybe the 3rd bear would be usable, if the feet were not cut off.

Straw hats

straw hat
straw hat
straw hat
straw hat

Interstingly the second image also has an easily removable green background, just like one of the bear images.

Magic scrolls

magic scroll
magic scroll
magic scroll
magic scroll

It seems like that the model does not really give us a magic scroll as a paper scroll like I wished too, so we need to do more descriptive prompt engineering here.

Shuriken (ninja throwing stars)

shuriken
shuriken
shuriken
shuriken

All of these seem more like logos / symbols than actual objects. But at least the star shape is there.

Using additional words in the prompt

Let's try to refine the prompts to include more keywords about the style we want. I chose this pattern: ((golden goblet)), item, object, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith. Ted Nasmith is an artist whose style I usually like.

Golden goblets

((golden goblet)), item, object, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith
((golden goblet)), item, object, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith
((golden goblet)), item, object, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith
((golden goblet)), item, object, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith

These are more on the abstract side and pretty much unusable.

Teddy bears

((teddy bear)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
((teddy bear)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
((teddy bear)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
((teddy bear)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith

the first bear looks like he was electrified by Darth Sidious, look into his eyes! At least the background is kinda clear now, which is good. I don't even know what the 3rd bear is supposed to be, it looks very abstract, maybe I should add abstract to the negative prompts.

Straw hats

((straw hat)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
((straw hat)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
((straw hat)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
((straw hat)), item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith

Most hats seem to be out of frame which sucks.

Magic scrolls

(magic scroll)), pergament roll, paper, paper scroll, item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
(magic scroll)), pergament roll, paper, paper scroll, item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
(magic scroll)), pergament roll, paper, paper scroll, item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith
(magic scroll)), pergament roll, paper, paper scroll, item, object, rpg item, dnd style, realistic, ink, white background, clear background, by Ted Nasmith

Ha, now we get paper scrolls, but what is the 3rd image? It legit looks like that's some magic toilet paper. Not so epic.

Shuriken (ninja throwing stars)

((shuriken)), weapon, ninja throwing star, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith
((shuriken)), weapon, ninja throwing star, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith
((shuriken)), weapon, ninja throwing star, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith
((shuriken)), weapon, ninja throwing star, shiny, rpg item, dnd style, realistic, ink, bloom, white background, clear background, by Ted Nasmith

Sadly still no real object, all look a bit abstract. The 3rd picture looks kinda interesting, it could be a logo for an anarchist organisation or something. The 2nd picture is clearly more a compass than a shuriken star.

Using a simple drawn input image of the item

Now we use simple drawn images as an initial input, to make the generation process for stable diffusion a bit easier. Here are the input images I used for the 5 items, each consists only of two colors on the background and was drawn in less than 30 seconds:

Golden goblets

((golden goblet)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((golden goblet)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((golden goblet)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((golden goblet)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

The 1st and the 4st goblet look pretty decent. I especially like the style of the 4th goblet, that looks a bit like a mix of paper drawing and actual metal with the reflextions.

Teddy bears

((teddy bear)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((teddy bear)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((teddy bear)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((teddy bear)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

They all look a bit abstract and cartoonish to me. I want to add ((cartoon)), plain colors, flat to the negative prompt and fur, fluffy, happy to the prompt to make them seem more sophisticated:

((teddy bear)), fur, fluffy, happy, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((teddy bear)), fur, fluffy, happy, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((teddy bear)), fur, fluffy, happy, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((teddy bear)), fur, fluffy, happy, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

Well that did not work too well. They still look cartoonish and not like good sprites for most games.

Straw hats

((straw hat)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((straw hat)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((straw hat)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((straw hat)), item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

The 4th hat looks extremely cool and perfect for an RPG-like game. The 1st hat looks almost like a low-poly 3d style.

Magic scrolls

(magic scroll)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
(magic scroll)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
(magic scroll)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
(magic scroll)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

Now these are really some magic scrolls. For some game styles they might even have too much detail. I especially like the 3rd and 4th picture which look very nice with the golden ornaments. However there is a weird reflection in the top of the 3rd picture.

Shuriken (ninja throwing stars)

(Shuriken ninja throwing stars)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
(Shuriken ninja throwing stars)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
(Shuriken ninja throwing stars)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
(Shuriken ninja throwing stars)), pergament, paper, paper scroll, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

I accidentally left "paper scroll" in the prompt from making the magic scrolls. That is why they came out like origami stars. Let's make them again without this mistake:

((Shuriken ninja throwing stars)), weapon, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((Shuriken ninja throwing stars)), weapon, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((Shuriken ninja throwing stars)), weapon, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith
((Shuriken ninja throwing stars)), weapon, item, object, rpg item, dnd style, ancient, realistic, white background, clear background, by Ted Nasmith

The 4th ninja star is pretty amazing, the others have some minor artefacts that make them weird.

Learnings: is Stable Diffusion usable to make RPG items?

Yes, with some initial input und prompt tweaking it is definitely possible to generate high quality item sprites for RPG-like games with Stable Diffusion. It is cheap and effective, especially when you already have the general shape in mind and just need to convert your ugly sketches into high quality images.

We will explore more item generation for game makers in future articles.

#rpg#game sprites#game development
Author Photo

About Tadeo Hepperle

Hey, I am Tadeo, a Software Developer with a passion for Rust, Dart and Deep Learning. I love to explore how to make use of generative AI, especially for games.