Frogtoss Labs - title image with flowers
*

The PCG Uniqueness Scale

Wed 25 September 2013
Michael Labbe
#design pcg 

PCG uniqueness scale. Higher is more interesting.

  1. The asset is a direct copy. If an asset is not perceivably different than the one next to it, it is effectively not unique, and is a direct copy.

  2. The asset is visibly distinguishable from another of the same class but is otherwise not special. If an asset is not the same as the one next to it, it is locally unique. It must be perceivably different than the one next to it, but if there are a hundred variations, none of the variations are special. This is the lowest form of uniqueness: it is not a copy, but variants do not provoke further classification by the user. Perlin noise textures are an example of this. Many people believe that this is the true limit of procedural content uniqueness. Not even close.

  3. The asset violates a sense of classification if placed in another area. If an asset would be illogical to a user to place in another area or seemingly makes sense only in the areas where it is placed, it is divisionally unique. Terrain generators that make use of biomes to generate palm trees in tropical areas are divisionally unique.

  4. The asset is notably unique regardless of, or due to, spatial separation. The asset stands out from its surroundings due to properties which are unique from others in its perceived class. It is parametrically unique. A single tree which is larger than all the rest, burned and charred and on the highest hill is an example of this.

  5. The asset has unique properties which simply enforce an entirely different classification by the end user. This may be in spite of a single set of algorithms generating each property under the hood. It is unique by genus. A watermelon in a basket of apples qualifies as being unique by genus.

  6. The asset cannot exist in the same world as another asset. There is no logical way for two assets to exist in the same world. They are represented in such a different manner that there is no opportunity for them to reasonably coexist.

*

What You Need for TV Gaming

Mon 10 September 2012
Michael Labbe
#gaming 

Steam is launching Big Picture Mode this week.  I’ve been excited about this since I hooked our gaming PC up to our big TV. I put together a list of products that you’ll need to do this properly. Monoprice is insanely cheap but makes up some of the cost in shipping. It’s worth it.

First, for A/V, use something like this HDMI cable for video.

ATI video cards have built in 5.1 audio, so feed this into your receiver to get full 5.1 audio for your games. It’s really simple and avoids the need for a dedicated audio cable.

I also believe in having a POWERED usb hub at the destination near the TV rather than at the PC. This is great for headphones and hooking up wireless devices without straining them (and depleting batteries). You will be using a wireless keyboard and mouse.

This USB hub is powered and has a ton of ports. I own 3 and can recommend them.

You will also need USB extension cord(s) in order to run the hub to your PC. Depending on the length, you may need a repeater which amplifies the signal. One or two of these ought to do the trick: link

For controllers, the best is the Xbox 360 wireless controller. Here’s an Amazon linkto the Xbox 360 wireless receiver. These just work. Plug it into the USB hub that is near your TV.

For i/o, consider the Logitech Wireless Touch Keyboard K400.

You won’t be playing games with that touchpad, but it does let you navigate without hassle from the couch. Yes, you can do things like use iPhone apps for navigating but they are all useless when your computer goes into the BIOS and you have to drop everything and plug in a usb keyboard. This is the way to go.

As for setup, the PC is in my office with a monitor hooked up via DVI. On Windows 7, use Windows Key-P to bring up projector options to switch between the monitor and the TV. This allows the PC to continue operating as a normal desktop machine while making it easy to switch to running it on the TV.

Because the computer is in the office, there is nothing fancy about ethernet or power running that has to be done. And it’s a hell of a lot quieter than an Xbox because it’s in the other room.

Finally, we put the computer into sleep mode when we’re not using it and set it to wake on keyboard press. With this setup, we can fire it up to watch a show or play music and then it powers down again without having to boot it fresh every time.

Make sure your video card has good performance at 1920x1080, since that’s your TV’s native res. No 720p here — 33% more pixels than an Xbox. We use an ATI 6970 for this and it’s quite good at running most modern games at 60fps with 2xAA.

Grab zap straps from Monoprice so you can neatly tie your USB extension and HDMI cables together after you run them to your receiver.

Enjoy!

*

Physics Tutorial: Adding Crush Damage With Box2D

Wed 02 May 2012
Michael Labbe
#tutorial code 

What my face sees seconds before it hits the
monitor

There are two ways to really beat something up in a physical game: first, throw the object against the wall and, second, toss a heavy boulder on top of the object. The former can be thought of as impact damage. The velocity of the two objects colliding determines the magnitude of the impact.

The second is more challenging to get right. This iscrush damage. It takes some processing to determine when something is crushed and how badly it is crushed.

In some games, you have a crushing ceiling that descends slowly and squeezes players into the ground. Let’s take this simple example as a starting point and work from there: the crushing ceiling descends on the player. As the crushing ceiling pushes the player further into the floor, the player starts losing health and dying.

That’s great, but what happens in a more complicated simulation with rigid bodies that can roll out of the way? Perhaps a heavy block falls on an object, but the object squeezes out to the left. Sure, the big block penetrated your ball for a single frame, but this was quickly resolved by the physics solver by applying an impulse at to the proper point on the ball. You can’t simply tag the ball as crushed and respond with death in your game code.

The rest of this tutorial looks at addressing this problem with Box2D. Box2D is remarkably stable when dealing with significant mass ratio differences.

One way of solving this is to look at how long two fixtures (components of rigid bodies) stay interpenetrated and to apply damage when a time threshold has been reached. The assumption is that the solver does a great job of applying impulses to separate the two bodies, so when they fail, it’s a sign that there is not enough space for them to coexist. This is encroachment, and if it endures for a period of time, one of the encroaching objects is crushing the other one.

Let’s recap what we want out of production quality crush detection, and then we’ll get into an implementation you can build from.

  • Detect impact damage separately from crush damage. Crush damage is the continuous pressure from forces from one object to another, causing encroachment. Impact damage happens in a single frame. These fire different gameplay events.
  • Determine which object is crushing and which one is doing the crushing. A heavy object crushing another because of gravity is one thing, but an object with propulsion can push another object against the wall, causing it to be crushed. Horizontal pressures causing encroachment are still potentially a crush scenario!
  • Compute crush magnitude independent of framerate. Keep in mind that force-based solvers tunnel in most situations. Box2D is no exception — if you have a long frame, you’ll tunnel further. We need to pass predictable and stable crush values to the game code regardless of framerate variability.
  • Handle light objects bumping without crushing. If a paperclip lands on your head, you don’t want to die. Most players would object and promptly post an embarrassing yet funny video to Youtube.
  • Scale the simulation to a large number of objects. Spot all of the opportunities to exit early in your crush detection routines and take advantage of them!

So, that’s what we want. In the second part, we’ll get our hands dirty with some source code.

Page 10 of 13