Super Text Mesh for Fungus

So a game dev from Winnipeg put together a text tool for Unity called Super Text Mesh which lets you do wiggly text and a few other things.

superText

Since I’ve been playing with Fungus lately, I decided to see if I could get it to work with Fungus.

In standard Fungus, when you call a Say command, it grabs a SayDialog and passes it the text. The SayDialog then passes that text to the Writer component, which will loop through it, adding it character-by-character to the Text object, to animate the text being written out.

Here I wanted to use the SuperTextMesh object instead of a regular Text. And SuperTextMesh also has its own animation built-in that we want to use. So I extended the Writer class, and overrid some functions to make it just pass the full text to the SuperTextMesh.

SuperTextMesh also has its own sound effects. Fungus has a WriterAudio class to play these. You can associate a sound with a character, and the SayDialog class finds the current character and passes that audio clip to the WriterAudio component. In SuperTextMesh, you can set up a list of voices, which can specify different text colour, animations, and sound effects, so the obvious thing to do is associate a Character with a voice. The way I handled that, is you need to give the Character the same name as the corresponding voice.

The one down-side is that both SuperTextMesh and Fungus have their own tags, so I chose to ignore the Fungus tags to keep things simpler. SuperTextMesh has replacements for things like bold, italics, text color, but there might be some Fungus-specific tags someone would miss.

My addition is currently packaged with the SuperTextMesh on the Unity Asset Store.

Comments Off on Super Text Mesh for Fungus

Platformers and making orthogonal movement metaphorically orthogonal

Someone made a side-comment about platformers, how it was based entirely around timing and therefor the lowest common denominator in games, and that’s the only reason they are so popular. (Of course, this was in the context of explaining why their favourite genre is superior.) I thought this was unfair but I wanted to think more about why.

The first obvious point is it’s not just timing, it’s timing plus position, at the very least. If you strip everything from a game except timing, you won’t get a platformer, you’ll get a rhythm game, like DDR or Parappa. Not that I think those are the LCD in games, but that’s a topic for another day.

But why is platforming so popular? Is it just the influence of Super Mario?

After considering it, I decided platforming is a way to add interesting complexity to the movement of a game that is also intuitive.

Orthogonal Unit Differentiation

There’s one idea in game design called orthogonal unit differentiation. Also explained nicely in this video in relation to Doom’s enemies, which was probably cribbing from this longer explanation here.

The short version is that if you’re going to offer variation, it’s a way to consider if it’s meaningful variation.

For example, if you had a shooting game with five choices of gun, and they were identical except for the amount of damage they cause, that wouldn’t be very interesting variation. You’ve differentiated them all in the same way. You might call that parallel differentiation rather than orthogonal. On the other hand, if you have a weapon that is powerful but slow and one that is faster but weaker, then the player can make a meaningful choice about which is better. (And one could be better in different circumstances.)

So, back to platforming?

OUD is usually brought up in relation to objects in the game. In the Doom example, it’s the monsters you are fighting. I gave an example with guns. The Harvey Smith presentation uses an example of army units from a military strategy game. So I may be stretching the meaning of it, but platform mechanics provide orthogonal differentiation between up, down, and sideways movement.

Now, in a literal sense, vertical movement is orthogonal to horizontal movement. That’s the original mathematical meaning of the word, after all. But for example, in Pac Man, if you took the maze and turned it on its side, you’d still have essentially the same game. Because movement in all four directions works the same.

If you took Mario Brothers and turned it on its side, you’d completely change everything. (And it probably wouldn’t be a very good game anymore.)
Mario Brothers rotated on its side

Moving from the bottom to the top of this screen is a completely different action than moving from the top to the bottom. Or from the left to the right. All thanks to gravity and jumping.

Intuitive

Imagine trying to explain this movement without any reference to “jumping” or “gravity.”

“Your character can move along the horizontal axis by pushing in the same direction with the joystick, but along the vertical axis, you can’t. Instead you can push a button to increase your upwards speed, but only when you’re touching the top side of one of a solid object. Then your character will be given some upward speed, and will accelerate in the downward direction until such a time that you’re touching the top side of a solid object, upon which your vertical speed will stop, but the upwards speed button will be re-enabled. If you move horizontally to a position where you’re no longer touching the top of a solid object, you will also accelerate downwards until you are again touching a solid object.”

As a movement mechanic, it’s surprisingly complex, and I think only manages to stay intuitive because it piggybacks on concepts that people are very familiar with.

Tagged , | Comments Off on Platformers and making orthogonal movement metaphorically orthogonal

