Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

creating Enemy Bots

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 F-117   Members   

105
Like
0Likes
Like

Posted 23 April 2013 - 08:32 AM

I am a software developer but have recently learning to develop game, I know how to move a char in an applet animate it and even create bots

(basic stuff) but i fail to understand how to bring in bots randomly (like cars appearing in a racing game). All beginners tutorials I look into are about animation or keyboard/mouse interface. What and where should I look into... 

  



#2 matrisking   Members   

282
Like
0Likes
Like

Posted 23 April 2013 - 02:18 PM

It's tough to say without knowing a little bit more about how things are structured, but my first thought would be to do something like this:

 

Set a variable that represents the odds a bot should appear in a given game frame, let's say it should be 0.1%, so:

 

BOT_SPAWN_CHANCE = 1

 

Then, somewhere in your main game loop, just run pick a random number between 0 and 999, let's call it "r", and spawn a bot if r is less than the spawn chance:

 

if ( r < BOT_SPAWN_CHANCE )

  spawn_bot()

 

This is a pretty basic way of doing it but maybe it will work for you. 






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.