Jump to content


Mobile objects(AI in game)


18 replies to this topic

#1 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 24 March 2009 - 05:51 AM

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--

#2 Hyper

    Valued Member

  • Members
  • PipPipPip
  • 195 posts

Posted 24 March 2009 - 07:58 PM

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

#3 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 25 March 2009 - 04:31 AM

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

#4 Hyper

    Valued Member

  • Members
  • PipPipPip
  • 195 posts

Posted 25 March 2009 - 04:35 AM

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

#5 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 25 March 2009 - 04:39 AM

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

#6 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 25 March 2009 - 05:27 AM

thank you for your wish hyper

#7 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2725 posts

Posted 25 March 2009 - 05:33 AM

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

 }

}




#8 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 25 March 2009 - 07:29 AM

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

#9 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2725 posts

Posted 25 March 2009 - 07:45 AM

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.

#10 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 513 posts
  • LocationNowhere whenever

Posted 25 March 2009 - 08:09 AM

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 =)
http://iki.fi/sol - my schtuphh

#11 Mattias Gustavsson

    Senior Member

  • Members
  • PipPipPipPip
  • 413 posts

Posted 25 March 2009 - 08:45 AM

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.
  • www.mattiasgustavsson.com - My blog and current projects
  • www.rivtind.com - My Fantasy world and isometric RPG engine
  • www.pixieuniversity.com - My Software 2D Game Engine

#12 fireside

    Senior Member

  • Members
  • PipPipPipPip
  • 1590 posts

Posted 25 March 2009 - 11:56 AM

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.
Currently using Blender and Unity.

#13 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 25 March 2009 - 08:51 PM

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...

#14 alphadog

    DevMaster Staff

  • Moderators
  • 1716 posts

Posted 25 March 2009 - 08:58 PM

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...Swarm_main_page

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

Have fun!

#15 zebeste

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 25 March 2009 - 09:11 PM

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.../Crowds/EGUK03/

Hope it helps.

#16 delinkx

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 26 March 2009 - 05:45 AM

what u need related to crowd simulation ?
............................
delinkx.com/blog
portfolio.delinkx.com
hostfields.com

#17 rajesh kumar

    Member

  • Members
  • PipPip
  • 30 posts

Posted 26 March 2009 - 07:00 AM

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

#18 delinkx

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 26 March 2009 - 08:12 AM

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.
............................
delinkx.com/blog
portfolio.delinkx.com
hostfields.com

#19 Hyper

    Valued Member

  • Members
  • PipPipPip
  • 195 posts

Posted 26 March 2009 - 11:24 PM

rajesh kumar said:

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--






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users