You’re A Mimic!

So I did the latest Ludum Dare and made You’re A Mimic!

I guess because I’ve been playing with Fungus a lot lately, it’s something where you try to find the holes in a treasure chest’s story, to prove it’s really a mimic.

I’d been making another Fungus game lately, but hadn’t really constrained it, in terms of it’s a conversation that you can take in a lot of directions, which makes it hard to keep the amount of dialog I have to write from growing exponentially. Which had got me thinking about what methods visual-novel-style games use to keep everything on track. I think there’s a lot I could still learn about that, but one approach is like Phoenix Wright: Ace Attorney where a witness tells their story and you can pick apart the facts from that.

The theme for this Ludum Dare was “shape-shift” and that lead to the “mimic” that’s in some video games, disguising itself as a treasure chest. I’m apparently not the only person to take the theme in that direction. So this combined with my previous thoughts about the Ace Attorney-style mechanic to become You’re A Mimic!

In building it, I spent the most time drawing the graphics, and possibly the second most time programming the “fact” process, since it’s not something built into the core Fungus engine. I might return to that “fact” add-on and figure out ways to make it scale to larger games more easily.

Tagged , , , , | Comments Off on You’re A Mimic!

Hex vs Square

A tweet got me thinking about hex and square tiles in board games. It is several months old at this point, but that means I’ve given the subject a thorough going-over.

You might be interested in this blog post I read titled 20 Fun Facts about Hex Grids.
Or Red Blob Games’ really cool demonstration of some stuff about hexagons.

Neighbours

Obvious difference is a hex tile has 6 neighbours. Squares have only 4, unless you’re counting diagonals, and then you’ve got 8.

Diagonals

Which brings up diagonals. With squares, you’ve got these neighbours that might or might not count as neighbours, depending on how you want to interpret that. In a hex grid, you haven’t got that ambiguity.

In hex chess variants, sometimes they come up with something for the bishops to do, but it feels kind of forced, to me. Diagonals are a natural idea for squares but not for hexes.
movement of a bishop in hex chess

For purposes of orthogonal unit differentiation, it’s simple to have pieces that move diagonally, cardinally, or both. With a hex grid, you have to work a little harder to find different movement patterns.

Distances

One thing that’s odd with squares is the difference between diagonal distance and cardinal distance.

The length of the diagonal of a 1×1 square is the square root of 2, or about 1.4. But if you instead just count the number of tiles it takes to traverse the distance, you end up with a different ratio. If you allow diagonal movement, you can travel 40% faster than you would intuitively expect. If you don’t allow diagonal movement, that takes two steps and you’re traveling 30% slower than you might expect.

If you think about distances as the non-tiled distance, a circle contains all points that are equal distance from the centre of that circle. But for square tile-based movement, you’ll get a diamond shape. And for hexagonal tile-based movement, you get a hexagon.
hexdistance squareDistance


If you find a formula for the number of tiles X tiles away from a centre-point, (doubling back is not permitted) it does work out to 6X for hexagons and 4X for squares. If you were looking for the circumference of a circle, the formula is 2PI*X. 2PI is roughly 6.28318. So 6X comes a lot closer to the non-tiled version than does 4X.

And if you look at the shape of those two, the one based on square tiles makes a diamond shape. If you consider the circumference as travel distance without diagonal movement it would take twice as many moves, and then the ratio is even further off.

So I think if consistency of distance is important in your game, you might prefer hex tiles.

Clustering

One way to measure a connected graph is the clustering coefficient. This is defined by the number of triangles made of three points divided by the number of “triplets.” Triplets in this case are any three points where at least one point is connected to the other two.

According to this value, there’s a dramatic difference between a square grid and a hex grid. A hex grid has a global clustering coefficient of 0.4, a square grid has a global clustering coefficient of 0.

On a square grid, (assuming no diagonals) the smallest loop you can make is a square, with 4 points. So no triangles.

So if you want slightly more or less interconnectedness, consider that in light of this.

Let’s consider two games and how the balance of the game is changed according to these differences.

Carcassonne

Carcassonne tiles are square

I’ll ignore for the moment the river, but each edge of a tile can be either open field, road, or city. The simple formula is 3*3*3*3=81, but you have to take into account some of those are equivalent when rotated. I didn’t think of a more elegant way to do it, but a brute-force approach says there are 24 possibilities when you account for rotations.

If it’s got 6 sides, then 3*3*3*3*3*3=729, but by my brute-force accounting for rotations, that’s down to 130. That is over 5 times as many possible tiles.

