TODO/General/Timed events

From UFO:AI

Jump to: navigation, search

This article is maybe obsolete and should be removed!

Proposal

My first proposal of server-side timed events in battlescape. These can used for various things that have to last longer than one round such as

  • burning ground / fire
  • timed grenades
    • TODO: What behaviour when a timed grenade lands on a square (is there a inventory-per-square?) and if it may be picked up again (could be a dumb alien or one of our people just passing the grenade on :) )
  • lasting smoke/gas
  • more?

Important

Maybe this is outdated - you can spawn a particle edict (server side) and use trigger_hurt and stuff like that already. --Mattn 19:46, 17 August 2008 (UTC)

#define MAX_TIMED_EVENTS 128;

typedef enum {
	TE_FIRE,	/* This place is burning and causes damage/injury to anything located there each round. Maybe even spread in the future.*/
	TE_WEAPON,	/* A weapon will be 'fired' at the end of the duration.*/
	TE_SMOKE,	/* This place is full of smoke. */
	TE_GAS		/* This place is full of gas, every gas-affected unit located there will be damaged/hurt each round. */
} timedevent_type_t;

/* Server-side handled timed event. */
typedef struct {
	timedevent_type_t type;	/* What type of event. */
	pos3_t location;	/* Where the event is happening. (the 3D square in the map)*/
	int start;		/* What round it was started */
	int duration;		/* How many rounds it'll last. */
	item_t weapon;		/* The weapon that is used for type=TE_WEAPON. */
	int weapon_fd;		/* What firedefinition to uses for the weapon (only in combination with "weapon". */
} timed_event_t;

timed_event_t timed_events [MAX_TIMED_EVENTS];
int numTimedEvents;

Communication about these events need to be synced with the client of course. For example the damage dealt each round by fire/gas has to be applied and the client needs to display the various stuff in the battlescape. So some sort of synced storage may be needed in the clients as well, no?

Are there any problems that can not be covered with the above implementation or other critis?

--Hoehrer 13:13, 14 February 2007 (CET)

I would add a particle index to the timed_event_t to controll fire, gas or smoke

--Mattn 18:20, 14 February 2007 (CET)

Ok, possible (existing) particle effects for the different states could be:

  • Burning squares: burning, fire, crashsite_fire
  • Smoke: smoke2, smokebig
  • Gas: greensmokebig, green_smoke

Dunno how thee look yet, but some of them seem to fit quite well.

--Hoehrer 19:26, 14 February 2007 (CET)

We have breakable things in current code, maybe it would be worth to use this functionality with timed events? For example, when throwing timed grenade near breakable window (so that this window is in spread field of that nade), break window when it explodes?

--Zenerka 11:17, 15 February 2007 (CET)

Breaking things with weapons: Hm, if this isn't yet done for normal grenades (didn't check that yet) then it would be nice to have in general. But not directly related to the timed events I'm planning here because it is handled for every weapon that explodes or can influence breakable things in any way.

Damaging breakable thing because the area is burning on the other hand is a thing that we can consider handling with timed events.

--Hoehrer 11:53, 15 February 2007 (CET)

Personal tools
project-navigation