simple pac man game
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
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!
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
-
- Posts: 185
- Joined: Wed Apr 13, 2011 1:34 pm
Re: simple pac man game
http://web.archive.org/web/200904121251 ... _Diffusion might help later ontoneddu2000 wrote: simple pac man game in quakec, just to learn the language. ...
Think, touch, movetype, solid, traceline ...
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
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.
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.
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
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
-
- Posts: 1395
- 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
-
- Posts: 1395
- 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
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
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)
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 ..
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 ..