0
101 Mar 24, 2009 at 05:51

Hello hai to every one
I want to make the characters in a game world react has real world characters.Example going to job,waiting for bus,driving cars,teasing others,fighting with others.Some one please guide me.I don’t know where to begin and which algorithms suitable for this.

–Rajesh–

#### 18 Replies

0
96 Mar 24, 2009 at 19:58

Do you have a game written so you could do so in the first place?

0
101 Mar 25, 2009 at 04:31

No.But i want to know how do that before starting a project.Because don’t want to struggle in middle of the project.

0
96 Mar 25, 2009 at 04:35

You’re trying to recreate The Sims I assume. Honestly, I’d have no idea off the top of my head.
Good luck though. :)

0
101 Mar 25, 2009 at 04:39

Can any one tell me what are the possible things for do crowd simulation

0
101 Mar 25, 2009 at 05:27

thank you for your wish hyper

0
103 Mar 25, 2009 at 05:33

Set up a “character” structure or object and make this the centre point for all activity that revolves around the characters.

I actually make all my games like this, cause it suits anything from a 2d shooter to an adventure game.

here you have a position on the map, any conversations that the character says in the game are stored in this structure.

collision detection and all ai is done here too.

every frame of the game iterate through the list of instantiated characters like this->

int i;
for(i=0;i<CHARACTERS;i++)
{
if(character[i].active)
{
//perform collision detection

//ai

//render character
}
}

0
101 Mar 25, 2009 at 07:29

Thank you rouncer its simple and nice
But what are the other concepts and algorithm needed to do this

0
103 Mar 25, 2009 at 07:45

Get something simple running first, and see what you can come up with yourself - then come back with a more specific question and ill try to help you out.

What your asking is too broad, I might as well point you to a game programming book I cant go an explain the whole thing to you, would take 10 pages and a good proof reading.

Just get some guys walking around and when they bump into each other they say “hi” that would be the beginning.

0
119 Mar 25, 2009 at 08:09

There’s a reason why there aren’t any games on the market where characters react like “real world characters”. Every example is limited.

• Sims is probably the most complex. All characters have set of needs that grow, and when something overflows (like having to go to the toilet), the character overrides whatever it was doing to try to fulfill this need. Still, without guidance, the characters don’t really manage..

• Black & white had some primitive learning things. Character does some random action, and if the player punishes (or rewards) the character, it is less (or more) likely to do said random thing again.

• GTA pedestrians just walk around randomly. More advanced characters (like fleeing opponents) know how to use vehicles etc, but it’s not all that complicated.

• Hitman series characters are pretty pre-scripted, and if anything unusual happens, the more complex actions (like go to the bar and get a drink) are disturbed and the characters turn into generic “hunt the player” mode.

• Settlers series characters have a job, and it’s pretty simple: woodcutter seeks wood, chops it down, drags it to a pile. Someone else’s job is to move the pile to the sawmill, etc.

I could go on, but do I need to?

In order to have a fully functional town of a couple hundred characters living their lives, interacting, etc, would probably be a lot of work. If nothing else, it would be a debugging hell. Still, I have some game ideas that are based on exactly such a system =)

0
101 Mar 25, 2009 at 08:45

just pick actions randomly, and do them for a randomly selected period of time.

Players won’t be able to tell the difference from that or a more complex simulation.

0
141 Mar 25, 2009 at 11:56

I think the best place to start for something like that is A Star path finding. Generally you have a map, probably made of squares, but it could be nodes. Then the character makes decisions, perhaps random, or perhaps with a hierarchy of motives programmed in and moves to different locations and does things. You can do a search for A Star and find some tutorials to get you started. There are some pretty good ones around. It’s best to start with simple games and work up. So, having monsters that jump and shoot at the main character when they come by is a simple form of AI. Games like the Sims have something like a million lines of code so you have to pare down your expectations a bit.

0
101 Mar 25, 2009 at 20:51

As Mattias states, the goal should not be to fully model reality, which would be painful to process in real-time, but to create a model that seems plausible and fits in with the needs. As Sol_HSA illustrates, do you need to simulate a crowd as “decoration”, such as in GTA, or is it central to your game, as in Sims?

The more advanced ones (as in more realistic, but also much harder to code up) are agent systems because they represent each person individually, ie. as an agent. An agent is really a combination of rules, FSMs, pathfinding and collision detection code that responds to events and information about the environment.

This is a not an easy field. You may want to start by learning about AI in general, then about pathfinding and FSMs, then try to find out more about city simulations, depending on the depth you need in your game…

0
101 Mar 25, 2009 at 20:58

BTW, take a gander at this:
http://www.red3d.com/cwr/ibm.html

And, if you want a taste of how complicated it can get:

http://www.swarm.org/index.php/Swarm_main_page

First, establish what you need and do no more. IOW, make sure you don’t forget the KISS principle.

Have fun!

0
101 Mar 25, 2009 at 21:11

I was just doing some research for AI a little earlier today and one of the things I found may be of use to you.

http://www.cs.ucl.ac.uk/research/vr/Projects/Crowds/EGUK03/

Hope it helps.

0
101 Mar 26, 2009 at 05:45

what u need related to crowd simulation ?

0
101 Mar 26, 2009 at 07:00

Thank you for all above guy’s
i need
people’s moving from A to B,
vehicle’s moving from A to B,
people’s have to react for events(ex:accident’s,especially when interact with player)
almost like GTA crowd’s

0
101 Mar 26, 2009 at 08:12

yes. ok.

so for motion, u need to have a collision detection algorithm. to simulate the behaviours u need to use a behaviour model and based on that do the decision making. A Star or D star for your motion planning.

interactions for events. u need to build a knowledge based human behaviour model.

0
96 Mar 26, 2009 at 23:24

@rajesh kumar

people’s moving from A to B,
vehicle’s moving from A to B

That’s very simple! :) Set an objective point (assuming it’s on a squared grid):

If Player's X < Objective
Player's X++
Else if Player's X > Objective
Player's X--