simple pac man game
Moderator: InsideQC Admins
18 posts
• Page 1 of 2 • 1, 2
simple pac man game
Hy guys, I'd like to create a simple pac man game in quakec, just to learn the language. I'm learning the movetogoal (dist); function(but in the ai.qc it says that is done in c code...where I can find it?). So, where there's the diffecerence between movetogoal and movetarget function?
I'd like to create a VERY basic ai where a monster searches ALWAYS a player and when he touches the player something happens. That's it.
Thanks folks!
I'd like to create a VERY basic ai where a monster searches ALWAYS a player and when he touches the player something happens. That's it.
Thanks folks!
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
if you want to make a true pac-man clone, you probably want to use walkmove() instead of movetogoal() as you can more easily adhere to a grid. movetogoal() will move in whatever direction it feels like.
both functions are implemented inside sv_move.c in the engine.
both functions are implemented inside sv_move.c in the engine.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
but, there's a way to stick the enemy to a target (player, for example),so that,every moves the player takes, the enemy will follow him?
thanks
thanks
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
toneddu2000 wrote:but, there's a way to stick the enemy to a target (player, for example),so that,every moves the player takes, the enemy will follow him?
thanks
Use Darkplaces' MOVETYPE_FOLLOW.
- DusterdooSmock
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
For what I read on dp_extensions.qc MOVETYPE_FOLLOW should be used for "things" that don't have ai (like decals for bullets and so on) but I found out how to do it. I just duplicated ogre.qc and polish it a bit removing damages and stuff
thanks anyway
thanks anyway
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: simple pac man game
toneddu2000 wrote: simple pac man game in quakec, just to learn the language. ...
http://web.archive.org/web/200904121251 ... _Diffusion might help later on
Think, touch, movetype, solid, traceline ...
-

daemonicky - Posts: 185
- Joined: Wed Apr 13, 2011 1:34 pm
Re: simple pac man game
Thanks daemonicky! It sure is useful(unfortunately images are missing,nevermind)! But, first of all I'd like to know how an entity (a monster for example) will simply follow the player. I'd like to know if the entity would follow a classname(player) or a target, and with which function(movetarget?). This would help me a lot.
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
-

Error - InsideQC Staff
- Posts: 865
- Joined: Fri Nov 05, 2004 5:15 am
- Location: VA, USA
Re: simple pac man game
Error wrote:paqman by mauvebib
funny of you to mention that, i saw that earlier today before you posted it.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
Re: simple pac man game
Thanks a lot Error! I'll take a look at the code!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: simple pac man game
Useless starting another thread for the same problem:
I'm creating a game from scratch and I'm stuck on the A.I
I can't create a simple monster that, once spawned, it searches ALWAYS player (not interested in fighting other monsters) and its only goal is to attack player.
I googled a lot, I read movetogoal function done in C code but the monster stands still (and I think is not the right function because I don't need the monster roams for the level searching the player, it already knows where the player is!), I took a look at ai_charge() function from id (which seems to me the most useful) but the monster is always there, fixed like an idiot, it doesn't move, it doesn't turn...nothing!
Can someone explains to me how start ai fighting from the very basic?
Thanks
I'm creating a game from scratch and I'm stuck on the A.I
I can't create a simple monster that, once spawned, it searches ALWAYS player (not interested in fighting other monsters) and its only goal is to attack player.
I googled a lot, I read movetogoal function done in C code but the monster stands still (and I think is not the right function because I don't need the monster roams for the level searching the player, it already knows where the player is!), I took a look at ai_charge() function from id (which seems to me the most useful) but the monster is always there, fixed like an idiot, it doesn't move, it doesn't turn...nothing!
Can someone explains to me how start ai fighting from the very basic?
Thanks
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: simple pac man game
any hint guys?
EDIT: I found checkclient() function? Is it useful for what I want to do?
EDIT: I found checkclient() function? Is it useful for what I want to do?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: simple pac man game
checkclient() is useful to coop modes mostly: it cycles between clients, so not all monsters will attack the same player.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: simple pac man game
Reference materials:

Ok, that probably wasn't too helpful ...

Ok, that probably wasn't too helpful ...
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: simple pac man game
More helpful ...
self.enemy <- that is what a monster is looking for to kill.
Look at fight.qc
http://www.inside3d.com/browse.php?show=fight.qc
self.enemy <- that is what a monster is looking for to kill.
Look at fight.qc
http://www.inside3d.com/browse.php?show=fight.qc
- Code: Select all
/*
===========
SoldierCheckAttack
The player is in view, so decide to move or launch an attack
Returns FALSE if movement should continue
============
*/
float() SoldierCheckAttack =
{
local vector spot1, spot2;
local entity targ;
local float chance;
targ = self.enemy;
// see if any entities are in the way of the shot
spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
traceline (spot1, spot2, FALSE, self);
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
if (trace_ent != targ)
return FALSE; // don't have a clear shot
// missile attack
if (time < self.attack_finished)
return FALSE;
if (enemy_range == RANGE_FAR)
return FALSE;
if (enemy_range == RANGE_MELEE)
chance = 0.9;
else if (enemy_range == RANGE_NEAR)
chance = 0.4;
else if (enemy_range == RANGE_MID)
chance = 0.05;
else
chance = 0;
if (random () < chance)
{
self.th_missile ();
SUB_AttackFinished (1 + random());
if (random() < 0.3)
self.lefty = !self.lefty;
return TRUE;
}
return FALSE;
};
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
18 posts
• Page 1 of 2 • 1, 2
Return to Artificial Intelligence
Who is online
Users browsing this forum: No registered users and 1 guest