Hacker News new | ask | show | jobs
by kamaal 5018 days ago
How do video games solve it?

Do you have any material one can read to learn more about this?

2 comments

Often through physics engines. You express a bunch of constraints then let a physics engine solve them on each time step (and sometimes across multiple time steps).

Custom (non-physics) solutions involve declarative sets of constraints being solved by some sort of engine; such solutions often start to resemble physics engines even if the physical rules even if the constraints are not exactly physical.

Learning how to use a physics engine, first, then how those physics engines work, is a good start to understanding these kinds of problems.

Edit: I'm really surprised the stackexchange answers don't mention this.

What would be a good place to start learning about what you're describing here?
I would start with Erin Catto's Box2D.

http://box2d.org/

There are C#, Flash, Java versions if you aren't into C++. Lots of documentation on the web, but the getting started guide is good enough.

Using a physics engine to express an AI problem? That's an interesting solution, but that's certainly the first time I've heard of one being used like this?
But you know, the problem as stated was how a bunch of influences affect...cows. So think of them as a bunch of mechanical cows instead, and the influences are modeled through springs and collisions, things like that.

AI is often cast as constraint solving, and a physics engine is basically a constraint solver. Of course, for real the AI engine runs next to the physics engine. Ah! I should have mentioned Rodney Brooks' work:

http://en.wikipedia.org/wiki/Subsumption_architecture

where you model intelligence as a bunch of simple prioritized reflex-like behaviors. Now, on each step, you have each "entity" execute their reflexes according to the current environment, where some reflexes act to disable others. The reflexes are incredibly simple, you probably couldn't even express A* path finding, but you could have the act as ants following a diffusely scented trail. Also see his paper "Elephant's Don't Play Chess."

If I was given the task to integrate cow herds in a computer game, my first instinct would be BOIDS/flocking, adding in weights for wind velocity and sun. It's fast and lends itself to predictable behaviour which is beneficial to the player.

It may not necessarily be realistic but then most players won't be familiar with cow movements.