In Carcassonne, when you play a tile, you must match it to one or more of the existing tiles, road to road, city to city, etc.

So what percentage of cards will meet the requirements of one edge? Of two? Of three?

Again, I didn’t do anything too fancy, just brute-forced an algorithm that loops through all the possibilities and counts how many could fit.

What I found is if you do a straight comparison of 1 edge hex to 1 edge square, 2 edges hex to 2 edges square, etc. the hex tiles find a match a higher percentage of the time. Which makes sense. You have six ways you can rotate the tile instead of four. But of course, with square tiles, we can have at most four edge requirements, while with hex tiles, we might have up to six. So it starts out easier to make a match, but it becomes much more difficult once you’ve added more sides.

Matches for hex tiles
# of sides sides # of matching tiles % matching
1 field 116 89.2307692308
2 field + road 70 53.8461538462
2 field + field 54 41.5384615385
3 field + road + road 27 20.7692307692
3 field + road + field 25 19.2307692308
3 field + road + city 27 20.7692307692
3 field + field + road 27 20.7692307692
4 F + F + F + F 7 5.3846153846
4 F + F + F + R 9 6.9230769231
4 F + F + R + F 9 6.9230769231
4 F + F + R + R 9 6.9230769231
4 F + F + R + C 9 6.9230769231
4 F + R +R + F 9 6.9230769231
5 F + R +R + F + C 3 2.3076923077
6 1 0.7692307692
Matches for square tiles
# of sides sides # of matching tiles % matching
1 F 18 75
2 FF 7 29.1666666667
2 FR 9 37.5
3 FRF 3 12.5
3 FRC 3 12.5
4 FRFC 1 4.1666666667

Note there is variation between, for example, field + road and field + field. I didn’t consider every possible combination, so these numbers are imprecise, but they should be roughly representative. The variation within a specified number of sides seems to be smaller than the difference between different numbers of sides and between hex and square tiles, so I think it’s still useful without being more precise.

So if you compare them as matching one edge, matching two edges, matching three edges, then hex tiles are easier to play. But if you compare 3 edges on a hex to 2 edges on a square, because both are 50% of the edges, then hex tiles are more difficult to match.

I don’t have a solid way to prove this right now, but I feel like this would encourage a more disperse layout. A tightly-packed layout requires you match more edges. But I think tightly-packed Carcassonne is the more interesting Carcassonne.

Hive

hive
In Hive you win a game by surrounding the other player’s queen bee. Obviously having 6 neighbours or 4 changes the difficulty of that. Note in the photo the the white queen is surrounded on 3 sides. If a square was surrounded on 3 sides, that’s one move from losing, but as a hex, it’s only half-way.

There’s also a restriction that you can’t move a piece if it’s the only thing keeping two parts of the game connected. So for example here, the white queen and white ant can’t move, but the white beetle or grasshopper could. I think here the possibility of triangles makes a big difference. If a tile and two neighbours form a triangle, then any one of the three can be moved without disconnecting the other two. With square-based tiles, the smallest loop with that property requires four tiles.

Or another way to think about it, if a hex tile has two adjacent neighbours, they are also neighbours of one another. For a square tile, this doesn’t happen, and it requires a further tile to bridge them together. So if you tried to play Hive with square tiles, I think you’d have a lot more pieces that become trapped because they are the only piece connecting other pieces together.

More than two possibilities?

Now these two are the most popular, but if the right circumstance comes up, I think some other tiles could make sense.

Triangular tiles would be pretty straightforward, just alternate triangles pointing up and down. Only three neighbours. Those neighbours are not neighbours, so not very tight clustering. (In fact the smallest possible loop is 6 tiles arranged in a hexagon.) Distances can be twice as far depending on whether you’re lined up with one of three directions.

Five-sided tiles?

There was an announcement that a new tiling pentagon was discovered. There were already 14 different classes of tiling pentagon though there are some complexities here.

tilingPentagons

None of them are regular (equal-length sides) like our squares and hexes are. So mechanics that rely on being able to rotate the tile in any direction aren’t going to work.

Even though they have five sides, many of the patterns have more than five neighbours. (And some cases they might have different numbers of neighbours.)

Some rely on the tile being mirrored, so whether that’s acceptable for your purposes may vary. If you are printing tiles for a board game, for example, you’d need to print both sides. And it might be an additional complication for players.

Free-form maps?

And of course there are games with maps that don’t use on a single repeating tile, but are more free-form. For example Risk, or Metropolys have boards where at any given location the number of neighbours at that location can vary. That puts more emphasis on the landscape of the board. A tactic that works in one location needs to be adjusted for other locations. So when considering the question “squares or hexes” consider whether you even need things to be tileable.

Here’s the map from Metropolis with the number of neighbours for each written down.
metropolis

That’s 4 ones, 5 twos, 21 threes, 20 fours, and 5 fives, if you’re curious. Risk (not pictured) has 4 twos, 13 threes, 13 fours, 7 fives, 5 sixes. So, overall more connected than Metropolys. I’ll leave that as an exercise for the reader to consider how changing that would change the balance of the game.

Tagged , | Comments Off on Hex vs Square

Reload sounds

So a difference I noticed recently between Mutant Alien Assault and Super Crate Box. Reload sounds.

The two games are kind of similar genre, so I think it makes sense to compare them. Both require the player switch weapons fairly often.

In Mutant Alien Assault, most of the weapons with the longest reload times have a sound effect that plays when the weapon is available to fire again. For grenade, rocket launcher and mines, it’s pretty obvious, a solid click or beep. The sound for the sniper rifle is a little quieter and easy to miss. The plasma ball (not 100% certain what to call it?) weapon is the one weapon with a long reload time where I can’t hear anything to indicate it’s ready to fire again.

In Super Crate Box, there are a lot of weapons, like the mines, the rocket and grenade launcher that have long reload times but no indication that I can see or hear that the weapon is ready again. I think this has made it a little more frustrating for me to use these weapons, when I don’t have the small sound reinforcing the reload time.

Small thing, but one of those design questions it’s worth considering. If you have something that always takes a certain amount of time, are you doing anything visually or audibly to show that to the player, or are you assuming they will memorize it?

Tagged , , | Comments Off on Reload sounds

Yet another thing for Fungus

Okay, now I made something that modifies the Fungus Say Dialog to work more like it’s a text messaging system, where it shows a series of bubbles of what characters have said, instead of just the most recent Say.

bubblesExample

You can download the files you need here but of course you’ll also need Fungus.

I’ve got an example scene and a prefab called TextDialog. To use it you just drag the TextDialog into your scene. The colour and alignment of the text bubbles are set according to the Name Color and Portraits Face values for whichever character is talking. The left and right on the text bubbles are kind of cheated by putting offsets into the background images. So you’ll need to make your own images to adjust that.

Tagged , , | Comments Off on Yet another thing for Fungus

Arbitrary buttons in Fungus

I’ve made another little thing in Fungus. This time, it allows you to use any UI Button in place of the Menu Dialogs.

So you can set up UI buttons in your scene, and then in the Fungus Block, you can make it go to another block when clicked, same as the Menu Dialogs do.

It relies on extending the MenuDialog class into ButtonMenuDialog. So you have to add a MenuDialog to your scene and then attach the ButtonMenuDialog script to it instead.

I’ve made a small example that uses it for North East South and West buttons, to allow you to navigate a maze, and for a couple interactable things in the maze. DungeonExample.zip If you drop these files into a Unity project that also has Fungus included, it should show how it works.

Tagged , | Comments Off on Arbitrary buttons in Fungus

Fungus animation in Unity

Okay, so the basic Animator in Unity can be intimidating to someone just learning.

A lot of the tutorials for animation in Unity start right into creating transitions between states and using variables to trigger transitions, and sometimes that’s overkill for what you want to do.

There is a function for the Animator class, it’s called Animator.Play. It’s often overlooked, (even that script reference I just linked doesn’t describe it) but it’s pretty nice if you want to cut to the chase and don’t want to use anything fancy.

I’ve been playing a little with the Fungus engine, which is designed for making visual novels, and have node-based flow control.

For the built-in animation commands in Fungus, there are Set Anim Trigger, Set Anim Float, etc. These are all ways to set variables on the animator, and then if you’ve got transitions that activate based on those variables, then the transitions change the state of the animator. So using them requires you set up variables and transitions for whatever you’re doing.

So I figure, sometimes you want to cut out the middleman, and just change states directly. So I made my own Fungus command that lets you directly change state.

Here’s what it looks like in action:
Display of Unity Animator and Fungus command

In the Animator, you can just add states by dragging in animations. You don’t need to make any transitions between states. In the Fungus command, the State Name parameter should be the name of the state that appears in that Animator flowchart. I’ve included Layer parameter in the command, though if you do want to keep it simple, just leave it with the default -1 and leave your animator with the default base layer. The time parameter lets you start the animation part-way through the clip, so 0 will play from the beginning, 0.5 will start half-way through, etc.

