Hello All!
Firstly, I'm not wanting code...just advice. My median-term goal is to creat a sci-fi racing game (imagine flying motorcycles). I am doing very well at it and am amazed at how powerful BLitz3D can be when used properly.
What I need is the opinions of others that have gone this route before me.
For this racing game I am in the process of planning how the CPU controlled racers will act, move, and react in the game.
Here's what I want to acheive:
1) No preset and predictable paths
2) Each racing entity makes its own decisions(limited number of CPU controlled racers...maybe 4-6)
3) A dynamic reaction based upon the real-time factors in the game
4) A distinct personality for each CPU racer
Here's how I think I should do it (and have been experimenting with):
I defined each and every CPU racer personality as a subset of a type CPUracer. Each subset is called by name (Inky, BLinky, Clyde...etc [yes, i'm old and that's a Pac Man reference]). The type contains a preset 'personality' of variables that hold such things as how aggressive they are against opponents, how far off the center of the track they are willing to go, how much over/under the maximum safe speed of a turn they'll go, whether they like to race past an oppponent or push them off the track, etc.
The race track is loosely defined as it is a 3D world and the speeders (my flying motorcycles) can fly over objects. So instead of making waypoints, or importing in a pre-described path of racing, I made a 'median' line for the track. Depending on the 'personality' of the CPUracer, they will adhere to the median (more or less) or go off-path to meet their desires.
When the CPUracer is in the proximity of a hurdle to overcome, or a power up, they check their relative position and decide (based upon their judgement, reaction, and aggression values) whether or not to 'go for it' or avoid it.
When a CPUracer is near an opponent, they calculate whether or not they 'think' they should pass them, bump them off the track area, or take another action.
Another function generates how the 'think' they should pass (left, right, over, under)
I have created a bell-curve decision loop function that defines (in percent) the chance of them taking any particular course of action. this decision is modified by their personality variables. So if I have Inky, a peaceful CPUracer that just wants to race, his decisions will be mostly within the 'Let's just race' idealogy.....but with Clyde, his aggression makes him more prone to knocking other players into cliff walls.
Now each and every CPUracer also has a variable that tells them how far off course they are. When they reach a certain point off of the median of the track(predefined by their personality) they determine whether they should get themselves back on-course, or try to short-cut it to the track before the next checkpoint.
Likewise, when they get close to the player entity, they make similar decisions.
When no obstacles are around the CPU controlled racers guess the shortest path to the median of the track (based upon their personality) and go to it, plus or minus some personality-colored variances.
Overall, this gives, I think, a pretty definitive illusion of thought, decision making, and personality; as BLinky will go straight down the middle in a straight section of track, but hug the inner curve on a turn, and pass his opponents on whatever side he thinks is the shortest when he gets near an opponent.
Thus far, my experiments and tests have been decently cool and work, but I am wondering if anyone else has gone this route before and would like to give me advice on my strategy development.
Thanks
Firstly, I'm not wanting code...just advice. My median-term goal is to creat a sci-fi racing game (imagine flying motorcycles). I am doing very well at it and am amazed at how powerful BLitz3D can be when used properly.
What I need is the opinions of others that have gone this route before me.
For this racing game I am in the process of planning how the CPU controlled racers will act, move, and react in the game.
Here's what I want to acheive:
1) No preset and predictable paths
2) Each racing entity makes its own decisions(limited number of CPU controlled racers...maybe 4-6)
3) A dynamic reaction based upon the real-time factors in the game
4) A distinct personality for each CPU racer
Here's how I think I should do it (and have been experimenting with):
I defined each and every CPU racer personality as a subset of a type CPUracer. Each subset is called by name (Inky, BLinky, Clyde...etc [yes, i'm old and that's a Pac Man reference]). The type contains a preset 'personality' of variables that hold such things as how aggressive they are against opponents, how far off the center of the track they are willing to go, how much over/under the maximum safe speed of a turn they'll go, whether they like to race past an oppponent or push them off the track, etc.
The race track is loosely defined as it is a 3D world and the speeders (my flying motorcycles) can fly over objects. So instead of making waypoints, or importing in a pre-described path of racing, I made a 'median' line for the track. Depending on the 'personality' of the CPUracer, they will adhere to the median (more or less) or go off-path to meet their desires.
When the CPUracer is in the proximity of a hurdle to overcome, or a power up, they check their relative position and decide (based upon their judgement, reaction, and aggression values) whether or not to 'go for it' or avoid it.
When a CPUracer is near an opponent, they calculate whether or not they 'think' they should pass them, bump them off the track area, or take another action.
Another function generates how the 'think' they should pass (left, right, over, under)
I have created a bell-curve decision loop function that defines (in percent) the chance of them taking any particular course of action. this decision is modified by their personality variables. So if I have Inky, a peaceful CPUracer that just wants to race, his decisions will be mostly within the 'Let's just race' idealogy.....but with Clyde, his aggression makes him more prone to knocking other players into cliff walls.
Now each and every CPUracer also has a variable that tells them how far off course they are. When they reach a certain point off of the median of the track(predefined by their personality) they determine whether they should get themselves back on-course, or try to short-cut it to the track before the next checkpoint.
Likewise, when they get close to the player entity, they make similar decisions.
When no obstacles are around the CPU controlled racers guess the shortest path to the median of the track (based upon their personality) and go to it, plus or minus some personality-colored variances.
Overall, this gives, I think, a pretty definitive illusion of thought, decision making, and personality; as BLinky will go straight down the middle in a straight section of track, but hug the inner curve on a turn, and pass his opponents on whatever side he thinks is the shortest when he gets near an opponent.
Thus far, my experiments and tests have been decently cool and work, but I am wondering if anyone else has gone this route before and would like to give me advice on my strategy development.
Thanks
