4 Replies - 1486 Views - Last Post: 26 May 2009 - 10:07 PM Rate Topic: -----

#1 gizem3   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-March 09

c code opinions about artificial intelligance of a game

Post icon  Posted 04 May 2009 - 01:05 PM

being a starter programmer in c i wonder about how can we put artificial intelligance games that we wrote i want opinions not algorithms or codes i want how can it be the simplest? thanks...
i can not understand how can it write do we really must thing all the possibilities or there is a simple way to do that?
Is This A Good Question/Topic? 0
  • +

Replies To: c code opinions about artificial intelligance of a game

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6248
  • View blog
  • Posts: 24,015
  • Joined: 23-August 08

Re: c code opinions about artificial intelligance of a game

Posted 04 May 2009 - 02:10 PM

Seems to me simple and Artificial Intelligence just don't belong in the same sentence.

Think we'll move this to Game Programming.
Was This Post Helpful? 0
  • +
  • -

#3 SixOfEleven   User is offline

  • Planeswalker
  • member icon

Reputation: 1055
  • View blog
  • Posts: 6,643
  • Joined: 18-October 08

Re: c code opinions about artificial intelligance of a game

Posted 04 May 2009 - 03:53 PM

View Postgizem3, on 4 May, 2009 - 12:05 PM, said:

being a starter programmer in c i wonder about how can we put artificial intelligance games that we wrote i want opinions not algorithms or codes i want how can it be the simplest? thanks...
i can not understand how can it write do we really must thing all the possibilities or there is a simple way to do that?


Best advice is to start small and work your way up. Tic-Tac-Toe is usually a good starting point. Nim 21 is also a good one. In that game you have 21 matches. You can take 1, 2 or 3 at a time. Whoever takes the last one wins. Path finding is also a good exercise once you have a basic understanding of AI. There is really no easy way to do AI, no simple algorithms. If there were we would probably have androids or computers that can pass the Turing test.

(The Turing test is if a human was to sit in front of a computer the human could not tell if s/he was talking to a computer or a human.)
Was This Post Helpful? 0
  • +
  • -

#4 stayscrisp   User is offline

  • フカユ
  • member icon

Reputation: 1040
  • View blog
  • Posts: 4,325
  • Joined: 14-February 08

Re: c code opinions about artificial intelligance of a game

Posted 04 May 2009 - 05:49 PM

The realities of AI in video games can be quite underwhelming to some people, especially considering how advanced some recent games have made it look.

This is definitely not saying that its easy, not by a long shot. Simulating every possible action for NPC's or Enemies would cripple your games speed faster than you can imagine.

You see as with a lot of other disciplines such as rendering and collision detection you can really fake your way through a lot of this stuff, even wikipedia calls game AI the illusion of intelligence.

I not to long ago wrote a 2D side scrolling beat em up, even this produced some very interesting ways to represent AI. When should an enemy attack? When should they use there special attacks? lots of different situations presented themselves and each one needed to be dealt with smoothly.

some things are very simple

//pseudo code
if(player.x < randomObject.x + 10)
{
	player.aboutTurn();
}

// or

if(player.x < enemy.x)
{
   enemy.x += player.x;
}




For example.

Each of these things needs to be accounted for inside your enemy class, whether in its own function or spread out into its on AI logic for every entity within your game. Most Next gen games use a kind of tree to choose which actions NPC's and Enemies should take.

SixOfEleven is definitely right, start small then when you feel that concepts like this are actually plausible for you to understand then give it a try, a few years is the least AI programming will ask of you.
Was This Post Helpful? 0
  • +
  • -

#5 hollingsworthdan   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 18
  • Joined: 22-May 09

Re: c code opinions about artificial intelligance of a game

Posted 26 May 2009 - 10:07 PM

You want opinions not code? I have both.. :)

The best way, IMHO, is to add code to handle the AI..


Most poeple use one or more forms of a Finite State Machine. One section of code can handle state transition diagrams that are provided after compile time, allowing you to modify the AI on the fly. Of course this means defining what the NPC can (See, Hear, Taste, Feel, etc). Events that can trigger changes in state.

Games of logic like checkers, chess, rummy, etc, generally employ a Min Max tree. Where there is ussually one optimal move.

My personal favorite, is networking real people together, and letting them all think that the other is Artificial if not Inteligent.

Dan -
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1