La liste des projets qui dérivent du code source de Quake II s’allonge. Après la publication du code source du jeu de tir à la première personne en décembre 2001, de nombreuses initiatives (dont Yamagi Quake II, Quake2maX, EGL, Quake II Evolved ou encore KMQuake II) de développeurs tiers ont vu le jour. En 2018, il faudra également compter avec qengine.
Envoyé par Klaus Silveira
qengine est un moteur de jeu rétro conçu pour une multitude de plateformes. Il s'adresse aux développeurs nostalgiques, en manque de moments simples et qui seraient heureux de créer des jeux comme c’était le cas en 1997.
qengine est un fork du moteur Quake II développé par id Software. D’après l’auteur, le moteur est conçu « pour servir de base aux jeux vidéos autonomes. »
Envoyé par Klaus Silvera
À l’inverse d’autres dérivés, qengine n’a pas été mis sur pied pour être compatible avec les mods ou le jeu Quake II dans sa version la plus simple. À la réalité, nous nous sommes débarrassés de plusieurs fonctionnalités afin de réduire la complexité de la base de code et rendre le processus de création de nouveaux jeux [basés sur ce moteur] plus aisé et rapide.
qengine c’est la fusion de tous les modules dans un unique paquetage, mais une séparation claire entre les composants chargés du rendu logiciel et ceux responsables du déroulement d’une partie. Klaus Silveira n’a conservé qu’une vingtaine de briques de la dernière catégorie (dont l’intelligence artificielle de détection des ennemis). La manœuvre participe de l'atteinte des objectifs poursuivis lors de la phase de conception : fournir un moteur propre et d’une maintenance aisée, améliorer la stabilité sur diverses plateformes, ainsi que les performances de la brique de rendu logiciel.
/*
* Copyright (C) 1997-2001 Id Software, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* =======================================================================
*
* The basic AI functions like enemy detection, attacking and so on.
*
* =======================================================================
*/
#include "../server/header/server.h"
extern cvar_t *maxclients;
qboolean enemy_vis;
qboolean enemy_infront; int enemy_range; float enemy_yaw;
qboolean FindTarget(edict_t *self);
qboolean ai_checkattack(edict_t *self);
/*
* Called once each frame to set level.sight_client
* to the player to be checked for in findtarget.
* If all clients are either dead or in notarget,
* sight_client will be null.
* In coop games, sight_client will cycle
* between the clients.
*/ void AI_SetSightClient(void) {
edict_t *ent; int start, check;
if(check == start){
level.sight_client = NULL; return; /* nobody to see */ } } }
/*
* Move the specified distance at current facing.
*/ void ai_move(edict_t *self, float dist) { if(!self){ return; }
M_walkmove(self, self->s.angles[YAW], dist); }
/*
*
* Used for standing around and looking
* for players Distance is for slight
* position adjustments needed by the
* animations
*/ void ai_stand(edict_t *self, float dist) {
vec3_t v;
/*
* Turns towards target and advances
* Use this call with a distance of 0
* to replace ai_face
*/ void ai_charge(edict_t *self, float dist) {
vec3_t v;
/*
* Don't move, but turn towards
* ideal_yaw. Distance is for
* slight position adjustments
* needed by the animations
*/ void ai_turn(edict_t *self, float dist) { if(!self){ return; }
/*
* .enemy
* Will be world if not currently angry at anyone.
*
* .movetarget
* The next path spot to walk toward. If .enemy, ignore .movetarget.
* When an enemy is killed, the monster will try to return to it's path.
*
* .hunt_time
* Set to time + something when the player is in sight, but movement straight
* for him is blocked. This causes the monster to use wall following code for
* movement direction instead of sighting on the player.
*
* .ideal_yaw
* A yaw angle of the intended direction, which will be turned towards at up
* to 45 deg / state. If the enemy is in view and hunt_time is not active,
* this will be the exact line towards the enemy.
*
* .pausetime
* A monster will leave it's stand state and head towards it's .movetarget when
* time > .pausetime.
*/
/*
* returns the range categorization of an entity relative to self
* 0 melee range, will become hostile even if back is turned
* 1 visibility and infront, or visibility and show hostile
* 2 infront and show hostile
* 3 only triggered by damage
*/ int range(edict_t *self, edict_t *other) {
vec3_t v; float len;
if(!self || !other){ return0; }
VectorSubtract(self->s.origin, other->s.origin, v);
len = VectorLength(v);
if(len < MELEE_DISTANCE){ return RANGE_MELEE; }
if(len < 500){ return RANGE_NEAR; }
if(len < 1000){ return RANGE_MID; }
return RANGE_FAR; }
/*
* returns 1 if the entity is visible
* to self, even if not infront
*/
qboolean visible(edict_t *self, edict_t *other) {
vec3_t spot1;
vec3_t spot2;
trace_t trace;
/*
* returns 1 if the entity is in
* front (in sight) of self
*/
qboolean infront(edict_t *self, edict_t *other) {
vec3_t vec; float dot;
vec3_t forward;
/* let other monsters see this monster for a while */ if(self->enemy->client){
level.sight_entity = self;
level.sight_entity_framenum = level.framenum;
level.sight_entity->light_level = 128; }
self->show_hostile = (int) level.time + 1; /* wake up other monsters */
if(!self->movetarget){
self->goalentity = self->movetarget = self->enemy;
HuntTarget(self);
PF_dprintf("%s at %s, combattarget %s not found\n", self->classname, vtos(self->s.origin), self->combattarget); return; }
/* clear out our combattarget, these are a one shot deal */
self->combattarget = NULL;
self->monsterinfo.aiflags |= AI_COMBAT_POINT;
/* clear the targetname, that point is ours! */
self->movetarget->targetname = NULL;
self->monsterinfo.pausetime = 0;
/* run for it */
self->monsterinfo.run(self); }
/*
* Self is currently not attacking anything,
* so try to find a target
*
* Returns TRUE if an enemy was sighted
*
* When a player fires a missile, the point
* of impact becomes a fakeplayer so that
* monsters that see the impact will respond
* as if they had seen the player.
*
* To avoid spending too much time, only
* a single client (or fakeclient) is
* checked each frame. This means multi
* player games will have slightly
* slower noticing monsters.
*/
qboolean FindTarget(edict_t *self) {
edict_t *client;
qboolean heardit; int r;
/* if we're going to a combat point, just proceed */ if(self->monsterinfo.aiflags & AI_COMBAT_POINT){ returnfalse; }
/* if the first spawnflag bit is set, the monster
will only wake up on really seeing the player,
not another monster getting angry or hearing
something */
if(VectorLength(temp) > 1000)/* too far to hear */ { returnfalse; }
/* check area portals - if they are different
and not connected then we can't hear it */ if(client->areanum != self->areanum){ if(!CM_AreasConnected(self->areanum, client->areanum)){ returnfalse; } }
if(self->enemy->health > 0){ /* see if any entities are in the way of the shot */
VectorCopy(self->s.origin, spot1);
spot1[2] += self->viewheight;
VectorCopy(self->enemy->s.origin, spot2);
spot2[2] += self->enemy->viewheight;
LITT-DEV offre des services et solutions à haute valeure ajoutée: Création, refonte, maintenance de sites internet et autres applications (Intranet,Mobile, E-Commerce, web 2.0, portails, SMS/MMS, etc.), à l'hébèrgement et développement d'applications sur mesure...