Jump to content
IGNORED

Any tips & tricks on A.I for 1 vs 1 games?


Captain Spazer

Recommended Posts

A.I is extremely hard I think. Sure, making a predictable A.I that just follows the player around relentlessly like a bloodhound and that guns him down as soon as he is in the line of sight is easy, and boring. But what about an A.I that could do that, and turn tail and run if the situation was not favorable? The closest I've managed is to have a random counter going off once in a while that makes the A.I bob and weave and resume the hunt a moment later.

 

So, any tips would be great =)

 

 

Here is my generic A.I routine. It may be useful to someone =)

rem a.i routine
 j=j+1
rem every second the a.i does something different
 if j=60 then  i=(rand&7) : j=0
 if i=0 && c=0 then player1x=player1x-1 : e=1
 if i=1 && c=0 then player1x=player1x+1 : e=0
 if i=2 && c=0 then player1y=player1y+1
 if i=3 && c=0 then player1y=player1y-1
 if i=4 && c=0 && k=0 then k=1
 if i=5 && c=0 then player1x=player1x-1 : e=1
 if i=6 && c=0 then player1x=player1x+1 : e=0
 if i=7 && c=0 then player1y=player1y+1
 rem shoot right
 if i=4 && k=1 && c=0 && e=0 then missile1x=player1x : missile1y=player1y : k=2
 if i=4 && k=2 && c=0 then missile1x=missile1x+1
 rem shoot left
 if i=4 && k=1 && c=0 && e=1 then missile1x=player1x : missile1y=player1y : k=3
 if i=4 && k=3 && c=0 then missile1x=missile1x-1

 if c=0 && player1y>80 then player1y=80
 if c=0 && player1y<10 then player1y=10

 if missile1x>135 then missile1x=255 : missile1y=255 : k=0

 if player1x>135 then player1x=0
 if player1x<0 then player1x=135


Edited by Captain Spazer
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...