The Indian warriors in America where usually much more fit than the colonial frontiersmen from England, because they played games (the modern sport of lacrosse is based on an Indian game). The colonials didn't exercise their warrior skills unless they were in a war, consequently they became soft-muscled and out-of-practice during peace times.
The games of the Indians were extremely important to the warrior's development. A sport could be played at any time and didn't cause deaths. Most of the important skills needed in war could be practiced and learned by beginners, without most of the beginners dying in the process.
The mental skills used in today's society (which include creativity, resource management and planning, personal interaction, interaction in the context of laws and morality, and analysis of technical situations) can be learned in games like video games. But current video games are absolutely trash, and train people in all kinds of stupid mental habits.
Do video games train people in creativity? Most gaming experiences are almost completely passive from the creativity perspective. Artistic creation is something that only game designers do and players do not take part in. You might not think that games can be any other way, but there are many ways that game-playing can be a creative process. The game experience should ideally be a cooperative creation process, the game designer providing tools and incentive for the player to use for unique "works of art".
Do video games train people to interact in the context of laws? (mostly I'm talking about MMORPGs, games with many people interacting) No, the laws of an in-game society are enforced the same way the laws of in-game physics are enforced. This leads to people trying to circumvent the societal laws of a game the same way a scientist tries to circumvent physical restrictions. Cheaters are honored as "haxors" and no one is encouraged to work to help the society, because creating the society is the responsibility of the game creators. Game players are not pulled together, but encouraged to be loners, antagonistic, and dependent on an external "government".
Do video games encourage resource management and planning? Most games completely ignore any kind of conservation laws: objects, energy, and everything is created and destroyed at will. The economies of MMORPGs are completely made-up. Nothing really wears out in most situations... Gamers who have played for longer are ALWAYS richer than newer players, because nothing requires effort to maintain. No character ever needs to buy food to eat.
Do video games encourage any analysis of technical situations, like experimentation to figure out unusual situations? Is deeper understanding requiring abstract thinking of any kind encouraged? Not even close. Becoming an expert at a game requires nothing more than memorizing a list of completely arbitrary facts. Most everything you encounter has a label describing exactly what it is.
(More "Making Stuff Move" soon!)
Thursday, December 3, 2009
Saturday, October 31, 2009
Making Stuff Move: Euler's Method
Before we jump into Euler's method, we need to understand two basic things: acceleration and Newton's Laws of Motion, especially the second law.
(If you don't already understand how position, velocity, and acceleration all fit together, you may need to study pictures and animations. Try the flash animations under "Classical Physics" on this page.)
Imagine a rocket ship that doesn't have enough fuel to get into space. After it burns all its fuel, it will be falling with nothing but gravity affecting it. Gravity will push anything straight down with a constant acceleration. (Unless the object is stopped from moving, say by being on the ground.) The constant acceleration due to gravity will make a free-falling object have more and more velocity as time goes on. A rocket that's been falling for a longer time will be moving faster than an rocket that was only falling for a short time.
You know what happens when you accelerate a car (with the accelerator pedal, of course): the speed of the car will increase. The magnitude of the acceleration tells you how quickly the speed is changing. You also know what happens to the car when it has speed (or velocity): the position changes. The position might change so quickly that it interferes with a policeman's radar gun. You can find the speed from the acceleration, and the position from the speed. Acceleration is the "derivative" of velocity, which is the "derivative" of position. You can think of derivative as a difference, or the amount of change. So if the car is accelerating, the velocity is becoming larger. The car is moving faster every second.
Once you understand acceleration, Newton's Laws are very easy. Newton's second law is:
F = m*a
Force equals mass times acceleration. This equation is describing a specific situation in which a force is pushing against an object and making it move. If the object has mass m and it accelerates with a magnitude a, you know the force pushing against it is m*a. And in a form that's more useful to us:
a = F/m (divide both sides of the equation by m)
If the object has mass m and you know the force against it is F, the object will accelerate at F/m.
The rocket ship burns fuel to create a force that pushes upwards. That force causes an acceleration on the mass of the ship. The same engine on a lighter ship will cause more acceleration.
Now we can move on to Euler's method. The acceleration in most simulations is changing all the time, so finding the position of the objects becomes extremely difficult. Euler's method is just a dumb assumption: assume the acceleration never changes for a short amount of time. Then we can use this constant acceleration to calculate the position and velocity of the objects a short time later.
Here are the actual calculations you can use (which you can derive yourself with a little calculus or a heaping helping of algebra):
starting position is x
starting velocity is v
if acceleration a is constant for a short period of time t,
the new velocity is v + t*a
the new position is x + 1/2*t*t*a + t*v (1/2*t*t*a is one half t squared times a)
You can probably understand the meaning of the expression for velocity even if the expression for position looks too weird. You can also approximate the new position by x + t*v since 1/2*t*t*a is usually very small.
And here's a little explanation of the way you'd use that in a program:
Use our same rocket ship with mass m, but this time give it plenty of fuel and put it in space. You can calculate the forces against the ship at any time. The forces involve the gravity of planets, the ship's engines, and other things, such as little asteroids hitting the hull. You have lots of little functions that calculate the forces, so just sum them up. (You do know how forces can be added up, right? OK, just trust me. You can add them up into one big force.)
Force = gravity(depends on ship's position) + rocket + asteroidA + asteroidB
(You can see how the force might be very complicated and change dramatically over time)
Accel = Force/Mass
We draw the ship at its current position, then update and draw at its new position after a short time.
NewPosition = Position + Accel*0.5*t*t + Velocity*t
NewVelocity = Accel*t
Nothing could be easier! draw the frame and calculate Accel again, then update the postion for the next frame.
in C++/Java-ish code:
while(simulationIsRunning) {
accel = calculateCurrentAccelleration();
ship.pos += (ship.vel*t + accel*t*t*0.5);
ship.vel += accel*t;
ship.draw();
}
Next time, "Making Stuff Move: The Two Most Interesting Forces". Don't miss it!
(If you don't already understand how position, velocity, and acceleration all fit together, you may need to study pictures and animations. Try the flash animations under "Classical Physics" on this page.)
Imagine a rocket ship that doesn't have enough fuel to get into space. After it burns all its fuel, it will be falling with nothing but gravity affecting it. Gravity will push anything straight down with a constant acceleration. (Unless the object is stopped from moving, say by being on the ground.) The constant acceleration due to gravity will make a free-falling object have more and more velocity as time goes on. A rocket that's been falling for a longer time will be moving faster than an rocket that was only falling for a short time.
You know what happens when you accelerate a car (with the accelerator pedal, of course): the speed of the car will increase. The magnitude of the acceleration tells you how quickly the speed is changing. You also know what happens to the car when it has speed (or velocity): the position changes. The position might change so quickly that it interferes with a policeman's radar gun. You can find the speed from the acceleration, and the position from the speed. Acceleration is the "derivative" of velocity, which is the "derivative" of position. You can think of derivative as a difference, or the amount of change. So if the car is accelerating, the velocity is becoming larger. The car is moving faster every second.
Once you understand acceleration, Newton's Laws are very easy. Newton's second law is:
F = m*a
Force equals mass times acceleration. This equation is describing a specific situation in which a force is pushing against an object and making it move. If the object has mass m and it accelerates with a magnitude a, you know the force pushing against it is m*a. And in a form that's more useful to us:
a = F/m (divide both sides of the equation by m)
If the object has mass m and you know the force against it is F, the object will accelerate at F/m.
The rocket ship burns fuel to create a force that pushes upwards. That force causes an acceleration on the mass of the ship. The same engine on a lighter ship will cause more acceleration.
Now we can move on to Euler's method. The acceleration in most simulations is changing all the time, so finding the position of the objects becomes extremely difficult. Euler's method is just a dumb assumption: assume the acceleration never changes for a short amount of time. Then we can use this constant acceleration to calculate the position and velocity of the objects a short time later.
Here are the actual calculations you can use (which you can derive yourself with a little calculus or a heaping helping of algebra):
starting position is x
starting velocity is v
if acceleration a is constant for a short period of time t,
the new velocity is v + t*a
the new position is x + 1/2*t*t*a + t*v (1/2*t*t*a is one half t squared times a)
You can probably understand the meaning of the expression for velocity even if the expression for position looks too weird. You can also approximate the new position by x + t*v since 1/2*t*t*a is usually very small.
And here's a little explanation of the way you'd use that in a program:
Use our same rocket ship with mass m, but this time give it plenty of fuel and put it in space. You can calculate the forces against the ship at any time. The forces involve the gravity of planets, the ship's engines, and other things, such as little asteroids hitting the hull. You have lots of little functions that calculate the forces, so just sum them up. (You do know how forces can be added up, right? OK, just trust me. You can add them up into one big force.)
Force = gravity(depends on ship's position) + rocket + asteroidA + asteroidB
(You can see how the force might be very complicated and change dramatically over time)
Accel = Force/Mass
We draw the ship at its current position, then update and draw at its new position after a short time.
NewPosition = Position + Accel*0.5*t*t + Velocity*t
NewVelocity = Accel*t
Nothing could be easier! draw the frame and calculate Accel again, then update the postion for the next frame.
in C++/Java-ish code:
while(simulationIsRunning) {
accel = calculateCurrentAccelleration();
ship.pos += (ship.vel*t + accel*t*t*0.5);
ship.vel += accel*t;
ship.draw();
}
Next time, "Making Stuff Move: The Two Most Interesting Forces". Don't miss it!
Labels:
"Making Stuff Move",
acceleration,
code,
Euler,
force,
velocity
Thursday, October 29, 2009
Making Stuff Move: Intro
Funny how the computer world and the real world are different.
In the real world, stuff bashes together all the time. Friction and noise can never be escaped. You desperately try to isolate and keep things separate.
In a computer simulation, stuff never bashes together enough. You have to carefully check everything for interaction and calculate the results. It's tough to make things move realistically. Bashing and scraping and friction take a lot of planning and effort.
That's what I'll be writing about next, simulation. I'll start with the simplest possible simulation, and slowly introduce improvements and explain when the improvements are needed.
Up next, "Making Stuff Move: Euler's Method". Don't miss it! :)
(I'll soon be finished with the first bit of actual code for Carbonworks, which will be a framework for an Euler's Method simulation.)
In the real world, stuff bashes together all the time. Friction and noise can never be escaped. You desperately try to isolate and keep things separate.
In a computer simulation, stuff never bashes together enough. You have to carefully check everything for interaction and calculate the results. It's tough to make things move realistically. Bashing and scraping and friction take a lot of planning and effort.
That's what I'll be writing about next, simulation. I'll start with the simplest possible simulation, and slowly introduce improvements and explain when the improvements are needed.
Up next, "Making Stuff Move: Euler's Method". Don't miss it! :)
(I'll soon be finished with the first bit of actual code for Carbonworks, which will be a framework for an Euler's Method simulation.)
Tuesday, June 9, 2009
Perception As Intelligence
I've been a big fan of Douglas Hofstadter ever since "Godel Escher Bach", and one of his ideas is that perception is not only important for intelligent beings, but it's the greatest part of intelligence. His projects often focus on creating a program that can perceive the essential character of a situation. After the situation is well understood, finding a reasonable course of action is often trivial.
I think that's a great piece of perception on Hofstadter's part. How do you figure 24 times 4? You might perceive that 24 is one less than 25, so 4*24 must be four less than 4*25 or one hundred. After you understand the unusual nature of 24, it is a simple task to see that 4*24 is 96.
Martial artists tells many real life stories of wizened old masters easily defeating opponents because of their great perception. Where I might only see a big guy running at me and freak out, a master would immediately see, "He's overreaching and leaning too far forward," or "He's leaving a big opening on his left". Check out this demonstration of a Judo expert comfortably defeating a powerful and skilled opponent. He just perceives the balance of his opponent clearly.
I wish artificial intelligence in games would focus more on perception. The tendency I've seen in games like Halo (And I admit I haven't seen very much recently- I'd like to study more of the small pay-for-download games on say, X-Box live) is to make a very large list of scripted actions and pre-determine the important characteristics of a playing field. An intelligence based on Hofstadter's Copycat analogy engine, for example, would be much simpler and have surprising results. (And be able to be used on custom fields without modification.) I feel that today's smaller games must focus on "emergent" qualities rather than a huge database of scripted actions. An artificial intelligence focusing on perception would be much simpler and still have very clever human-like action.
I think that's a great piece of perception on Hofstadter's part. How do you figure 24 times 4? You might perceive that 24 is one less than 25, so 4*24 must be four less than 4*25 or one hundred. After you understand the unusual nature of 24, it is a simple task to see that 4*24 is 96.
Martial artists tells many real life stories of wizened old masters easily defeating opponents because of their great perception. Where I might only see a big guy running at me and freak out, a master would immediately see, "He's overreaching and leaning too far forward," or "He's leaving a big opening on his left". Check out this demonstration of a Judo expert comfortably defeating a powerful and skilled opponent. He just perceives the balance of his opponent clearly.
I wish artificial intelligence in games would focus more on perception. The tendency I've seen in games like Halo (And I admit I haven't seen very much recently- I'd like to study more of the small pay-for-download games on say, X-Box live) is to make a very large list of scripted actions and pre-determine the important characteristics of a playing field. An intelligence based on Hofstadter's Copycat analogy engine, for example, would be much simpler and have surprising results. (And be able to be used on custom fields without modification.) I feel that today's smaller games must focus on "emergent" qualities rather than a huge database of scripted actions. An artificial intelligence focusing on perception would be much simpler and still have very clever human-like action.
Labels:
artificial intelligence,
Hofstadter,
philosophy
Thursday, March 26, 2009
Ignoring the purpose of natural reactions
There is a way that games have of being non-intuitive that needs to be addressed. They find an interesting image or experience, and use it for a cheap effect without working it into the game's mechanics. I know that early games couldn't be very realistic, but modern games have no excuse. I'll give three examples that I think are particularly ugly.
The Silent Hill games use a really cool blood and rust theme in many of the level designs, complete with a gross squishing sound when your character walks on some surfaces. But as you play the game, you start to ignore the grossness because it's not important to the gameplay. Why is grossness worrying in real life? It gets you dirty, and bodies and stuff tend to have diseases that you should avoid. But in the game, your character has no possibility of getting dirty. Characters will often jump in freezing water, then be dry and warm the moment they jump out. If getting dirty really does become meaningful in the game... Even if your character could "look" dirty, or if your character sinks into certain surfaces... Any attempt to be true to the underlying reason grossness is "horrifying" will emphasize the horror and provide a better player experience.
The survival horror games tend to abuse this a lot. They use a very frightening or stressful image and ignore the real reason that image is stressfull. (sharp weapons- but they hurt you the same way blunt weapons do. Gigantic enemies-but they hurt you the same way small characters do. Even the knock-back animation ignores the size and mass of the characters involved. Creepy sounds all the time- but it's just the background music, no relationship with real things in the game)
Another natural reaction that is ignored is size and mass. Every fighting game pits tiny characters and huge ones together, and the tiny ones have just as much of a chance. They even fight with the same style as the large characters. A little girl can pick up and throw a 300 pound sumo wrestler. She can punch the sumo wrester and knock him backwards. It is natural to be frightened for a small fighter and be joyful when she overcomes the odds and wins, but these games abuse that natural reaction and ignore the real reason for it. The player's intuition becomes so dull that it doesn't seem unusual anymore.
(By the way, remember Trinity's jumping crane kick in the opening scenes of the Matrix? She jumps straight up and lands straight down, but the cop she kicks flys across the room into the wall... where did all that forward momentum come from?... I guess she was blurring the physics of the Matrix, but I have a sneaking suspicion the fight choreographers are used to getting away with too much.)
One last example that came to mind while slapping this blog entry down is Grand Theft Auto. Why is crime so shocking? Criminals tend to go to jail. Or die. (Live by the sword, die by the sword, and just about half the verses in Proverbs). But the cops in Liberty City seem to be too busy eating donuts to corroborate witnesses and figure out who's hijacking all these cars.
I know that games should give players a sense of freedom and power, but I would argue that acknowledging the natural laws that govern players' reactions will give the players a more satisfying experience. Stretch the laws, don't just ignore them.
The Silent Hill games use a really cool blood and rust theme in many of the level designs, complete with a gross squishing sound when your character walks on some surfaces. But as you play the game, you start to ignore the grossness because it's not important to the gameplay. Why is grossness worrying in real life? It gets you dirty, and bodies and stuff tend to have diseases that you should avoid. But in the game, your character has no possibility of getting dirty. Characters will often jump in freezing water, then be dry and warm the moment they jump out. If getting dirty really does become meaningful in the game... Even if your character could "look" dirty, or if your character sinks into certain surfaces... Any attempt to be true to the underlying reason grossness is "horrifying" will emphasize the horror and provide a better player experience.
The survival horror games tend to abuse this a lot. They use a very frightening or stressful image and ignore the real reason that image is stressfull. (sharp weapons- but they hurt you the same way blunt weapons do. Gigantic enemies-but they hurt you the same way small characters do. Even the knock-back animation ignores the size and mass of the characters involved. Creepy sounds all the time- but it's just the background music, no relationship with real things in the game)
Another natural reaction that is ignored is size and mass. Every fighting game pits tiny characters and huge ones together, and the tiny ones have just as much of a chance. They even fight with the same style as the large characters. A little girl can pick up and throw a 300 pound sumo wrestler. She can punch the sumo wrester and knock him backwards. It is natural to be frightened for a small fighter and be joyful when she overcomes the odds and wins, but these games abuse that natural reaction and ignore the real reason for it. The player's intuition becomes so dull that it doesn't seem unusual anymore.
(By the way, remember Trinity's jumping crane kick in the opening scenes of the Matrix? She jumps straight up and lands straight down, but the cop she kicks flys across the room into the wall... where did all that forward momentum come from?... I guess she was blurring the physics of the Matrix, but I have a sneaking suspicion the fight choreographers are used to getting away with too much.)
One last example that came to mind while slapping this blog entry down is Grand Theft Auto. Why is crime so shocking? Criminals tend to go to jail. Or die. (Live by the sword, die by the sword, and just about half the verses in Proverbs). But the cops in Liberty City seem to be too busy eating donuts to corroborate witnesses and figure out who's hijacking all these cars.
I know that games should give players a sense of freedom and power, but I would argue that acknowledging the natural laws that govern players' reactions will give the players a more satisfying experience. Stretch the laws, don't just ignore them.
Saturday, February 28, 2009
Entertainment Books
I found The Art of Game Design: A Book of Lenses by Jesse Schell at the library, and I think I'm going to buy it. Every page has been an enlightenment and inspiration.
The author worked in juggling and magic shows, huge Disney theme experiences, and many varieties of video game. His love for entertaining audiences of all kinds shines through. The book is very entertaining itself, I guess Jesse can't help himself.
I love reading books by masters of entertainment. I've read several great books by movie directors and short story writers, and they communicate a real joy and love of life.
The author worked in juggling and magic shows, huge Disney theme experiences, and many varieties of video game. His love for entertaining audiences of all kinds shines through. The book is very entertaining itself, I guess Jesse can't help himself.
I love reading books by masters of entertainment. I've read several great books by movie directors and short story writers, and they communicate a real joy and love of life.
Tuesday, February 24, 2009
Roshambo, math stuff
Rock, paper, scissors, or roshambo* is a really cool game, and a nice way to add some flavor to a conflict system. Everyone probably knows the game, but I'll describe it for completeness' sake. Two players each choose a "method of attack" independently without seeing the other's choice (usually by doing it quickly at the same time). There are three choices, if both players choose the same attack, it's a draw. otherwise,
Rock crushes Scissors,
Scissors cuts Paper,
Paper covers Rock.
*You can spell it Rochambeau if you want to be utterly pretentious. Or French.
This system of defeats is cool for several reasons. It's completely symmetrical (one other option will beat you, one can be beaten, for every choice) It's "non-transitive". That means that if A beats B and B beats C, A won't necessarily beat C. (Imagine the relationship "greater than". If A is greater than B and B is greater than C, then A is always greater than C. That's a transitive relationship.) Transitive relationships always have a neat hierarchy, but non-transitives can have loops.
These mathematical properties mean that there's no best choice. There is never an easy rule for winning. That's a good recipe for an interesting game.
Another much richer system with some similarities to Roshambo is the Chinese elements. There is a constructive and a destructive cycle which both use five elements:
Constructive Cycle:
Fire makes ashes which are Earth
Earth gives the ore to make Metal
Metal forms Water droplets through condensation
Water feeds Wood
Wood burns to create Fire
Destructive Cycle:
Fire melts Metal
Metal cuts Wood
Wood draws up Earth
Earth dams Water
Water quenches Fire
This system is also completely symmetric and non-transitive, and the mnemonics for the cycles are very suggestive. The five elements are rich with meaning from the traditions of Feng Shui. But it is a bit harder to remember than the three "element" roshambo.
Another thing I might mention, symmetry is not really an advantage. It tends to make the system boring for the users. Only by the symbolism of the elements is a symmetric system made interesting. A slightly unbalanced but still non-transitive system without any dominating element should be more interesting, at least in theory. How about this one? (Called "Undercut", introduced by my hero Douglas Hofstadter).
Undercut:
Two players each choose a number from one to five. The highest number wins the difference between the two choices, unless one player undercuts the other's number by exactly one. Then the undercutting player gets the sum of both numbers. Of course a tie gives no one any points.
This system has no dominating number (any number can be beaten by another number) but a strategy of playing each number 1/5 of the time isn't the best idea-certain numbers have a better payoff and should be played more frequently. Can you guess which number should be played the most?
The system of four card suits with one trump is also surprisingly interesting. The trump is usually restricted to only be played after nothing else can be played legally for a certain user. (the trump would beat any card, so it has to be restricted some way.)
Usually small wrinkles added to a symmetric system can add a surprisingly large amount of strategy, interest, and replay value.
As usual, I'm disappointed by the element magic systems used in most RPGs. it's usually not very meaningful in the game or useful only in a certain place. And the magic systems are usually very boring. Making a system that is interesting and simple enough to remember easily is a great challenge.
Rock crushes Scissors,
Scissors cuts Paper,
Paper covers Rock.
*You can spell it Rochambeau if you want to be utterly pretentious. Or French.
This system of defeats is cool for several reasons. It's completely symmetrical (one other option will beat you, one can be beaten, for every choice) It's "non-transitive". That means that if A beats B and B beats C, A won't necessarily beat C. (Imagine the relationship "greater than". If A is greater than B and B is greater than C, then A is always greater than C. That's a transitive relationship.) Transitive relationships always have a neat hierarchy, but non-transitives can have loops.
These mathematical properties mean that there's no best choice. There is never an easy rule for winning. That's a good recipe for an interesting game.
Another much richer system with some similarities to Roshambo is the Chinese elements. There is a constructive and a destructive cycle which both use five elements:
Constructive Cycle:
Fire makes ashes which are Earth
Earth gives the ore to make Metal
Metal forms Water droplets through condensation
Water feeds Wood
Wood burns to create Fire
Destructive Cycle:
Fire melts Metal
Metal cuts Wood
Wood draws up Earth
Earth dams Water
Water quenches Fire
This system is also completely symmetric and non-transitive, and the mnemonics for the cycles are very suggestive. The five elements are rich with meaning from the traditions of Feng Shui. But it is a bit harder to remember than the three "element" roshambo.
Another thing I might mention, symmetry is not really an advantage. It tends to make the system boring for the users. Only by the symbolism of the elements is a symmetric system made interesting. A slightly unbalanced but still non-transitive system without any dominating element should be more interesting, at least in theory. How about this one? (Called "Undercut", introduced by my hero Douglas Hofstadter).
Undercut:
Two players each choose a number from one to five. The highest number wins the difference between the two choices, unless one player undercuts the other's number by exactly one. Then the undercutting player gets the sum of both numbers. Of course a tie gives no one any points.
This system has no dominating number (any number can be beaten by another number) but a strategy of playing each number 1/5 of the time isn't the best idea-certain numbers have a better payoff and should be played more frequently. Can you guess which number should be played the most?
The system of four card suits with one trump is also surprisingly interesting. The trump is usually restricted to only be played after nothing else can be played legally for a certain user. (the trump would beat any card, so it has to be restricted some way.)
Usually small wrinkles added to a symmetric system can add a surprisingly large amount of strategy, interest, and replay value.
As usual, I'm disappointed by the element magic systems used in most RPGs. it's usually not very meaningful in the game or useful only in a certain place. And the magic systems are usually very boring. Making a system that is interesting and simple enough to remember easily is a great challenge.
Labels:
constructive,
destructive,
element,
Hofstadter,
magic,
math,
non-transitive,
paper,
rock,
roshambo,
RPG,
scissors,
symmetric,
transitive
Subscribe to:
Comments (Atom)