You can download the script for this command here.

Tagged , | Comments Off on Fungus animation in Unity

Actually fact

So in this video from LambHoot, he says this: “This isn’t just my opinion, this is actually fact.” This is him saying the quality of Five Nights at Freddies is poor. And then he qualifies his statement by saying the game has got a lot of attention for its lore and story, but “this has nothing to do with the actual gameplay.”

Not to pick on Mr. Hoot, he does do some other very intelligent things in his analysis. (I certainly approve of him making graphs to help analyze the game.) And the supremacy of “actual gameplay” over absolutely everything else can be a useful lens through which to analyze games. (Lenses being the subject of my previous post.)

But I think sometimes this is taken to justify dismissing other aspects of a game that should not be dismissed.

Another quote: “You should never buy a game (and also a game should never be made) because of a story. Novels and films cover stories!”

There’s an idea in soviet montage theory which argues that editing is the only element of film that is unique to film. If you want a story, you can read a novel. If you want to look at pictures, you can look at a painting or a photograph. If you want acting, you can watch a play. If you want choreographed movement, you can watch a ballet. And I would say this is a useful lens to consider film through, and soviet montage theory led to some very good artistic development. But if you used this to dismiss the value of story or acting in films I’d call that dogmatic.

Imagine if I were to say “Never buy a movie because of acting. Plays cover acting!” or “A movie shouldn’t be made because of a story. Novels cover stories!”

Just because an aspect of a game is something done well in other media doesn’t mean it has no value in games.

Emotionally, it’s tempting to feel like you have a superior appreciation of games that those other people who have let themselves be distracted by things like story or graphics. And there are people who are fixated on the idea of “objective” video game reviews, who will latch onto something like this if it aligns with their own priorities for what they value in games. (A major element of my game Gator’s Secrets is that what the Gator deems “objective” is really what aligns with the Gator’s priorities. The criteria he uses for defining True Games is random and arbitrary, but he insists everyone else follow the same criteria.) But if we want to consider games as art it’s very limiting to designate one lens as the only valid way to value games. Art will not be so easy to pin down.

Again going back to my previous post, Ian Bogost argued in favour of systems over characters in games, because systems are what games are uniquely good at. I won’t deny that. It’s just a mistake to think there’s no value in everything else.

Tagged , , | Comments Off on Actually fact

Models of game development, or lenses

Okay, I’m spinning off three articles here:

Against Flow by Lana Polansky.
The Cult of the Peacock by Brendan Vance
Video Games are Better Without Characters by Ian Bogost

What do they have in common? Pointing out something they think is taken for granted in discussions about games. And I think sometimes people who read these are too quick to get into a mentality of “Either A is the Right Way or it’s the Wrong Way.” I try to read these things more in frames of “Here’s something you might find useful.” Now Bogost’s article went a little further into, “This is the superior one-and-only true framework.” But I don’t need the author’s permission to interpret it in the way that I find useful.

Here’s a quote from The Art of Game Design: A Book of Lenses by Jesse Schell which matches my attitude here:

Good game design happens when you view your game from as many perspectives as possible. I refer to these perspectives as lenses, because each one is a way of viewing your design. … None of the lenses are perfect, and none are complete, but each is useful in one context or another, for each gives a unique perspective on your design.

In Jesse’s book, Flow is just one lens of many. It is useful in one context or another. If it gets to be too unchallenged in discussion of game design, I think it’s healthy for people to start focusing on its limitations.

This an image I grabbed from the Wikipedia entry on Flow:
300px-Challenge_vs_skill.svg[1]

Once you start making charts and graphs of people’s emotions, it should be obvious you’re simplifying things. And there are going to be contexts where it’s not a useful model. Flow may be more important for some genres of game than others. Or as Polansky’s article says, it’s good at achieving a certain “desired affective experience” but there are other experiences that are worthwhile and might be more desirable, in some cases.

Bogost’s article, he argues the virtues of making games that emphasize the systems rather than a character the player is supposed to identify as. He has also defined what he called ‘procedural rhetoric” as rhetoric that is uniquely achievable through games. Soviet montage theory proposed that the one element of film unique to film was the edit. Acting is shared with theatre. Visual composition is shared with painting or photography. The story is shared with theatre or with novels. And that is a useful lens to examine film through, but it doesn’t mean there’s no value to be found in these other elements.

For any lens, you need to be open to the exceptions. Maybe you can have meta-lenses that help decide when to make an exception, but sometimes you just have to go by your gut.

Tagged , | Comments Off on Models of game development, or lenses