Need help for Pong AI (classic style version)

Non-platform specific questions.

Need help for Pong AI (classic style version)

Postby Game_over » Wed Oct 18, 2006 8:46 pm

Yeah so my basic logic of doing AI for the cpu_paddle is to make it move towards the ball staying only in the y axis. Is this a good idea and if so what script should use or what other way can I go about it. I got everything done but the cpu_paddle so please help.

thanks in advance.
Event-based E-distrobution.
Game_over
 
Posts: 3
Joined: Wed Oct 18, 2006 8:26 pm
Score: 0 Give a positive score

Postby makslane » Wed Oct 18, 2006 10:33 pm

You can try some thing like this, in the 'Draw Actor' event of the cpu_paddle actor:

Code: Select all
x = (ball.x + x*4)/5.0;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

...

Postby Game_over » Thu Oct 19, 2006 6:43 pm

This is what I am going for

here

Image
Event-based E-distrobution.
Game_over
 
Posts: 3
Joined: Wed Oct 18, 2006 8:26 pm
Score: 0 Give a positive score

Postby Game A Gogo » Thu Oct 19, 2006 11:38 pm

ive already done a game like that, now im waiting for beta testing, maybe i could send you my final .ged file so you can take a look
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Sure

Postby Game_over » Sat Oct 28, 2006 3:21 am

That would be great.
Event-based E-distrobution.
Game_over
 
Posts: 3
Joined: Wed Oct 18, 2006 8:26 pm
Score: 0 Give a positive score

DO A TIMER silly

Postby kyensoftware » Sat Oct 28, 2006 4:00 am

Use a timer
cpu_paddle>create actor>create timer><REACTION TIME>>Immediate action
cpu_paddle>timer><TIMER HERE>>script action>
Code: Select all
x = ball.x


It should only muve when the timer is fired.
It works well!! 8)
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby Game A Gogo » Sat Oct 28, 2006 5:11 pm

yeah, but sometimes teh reaction is choppy, because if tha ball moves too fast, well alll you see is the pallete jumping places to places.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

maybe...MOVE TO!!

Postby kyensoftware » Sun Oct 29, 2006 7:07 am

maybe moveto instead of script action?
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby Game A Gogo » Sun Oct 29, 2006 6:38 pm

in draw actor:
Code: Select all
if(ball.x>x)x+=3;
else if(Ball.x<x)x-=3;

that should do it
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest