log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Accessing old floppy disks (Gen:3)
- November developer 'fireside' chat on saturday night (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: The Playpen: Slightly cold news on page 10! Phlamey breaks the server.
 
  Slightly cold news on page 10! Phlamey breaks the server.
  This is a long thread. Click here to view the threaded list.
 
Phil Mellor Message #71962, posted by monkeyson2 at 00:00, 20/11/2005, in reply to message #71957
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
Why do I always end up reading your posts when coming back from the pub DRUNK? :P

Your suggestions sound ALL RIGHT :)
  ^[ Log in to reply ]
 
Phil Mellor Message #71963, posted by monkeyson2 at 00:03, 20/11/2005, in reply to message #71962
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
<random forum bug>The 'view post' didn't work correctly after I posted to this thread. My post started off page 3, but I was taken back to page 2.

Anyway, don't let me take this thread off on a tandem.</random forum bug>

Gaming development discussion, carry on now:
  ^[ Log in to reply ]
 
Jeffrey Lee Message #71965, posted by Phlamethrower at 01:51, 20/11/2005, in reply to message #71963
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
<random forum bug>The 'view post' didn't work correctly after I posted to this thread. My post started off page 3, but I was taken back to page 2.

Anyway, don't let me take this thread off on a tandem.</random forum bug>
Go fix it then :)

Gaming development discussion, carry on now:
Hmm, writing this pseudocode for the WIMP interface is a bit harder than I thought, without having some existing code open for me to base it around.

Suffice to say, the controls configuration window will work in a similar way to the one in Dark Matter, along with the graphics configuration. I think Dark Matter asks RISC OS for a list of compatible screen modes - if not then I'll have to write one for this. I might also just lump all the config options together into one big window.

I'll skip the rest of the WIMP stuff then, and go into the game engine. The engine can be entered from the WIMP via 3 functions: loadgame, newgame, and playgame. When the functions return, the computer will switch back to the desktop and the game will be paused (if the game state was successfully initialised).


loadgame(file)
{
if (gamenotsaved)
if (!confirm("Current game not saved - proceed with loading saved game?"))
return;
open(file);
if (!isasavefile(file)) {
close(file);
error("Not a save file!");
return;
}
reset_engine(); // Get rid of old game
graphics_start(); // Switch to configured fullscreen mode
// Savefiles will consist of:
// Map data for the current map (Probably a full copy of the map)
// Ped list
// Car list
// Object list (Other junk like traffic cones, bullets, collectibles, etc.)
// Mission script state (Variable values + event/trigger list.)
// Mission script name
// + probably some other stuff
newgame = false; // Set newgame flag to false
load_mission(GAMECONFIG); // Load game config script, run .onload
// Load data
load_map(file);
load_peds(file);
load_cars(file);
load_objects(file);
// Load mission state
load_mission_vars(file);
load_mission_triggers(file);
// Load mission script
load_mission(readstring(file));
close(file);
playgame();
}

newgame()
{
if (gamenotsaved)
if (!confirm("Current game not saved - proceed with starting a new game?"))
return;
reset_engine();
graphics_start();
newgame = true;
load_script(GAMECONFIG); // Load config and run .onload
playgame();
}

playgame()
{
graphics_start();
startsounds();
rungame = true;
t = clock();
do {
frametime = clock()-t;
t += frametime;
if (paused)
frametime = 0;
else {
dopeds(); // Ped AI & physics
docars(); // Car physics
doobjects(); // Object physics
checktriggers(); // Mission triggers
dogamestuff(); // Other stuff - traffic lights, traffic spawning, animated textures, etc.
gametime += frametime;
}
drawscreen();
if (paused)
dopausemenu(); // Draw pause menu & process keys for it
wait(); // Wait for VSync
swapbanks(); // Swap screen banks
} while (rungame);
return_to_wimp(); // Return to wimp mode, pause any playing sounds, etc.
}
  ^[ Log in to reply ]
 
Jeffrey Lee Message #71992, posted by Phlamethrower at 20:45, 21/11/2005, in reply to message #71965
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Assets and asset management

Here's something that we have yet to go into sufficient detail on. There are numerous assets used by the game:
  • Game config file
  • User config file
  • WIMP sprites
  • WIMP templates
  • Ped definitions
  • Ped sprites
  • Car definitions
  • Car sprites
  • Map tile sprites
  • Object sprites
  • Mission scripts
  • Fonts
  • UI sprites
  • Save game files
  • Sound samples
  • Music
We need to work out where and how these assets will be stored, and when and how the game will request for them to be loaded from disc. Assuming we're going with the name Death Dawn:
  • Game config file
    This file will give generic information about the game. By replacing this file or instructing the game to use a different copy, you will be able to run different user modifications/total conversions. This file will probably be a simple text file; it may even be a mission script. Exact contents of the file are unknown atm, but as a bare minimum I'd expect it to contain the names of the mission scripts for each level. It could also contain the pathnames of the directories to search when loading peds, cars, etc.
    Default location would probably be <DeathDawn$Dir>.gamecfg
  • User config file
    This file simply contains configuration options for the game - keyboard settings, video mode, etc.
    File is likely hardcoded to be at <DeathDawn$Dir>.config
  • WIMP sprites
    Any sprites used by the WIMP interface. This file might not even be needed.
    Location could be specified via the game config file, or just hardcoded to somewhere like <DeathDawn$Dir>.Sprites
  • WIMP templates
    WIMP templates file. For consistency and simplicity of the UI, only one copy of the file will be supported, at <DeathDawn$Dir>.Templates
  • Ped definitions
    Uses this format. The directory containing ped definitions will be given in the game config file; e.g. <DeathDawn$Dir>.peds
  • Ped sprites
    Just in case two ped types share the same sprite file, each ped definition file will contain the filename of the ped sprite file. This name will probably be appended to, or used in conjunction with, a base path specified in the game config file. Default value will probably be <DeathDawn$Dir>.pedsprs
  • Car definitions
    No full definition of this file format yet, but it will be a text file containing basic info about the vehicles (vehicle type, gear ratios, etc), as well as the name of the sprite file. The directory containing the car definitions will be given in the game config file, e.g. <DeathDawn$Dir>.cars
  • Car sprites
    Uses this format. Similar thing to ped sprites - sprite file name will be given in car definition file, will be used with pathname given in game config file. Default value something like <DeathDawn$Dir>.carsprs
  • Map tile sprites
    This will be a directory full of sprite files containing (multiple) 64x64 16bpp masked/unmasked images. Sprite naming system sill needs to be specified, to allow for animated sprites, integration with the map generator, etc. But for now basic details are that only the requested sprites/files will be loaded into memory; thus the game config file will contain the path of the directory containing the sprites (e.g. <DeathDawn$Dir>.tiles), and some further config system will specify what particular files need loading for a level.
  • Object sprites
    Sprites for traffic cones/bullets/explosions/skid marks/etc. I'm not sure if there should be one sprite file per object type, or all sprites lumped together in one file. Or even multiple sprite files containing sprites for multiple objects which will then be loaded and merged.
    Either way, the location(s) of the files will be given in the game config file.
    Unless I go for some magic generic physics engine, object types & names will be hardcoded into the game. Which only makes me want to do a generic system even more :)
  • Mission scripts
    Uses this format. Game config file will contain location of the directory containing the mission scripts, and/or the names of each script.
  • Fonts
    Just a set of sprite files containing sprites for each letter, the same as every other GnarlPlot font file. Game config file will probably contain the name of the directory containing the fonts. Some font file names within that directory will probably be hardcoded into the game; it's possible that other ones could be specified through mission scripts.
  • UI sprites
    Any other sprites used by the user interface, stored in one file. This file will be named in the game config file. Contents will include menu graphics, minimap icons, etc.
  • Save game files
    Brief file format info is given here. Storage location will be fully user specified, as the game uses standard saveas boxes.
  • Sound samples
    The game config file will probably contain the name of the directory to search for sound samples. Car/ped/mission files will then contain the names of the samples to use within that dir.
  • Music
    Probably CD music or integration with AMPlayer or something. Don't ask me!
From the above there seems to be a recurring pattern of uncertainty over how to specify how and where files are stored. To solve that I suggest the following:

* The game config file is a (special) mission script
* Commands are added such as 'PEDDEFPATH', 'CARDEFPATH', 'MISSIONPATH', etc. to add a path to the list of paths to search for specific files. Then something like 'LOADPED "foo"' will search the list of ped paths for ped type "foo", and load that definition for use by the game.
* Individual mission scripts are then able to load exactly the right files they need.

...which is actually quite similar to the system GTA 3/VC/SA uses. A script-type config file specifies the directories where data is stored, and triggers the loading of the data. Seperate script-type files for each map section then dictate what files are needed for that area of the map, etc.

The game config file could also contain an algorithm to generate the megamap, and dictate to the main map generator exactly what each individual map should look like. In particular when mission scripts are loaded, each mission script could have certain requirements laid out, e.g. the map needs at least 3 hospitals, 5 ganglands, etc. Scripts could even dictate the exact shape of some buildings/areas.

Basically, more power in the scripting system will lead to more flexibility in game design and modding, but potentially more complicated engine code (support for on-demand loading of files) and in this case, slow map generation if too much of the algorithm is in the mission script itself.

Hmm.

[Edited by Phlamethrower at 20:48, 21/11/2005]
  ^[ Log in to reply ]
 
Jeffrey Lee Message #71993, posted by Phlamethrower at 20:58, 21/11/2005, in reply to message #71992
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
but potentially more complicated engine code (support for on-demand loading of files)
For this, I think that all I need is some set/hash ADT code. Which I was planning on writing anyway. (Especially since it'll be useful for other things like tracking the variables in mission scripts. And probably some other coding projects, and lots of pesky data handling tasks which I keep coming across)
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72012, posted by Phlamethrower at 16:35, 22/11/2005, in reply to message #71993
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
*wonders how many people still read this*

Anyway, here's my vision of how all the asset management stuff will be done. The game config script will go something like this:


.onload
; Set paths
PEDDEFPATH "<DeathDawn$Dir>.peds"
PEDSPRPATH "<DeathDawn$Dir>.pedsprs"
CARPEDPATH "<DeathDawn$Dir>.cars"
CARSPRPATH "<DeathDawn$Dir>.carsprs"
TILEPATH "<DeathDawn$Dir>.tiles"
OBJPATH "<DeathDawn$Dir>.objs"
MISSIONPATH "<DeathDawn$Dir>.missions"
FONTPATH "<DeathDawn$Dir>.fonts"
UIPATH "<DeathDawn$Dir>.ui"
SOUNDPATH "<DeathDawn$dir>.sound"
; Load data
LOADFONTS "*" ; Load all font files
LOADUI "*" ; Load all UI sprites
LOADSOUND "menu.*" ; Load all menu sounds
LOADING ; Display loading screen
IF NEWGAME THEN .newgame
; .. else script is getting loaded with a savegame game
STOP

.newgame
imegamap[] = 16 ; Create megamap as an array of ints giving the random number seeds for each main map
; Map is actually 4x4, but is represented as a 16 entry linear array
smegamap[] = 16 ; String array naming the different mission scripts for each map
i = 0
.loop1
imegamap[i] = RANDOM
smegamap[i] = "desert"
i = i + 1;
IF i < 16 THEN .loop1
; Set start coords
imegamapx = 0
imegamapy = 0
; Initialise list of mission scripts
smegamap[0] = "prison"
smegamap[1] = "prisontown"
smegamap[10] = "town1"
smegamap[12] = "town2"
; Load the mission
i = imegamapx + imegamapy*4
MISSION smegamap[i] ; Will stop the current script and load the new one, preserving all variables


Then in the prison mission script:


.onload
LOADTILES "generic.*" ; Load all generic map tiles
LOADTILES "prison.*" ; Load all prison map tiles
LOADCARS "generic.*" ; Generic cars
LOADCARS "prison.*" ; Prison cars
LOADPEDS "generic.*" ; Generic peds
LOADPEDS "prison.*" ; Prison peds
LOADSOUND "generic.*"
LOADSOUND "prison.*"
LOADOBJS "generic.*"
LOADOBJS "prison.*"
IF NOMAP THEN .makemap ; If there is no map, build one
; ..otherwise this is the .onload function getting called when the save game is reloaded
STOP ; Stop the script

.makemap
i = imegamapx + imegamapy*4
BUILDMAP PRISON imegamap[i] ; Build prison style map using imegamap[i] as the random seed
; Spawn the player and initial mission objects etc.
STOP


Once the level is complete, the mission script can then run the .nextmap function, which will look something like this:


.nextmap
LOADING ; Switch to loading screen
; Insert code here to kill everything that you don't want transporting to the new map
KILLMAP ; Kill current map and all unused assets (ped, car definitions, tile sprites, etc)
i = imegamapx + imegamapy*4
MISSION smegamap[i] ; Load new script
; The new script will then relocate the surviving cars/peds so that they are at suitable locations


So how this will all fit in with the engine is that:

* When !DeathDawn is run, the WIMP sprites & templates will be loaded
* If the user starts a new game:
- the game config script will be loaded, and .onload automatically run
- this will cause the engine to load the fonts & graphics used for the loading screen
- the script will then display the loading screen, which will presumably use some form of voodoo to work out how much progress has been made
- it will use NEWGAME to detect that it's a new game, and go on to generate the megamap and run the first mission script
- the mission script will then load all the cars, peds, etc. used in that map
- it will detect that there is no map, and generate the map and initialise the first mission(s) for that level
- the script will then stop, and the newgame() C function will start the main game loop
* If however the user loads a saved game:
- the game config script will be loaded
- this will load the fonts & graphics for the loading screen, and cause it to be displayed
- NEWGAME will be false, and thus execution will stop
- then the variables and map data will be loaded from the save file. Loading of the ped & car variables, as well as the map data, will trigger loading of the appropriate ped/car/tile definitions from disc.
- the mission script indicated in the save file will be loaded, and .onload run.
- the script will load any other cars, peds, etc. used in that map
- it will detect that the map data does exist, and stop the script
- the loadgame() C function will then start the main game loop

[Edited by Phlamethrower at 17:20, 22/11/2005]
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72044, posted by Phlamethrower at 16:59, 23/11/2005, in reply to message #72012
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Game storyline & mission progression

Rather than having one storyline that will carry you through the entire game (as in GTA 3/VC/SA), I'm going to go with the more freeform GTA 2 system.

In GTA 2 there are 3 major gangs in each level; you have 3 respect meters, showing how much the gangs love/hate you. To proceed to the next level, all you have to do (IIRC) is raise a certain amount of money. This will then trigger a mission where all 3 gangs try and hunt you down and you must kill their leaders. All the other missions are optional, giving you (almost) complete freedom in how you want to complete the game.

If you do decide to do missions for the different gangs, then you'll find that only some are available at any particular time, depending on your respect level with that gang. Killing members of one gang will lower their respect for you, but increase another gang's respect for you. Likewise completing a mission for a gang will increase their respect for you and lower another gang's respect for you.

I'm suggesting that we (I) use this basic system for this game, as it will avoid us having to write any fancy-pants storyline, and gives the player more freedom.

In each map there will be several gangs, and they will have respect meters. If they respect you they will offer you work, if they hate you they will try and kill you. There may be some hardcoded missions or tasks that you must complete, or various triggers which will allow you to progress to the next map.

The prison map

I think this is a good idea for this map.

As previously stated, it will be a city that has been converted into a prison. It will be surrounded by a tall wall to prevent prisoners from escaping, and will have some form of water/moat outside the wall. The only entrance to the prison will be by air or a single train track. The train track will lead to prisontown, the 2nd level of the game, where all the prison guards live and the supplies are stored.

The game starts with you getting transported into the prison by the train. The train track is elevated above the floor; to deliver prisoners it simply enters the city via a gate, stops over a carefully placed pool of water, then the carriage tips up and the prisoners fall out :P

After the prisoners are dumped off, the rival gangs will arrive and try to "recruit" as many new prisoners as possible, as well as kill any members of the opposing gangs that get in their way. So you can either run from them or follow them back to a recruitment office and get your first mission.

Packages of food are occasionally delivered to the prison by a big cannon located in prisontown. The prisoners and gang members must race to where the food package has landed if they want to eat prison food; those lucky enough to have real farm land at their disposal would probably stay at home :P A couple of missions could be based around the collecting of the food packages.

At some point while you're in prison, the cataclysmic disaster will strike the world. You will at first be unaware of it. It will only begin to affect prison life at a predetermined stage of the game, e.g. you reach a certain amount of cash or have completed a certain number of missions. At that point something will happen, e.g.:

* A prisoner infected with the zombie virus will be delivered and start infecting people
* The food cannon will start shooting blanks, and people notice that there are no guards on the walls
* A plane/helicopter crash-lands in the prison
* The prisoner transport train crashes
* etc.

Then a series of missions will be unlocked which will lead you to defend your gang/escape the prison. Escape will most likely be via the train tracks.

Animated map tile sprites

For these, I think the simplest method would be for tile sprites to be named <tile>#<t> where <tile> is the tile name/number, and #<t> gives the time at which the animation should switch to that sprite. E.g.

sign#10 (Sign unlit)
sign#12 (Sign lit)

would result in the unlit sprite being used on times 10 and 11, and the lit sign on times 0-9 and 12. These times will probably be measured in 25ths of a second, to keep the sprite names short.

Object types

There is some fuzzyness as to exactly what the 'objects' are, and how they will be defined. The different object types I can think of are:

1. Bullet, fire plume, water plume, rocket, grenade
2. Static sprite/animation (bullet impact, blood splatters, scorch marks, metal sparks, skid marks, explosions, other stuff)
3. Traffic cones, roadblock barriers, and other pushable objects which change appearance when hit (i.e. fall over)
4. Bollards, rocks and other immovable obstacles
5. Destructible objects (Hereby referred to as 'meat', for no particular reason)

You could then store the different objects in one data structure:


typedef struct {
int type; // Object type
vec16 p; // Location
vec16 v; // Velocity
f1616 rot; // Sprite rotation
int animid; // Sprite/animation ID (see below)
void *d; // Type-specific data
} object;

#define OBJECT_NONE 0 // No object
#define OBJECT_BULLET 1
#define OBJECT_ANIM 2
#define OBJECT_CONE 3
#define OBJECT_BOLLARD 4
#define OBJECT_MEAT 5

typedef struct {
ped *powner; // Owner information
car *cowner;
int launchtime; // Time it was launched. Can be used to determine time of removal/detonation/etc
} bullet_data;

typedef struct {
int time; // Base time to determine the animation frame from
int death; // Game time to remove the object at
} anim_data;

typedef struct {
int frame; // Current frame number. Frame will cycle/choose at random when the object is hit
f1616 radius; // Radius of object in game units
f1616 mass; // Mass of object
} cone_data;

typedef struct {
int time; // Base time to determine animation frame from
f1616 radius; // Radius of object
} bollard_data;

typedef struct {
f1616 health; // Amount of health
f1616 maxhealth; // Maximum health - used to determine frame number
f1616 radius; // Radius
} meat_data;


animid would index the 'animations' variable:


typedef struct {
int time; // Time to display frame at
gp_spr *spr; // Sprite to display
} frame;

typedef struct {
int nframes; // Num frames
frame *frames; // Frame list
char *sprname; // Name of original sprite
} anim;

anim animations[MAX_ANIM];


Some animation ID's will be hardcoded to use specific sprite names; e.g:


#define animid sprite base name
ANIM_BULLET 0 bullet
ANIM_ROCKET 1 rocket
ANIM_FLAME 2 flame
ANIM_WATERJET 3 waterjet
ANIM_SKIDMARK 4 skidmark
ANIM_SPARKS 5 sparks


The other animation ID's won't be used internally by the game, and so will be assigned on a first-come-first-served basis to the different cone/bollard/etc. sprites as they are loaded from disc.

Specific objects can then be spawned by mission code, e.g.

BOLLARD "bollard" vpos 0.02

would spawn an immovable bollard at location vpos with radius 0.02, using sprite "bollard".

BULLET ROCKET vpos 30 pped

would spawn a rocket 'bullet' at location vpos, heading 30 degrees, with owner pped.

EXPLOSION vpos 400 pped

would cause an explosion at vpos, dealing 400 damage, with pped attributed as the owner. This command will cause 3 things to happen:

1. Damage to everything near vpos
2. Set some objects near vpos on fire
3. Create an explosion animation object at vpos, with the appropriate animid and death time.

Object sprites stored on disc will use the <name>[#<t>][_<x>,<y>] naming method, where <name> is the base name, [#<t>] is the optional animation frame/time, and [_<x>,<y>] is the optional origin coordinate (if omitted, the center of the sprite will be used).

Sprite names are too short!

Because of this, sprites with no name part will be supported. If you had OBJPATH "<DeathDawn$Dir>.objs", then you could create a sprite file "<DeathDawn$Dir>.objs.generic.foo", and create sprites inside that file "#0_5,5", "#5_27,36", etc.

This sprite animation can then be referred to as "foo" or "generic.foo" in the code.

Sprites with names (e.g. "explo#3" in file "<DeathDawn$Dir>.objs.generic.gen") can also be referred to as "explo", "gen.explo", or "generic.explo"

However trying to ask for "#0", "#0_5,5", "foo#0", "foo#0_5,5" etc. will result in an error, as neither the animation frame or center coordinate are considered to be part of the sprite name when the sprites are loaded.

[Edited by Phlamethrower at 16:50, 24/11/2005]
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72071, posted by Phlamethrower at 14:19, 24/11/2005, in reply to message #72044
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Variable types in mission scripts
  • i - 32 bit signed int
  • f - 16.16 bit fixed point
  • v - 16.16 bit fixed point 3D vector
  • s - string
  • p - ped ID
  • c - car ID
  • o - object ID
  • e - generic ID - Can be a ped, car, or object ID
  • g - gang bitflags
  • . - code label. Read-only!
Other, more complex, variable types are likely to be needed as well. However they require more planning before being introduced. E.g.:
  • h - HUD element. Can be given the value of a vector, ped, car or object, and will cause a pointer to that location to be drawn on the HUD
  • t - event/trigger combo. Will allow the mission script to give names to the events it creates, so that it can disable them later on.
  • b - Map block. Is this a block coordinate, or a block type? Map code editing commands must be able to operate on either a specific block, or every instance of a block type.
  • r - Map region. A simple 3D box. Each region can be given different properties, e.g. the name displayed to the user, the type of gang peds to spawn, the different vehicle classes that will spawn, etc.
Arrays

As shown in a previous example, mission scripts will have support for arrays. [] brackets will be used to denote an array. Arrays initially have capacity for storing 0 entries.

"ifoo[] = 5" will shrink/enlarge array ifoo to hold 5 entries (from 0 to 4 inclusive); existing values will be preserved where possible, new entries will be set to null values.

"isize = ifoo[]" will set isize to the current size of the array.

"ifoo[i]" will provide access to array item i.

Jumping to arbitrary parts of code

...will not be directly supported, in order to make sure mission scripts can be changed without invalidating save games.

However I'm thinking of two ways around this problem: Either code labels which are arrays, or the ability to use a string containing the name of the label to jump to.

In fact, I'll just support both.

[Edited by Phlamethrower at 18:25, 24/11/2005]
  ^[ Log in to reply ]
 
Richard Goodwin Message #72072, posted by rich at 14:27, 24/11/2005, in reply to message #72044
Rich
Dictator for life
Posts: 6828
EXPLOSION vpos 400 pped

would cause an explosion at vpos, dealing 400 damage, with pped attributed as the owner. This command will cause 3 things to happen:

1. Damage to everything near vpos
2. Set some objects near vpos on fire
3. Create an explosion animation object at vpos, with the appropriate animid and death time.
How are you going to deal with radius/drop off of damage? Or just simplifying it by having 400 across the whole (square?) area of the explosion anim, and nothing in adjacent areas?

Having one of those sets of circles you see when nuclear weapons are discussed on TV - instant death in the middle circle, heavy firey damage in the next circle, lesser shockwave damage in the next circle - would be quite cool.

Do you have a "people blown off their feet" anim? I suppose flipped cars are already catered for?
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72074, posted by Phlamethrower at 14:49, 24/11/2005, in reply to message #72072
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
How are you going to deal with radius/drop off of damage? Or just simplifying it by having 400 across the whole (square?) area of the explosion anim, and nothing in adjacent areas?
Yes, it will be some form of radial dropoff. That example was just meant as a quick example, not an indication of how it will work ingame :)

The model will probably be similar to the one used in GTA 2 - Instant death if you're close, get set on fire if you're nearby, or get blown away and hurt if you're further out. (In GTA 1 it's pretty much the same, but you don't have a health meter so it's either instant death, fire, or nothing at all)

Do you have a "people blown off their feet" anim?
Not yet - but I haven't drawn any sprites or made any final lists of animations yet. So basically, if a "people blown off their feet" anim is needed (which it probably will be), I'll make sure one is there.

I suppose flipped cars are already catered for?
Yes - cars can't flip :)

I'll upload a short gameplay video of GTA 1, so you can see what things used to be like. I was going to upload a fairly long video, but after playing around for a while it seems that it's impossible to encode a 320x240 video at anything less than 400kbps. Either that or the motion detection isn't working properly due to poor framerate.
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72078, posted by Phlamethrower at 15:36, 24/11/2005, in reply to message #72074
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
http://www.phlamethrower.co.uk/misc2/gta1.mpg (14MB)
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72079, posted by Phlamethrower at 17:06, 24/11/2005, in reply to message #72078
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
*tries to resist the urge to start coding*

Ped AI activities

These are all the different AI modes peds can be placed in.
  • WANDER - Just wander around the streets
  • GO - Follow a particular ped/car/object, or head towards a location/region.
  • PROTECT - Protect a list of peds/cars/objects from attack or theft
  • GO_PROTECT - Follow and protect a list of peds/cars/objects from attack or theft
  • KILL - Kill a list of peds/cars/objects
  • JACK - Steal a car. If a ped is given as a target object, it will steal the car that ped is in. If a car is given as a target, it will steal that car. If no target is given, it will steal any car.
  • EXIT - Get out of current car
  • RIDE - Get into a specific car (or into the same car as a specific ped), travelling as a passenger
I think only two different AI goal related events are required:
  • COMPLETE - The ped has completed its goal (Reached target, killed person, etc.)
  • FAIL - The ped has failed its goal (Been killed, allowed target to die, etc.)
Car AI modes

Cars have no AI without a driver. Thus, to set the AI of a car, you only need to set the AI of the ped that is driving it. E.g. a car with it's driver set to kill someone, will try to run that person over or use car mounted weapons to kill him.

Extra flags will also be available, controlling what modes of transport the ped is allowed to make use of:
  • Cars
  • Bikes
  • Boats
  • Aircraft
  • Police/Military vehicles
  • Only vehicles which the ped owns
A ped "owns" a vehicle if he was the last driver of that vehicle. Ownership can also be set directly via the mission scripts.

Other ped/car events
  • Ped pain - for when a ped gets hurt
  • Ped heal - for when a medic heals a ped
  • Ped death - for when a ped dies
  • Ped touch - for when an object bumps into a ped
  • Car pain - for when a car gets hurt
  • Car heal - for when a car gets repaired
  • Car death - for when a car explodes
  • Car touch - for when an object bumps into a car (including crashing into walls)
Some events can have extra parameters specified, e.g. the amount of health a ped must be reduced to before the ped pain event is triggered.

Any other ped/car related events people can think of?
  ^[ Log in to reply ]
 
Simon Challands Message #72080, posted by SimonC at 17:50, 24/11/2005, in reply to message #72079
Elite
Right on, Commander!

Posts: 398
*tries to resist the urge to start coding*
Why? Just leap straight in and make it up as you go along. I inevitably find that I lose interest in something before it degenerates into an impossible to work with mess :-)
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72081, posted by Phlamethrower at 17:53, 24/11/2005, in reply to message #72079
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Ped AI control
  • AUTO - The ped will autonomously react to events around it, changing AI goals by itself
  • MANUAL - The ped is part of a mission script, and will only change AI goals when told to by the script.
A brief rundown of other stuff which needs solving, in an attempt to stop me from jumping into the coding immediately
  • WIMP interface - Can be covered at coding time
  • Support code - hash/set ADT - Could do with writing that at some point.
  • Map generator - Can be covered at coding time
  • Ped, car, object data structures - Can be covered at coding time
  • Mission script tokenised form, variable management - Can be covered at coding time
  • Sound system - Use SharedSound!
  • Spatial sorts - There will be lots of objects, we need to decide on a suitable spatial sort algorithm to keep things nice and spiffy
I think that's pretty much it. A fair amount of the tricky coding tasks have been moved into the mission script system, so there's little left to design now.

So, onwards we go...

Spatial sorts

I think a simple system would be best. Split the map up along every 4th row and column of the block stack array. In each of these regions keep a list of the peds, cars, and objects that have their origin in that region. Collision detection routines will then check against that region and the 8 neighbouring regions.

Non-collidable objects (skidmarks, explosion graphics, etc.) can be stored on the tail end of the object list for that 4x4 region, while collidable objects can be stored on the head end of the list. This will allow all the non-collidable objects to be skipped by the collision detection algorithms.

There will probably only be 2 or 3 levels of road in any 4x4 region, so sorting peds/cars/objects by their Z coordinate would be pointless.


Hmm, I seem to have run out of stuff that needs designing.

Help?! :o
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72083, posted by Phlamethrower at 17:55, 24/11/2005, in reply to message #72080
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
I inevitably find that I lose interest in something before it degenerates into an impossible to work with mess :-)
That's what I'm trying to avoid doing :P

If I don't design as much as possible as properly as possible, I'll either lose interest before getting stuck or get stuck then lose interest.
  ^[ Log in to reply ]
 
Richard Goodwin Message #72084, posted by rich at 17:57, 24/11/2005, in reply to message #72079
Rich
Dictator for life
Posts: 6828
Any other ped/car related events people can think of?
PED_STOP_FOR_NICE_CHAT
PED_TALK_ABOUT_WEATHER
PED_SIT_AT_PAVEMENT_CAFE_SO_CAR_CAN_CRASH_THROUGH_SCENE
PED_BUY_HOTDOG_FROM_VENDOR
PED_STACK_BOXES
PED_CARRY_GLASS_ACROSS_STREET
PED_RUN_FRUIT_STALL
PED_RUN_AWAY_SCREAMING

I think I've seen to many bad '70s cop shows...

However, some of these are of course used in later GTA games.
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72085, posted by Phlamethrower at 17:59, 24/11/2005, in reply to message #72084
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
PED_STOP_FOR_NICE_CHAT
PED_GO, with a trigger to activate some mission code to display some text when it reaches it's destination

PED_TALK_ABOUT_WEATHER
Similar to above :)

PED_SIT_AT_PAVEMENT_CAFE_SO_CAR_CAN_CRASH_THROUGH_SCENE
And that, although obviously it would activate the car moving rather than a message :)

Hey, stop editing your post while I'm replying :P

[Edited by Rich at 17:59, 24/11/2005 - it's OK, I'm done now!]
  ^[ Log in to reply ]
 
Richard Goodwin Message #72086, posted by rich at 18:03, 24/11/2005, in reply to message #72085
Rich
Dictator for life
Posts: 6828
How about PED_SILLY_BLOODY_JOGGER and PED_WALKING_ICKLE_FOO_FOO_DOGGY? Although running would sort out the first, and custom sprites handle a lot of stuff for both.

Hey, I'm just thinking how to make this a living, breathing cityscape. Although it might not work so well with the prison setting... PED_THROW_BRICK_THROUGH_SHOP_WINDOW?
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Richard Goodwin Message #72087, posted by rich at 18:05, 24/11/2005, in reply to message #72085
Rich
Dictator for life
Posts: 6828
PED_SIT_AT_PAVEMENT_CAFE_SO_CAR_CAN_CRASH_THROUGH_SCENE
And that, although obviously it would activate the car moving rather than a message :)
I was thinking more about telling the ped to sit; the car crashing through the scene would be me, at which point they'd be running screaming.

Perhaps an extension of RIDE - although that'd mean you'd need some kind of "vehicle" that appears to be a chair and has a top speed of 0mph.
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72088, posted by Phlamethrower at 18:21, 24/11/2005, in reply to message #72086
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
How about PED_SILLY_BLOODY_JOGGER
Hmm, I guess an extra control will be needed to state if a ped should walk or run as its default activity.

Also we need an EVADE mode, so that the ped tries to get away from something.

One thing that does need thinking about though, is the gang system. Each ped will belong to a gang, the relationships between the gangs will dictate how they react to each other, some AI modes could be set to target specific gangs, etc.

I guess the game config script would contain definitions of the form:

GANG 1 NORMAL
GANG 2 POLICE
GANG 3 CRIMINAL
GANG 4 PRISON1
GANG 5 PRISON2
GANG 6 PRISON3
GANG 7 CORP1
GANG 8 CORP2
..etc.

Each colour combination listed in the ped definition files would then have a gang associated with it. If a max of 32 gangs (or 64) is used, then the gangs and gang membership can be represented as a set of bitflags.

You can then use the gang information to specify what ped types should spawn in a map region, the target for an AI goal, etc. GANGAI POLICE KILL CRIMINAL would cause the police to kill criminals, GANGAI CRIMINAL JACK NORMAL would cause criminals to carjack normal people, etc.
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72089, posted by Phlamethrower at 18:23, 24/11/2005, in reply to message #72087
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
I was thinking more about telling the ped to sit; the car crashing through the scene would be me, at which point they'd be running screaming.

Perhaps an extension of RIDE - although that'd mean you'd need some kind of "vehicle" that appears to be a chair and has a top speed of 0mph.
Adding new activities should be fairly easy - I just wanted to make sure I had the majority of them listed so I can work out what the system needs to cope with.
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72090, posted by Phlamethrower at 19:14, 24/11/2005, in reply to message #72089
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Hash code has been written :)

(Note - It just uses an unsorted list, so will be very slow :P)
  ^[ Log in to reply ]
 
James Shaw Message #72091, posted by Hertzsprung at 20:13, 24/11/2005, in reply to message #72090
Hertzsprung
Ghost-like

Posts: 1746
:uploadyouruml:
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72094, posted by Phlamethrower at 20:33, 24/11/2005, in reply to message #72091
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
:uploadyouruml:
UML? Fuck off :P
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72102, posted by Phlamethrower at 00:32, 25/11/2005, in reply to message #72094
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
IT EXISTS.

Well, the WIMP interface does.
  • Iconbar icon
  • Iconbar menu
  • Fancy key reconfig window - will detect keys that have been used for multiple actions, except actions which can't be performed at the same time anyway (e.g. using the same key for jump and handbrake will work)
  • Fancy graphics config window, including fancy menu listing enumerated screen modes (Including checks to make sure the modes are 16bpp and there is enough video memory for 2 screen banks). Even lets you choose the refresh rate!
  • User config file loading/saving
  • Saveas box for save game files
Now to, erm, write the game part :P
  ^[ Log in to reply ]
 
Adrian Lees Message #72103, posted by adrianl at 01:22, 25/11/2005, in reply to message #72102
Member
Posts: 1637
Isn't that a bit like designing the iPod case before inventing the HD and audio compression?

[Edited by adrianl at 01:24, 25/11/2005]
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72104, posted by Phlamethrower at 01:38, 25/11/2005, in reply to message #72103
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Isn't that a bit like designing the iPod case before inventing the HD and audio compression?
Well, the headphone socket and buttons on the case work!
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72105, posted by Phlamethrower at 02:49, 25/11/2005, in reply to message #72104
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Mission script tokens

While tokenising the mission script, the tokeniser may come across one or more of the following:
  • Reserved word - Typically a command name
  • Variable name
  • Constant integer value
  • Constant fixed point value
  • Constant vector value
  • Constant string value
Comments, whitespace, etc. will all be stripped out, leaving just the token stream. A token itself will probably be:

typedef struct {
int type;
int data;
} token;

#define TOKEN_RESERVED 0
#define TOKEN_VARIABLE 1


It's as simple as that!

For reserved words, the data will be the word ID. For variables, the data will be the pointer to the variable in the mission script variable data structure. Constant values will be converted to variables with unique, unreproducable names. The name will start with the variable type identifier, then will contain a semicolon (thus making it unreproducable), then the string version of the variable, taken straight from the mission script.

The mission variable repository

This will use the hash ADT. The key will be the variable name, the value will be the following structure:

typedef struct {
int size; /* Array size, -1 if not an array */
int data; /* Data value or pointer */
char name[0]; /* Variable length array thingy containing variable name */
} mvar;


The mvar structure is what token.data will point to.

Data will be arranged as follows:
  • i - mvar.data will be the int value
  • f - mvar.data will be the f1616 value
  • v - mvar.data will point to the vec16 value
  • s - mvar.data will point to a char array containing the string (Or perhaps a special string data type, I dunno)
  • p - mvar.data will be the integer ped ID
  • c - mvar.data will be the integer car ID
  • o - mvar.data will be the integer object ID
  • e - mvar.data will be the integer entity ID. The top byte will be used to identify whether it's a ped, car, or object.
  • g - mvar.data will be the 32bit gang bitflags
  • . - mvar.data will be the index into the token array of the instruction which the label points at
  • i[] - mvar.data will point to an array of ints
  • f[] - mvar.data will point to an array of f1616's
  • v[] - mvar.data will point to an array of vec16's
  • s[] - mvar.data will point to an array of char *'s (or string *'s)
  • p[],c[],o[],e[] - mvar.data will point to an array of ints giving the ped/car/object/entity ID's
  • g[] - mvar.data will point to an array of ints giving the gang bitflags
  • .[] - mvar.data will point to an array of ints giving the token array indexes of the instructions the code labels point at
  ^[ Log in to reply ]
 
Jeffrey Lee Message #72106, posted by Phlamethrower at 04:11, 25/11/2005, in reply to message #72105
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
Mission variable repository... coded!
  ^[ Log in to reply ]
 
James Shaw Message #72111, posted by Hertzsprung at 09:24, 25/11/2005, in reply to message #72103
Hertzsprung
Ghost-like

Posts: 1746
Isn't that a bit like designing the iPod case before inventing the HD and audio compression?

[Edited by adrianl at 01:24, 25/11/2005]
You don't buy an iPod for the music though, do you.
  ^[ Log in to reply ]
 
Pages (22): |< < 3 > >|

The Icon Bar: The Playpen: Slightly cold news on page 10! Phlamey breaks the server.