FPS Game Help

Blitz3D Forums/Blitz3D Programming/FPS Game Help

Rafiq(Posted 2005) [#1]
Hey Guys. I started using Blitz3d for the first time 3 weeks ago. I'm taking a class at my university in video game design, and the professor recommended B3D. My team is working on a FPS game. I got as far as creating a maze in Maplet, setting up the camera, and detecting collision between the player and the walls . I can navigate the maze just fine. Now if I wanted to add soldiers or enemies, how would I do that. Any ideas?


Leiden(Posted 2005) [#2]
You would first need to model the enemies, animate them, and then load them into Blitz3D. For now you can just use something like a cube for an enemy until you can model and animate some baddies :) You can use a Finite State Machine for the enemy AI. This is basically a collection of states such as Search, Run, Attack etc. When a certain condition is met, such as Health < 20 you would switch to the state 'Run'. There is an awesome tutorial on FSM's located somewhere in BlitzCoder. Do a google search for "Blitz3d finite state machines" and your bound to come up with something!


Ross C(Posted 2005) [#3]
If your doing enemies, you will also need to set up path finding do. You will probably need to put pivots/markers at each crossing of paths, and use pathfinding code to navigate your enemies through the maze.


Rafiq(Posted 2005) [#4]
thanks guys


Rafiq(Posted 2005) [#5]
Ross C, can you please tell me a little bit more about pivots/markers and pathfinding code.


jfk EO-11110(Posted 2005) [#6]
Well you made a maze, added collision and Mouselook. Sounds like some first steps. No offence. I'd suggest to make something easy for the soldiers first. Pathfinding etc. can become very complex.

I did something that is very simple and still pretty effective: Make a special version of your engine that allows you to walk around in the maze. While you are walking around, your position will be stored n an array every say 500 Milliseconds. This array will then be saved to a file. Later you'll be able to load the array and make your soldiers walk along the recorded points. This is a waypoint recorder. A very simple solution that looks very good. You may add more to it, eg. multiple ways for each character etc.

I say this only because I know you can get lost in AI if your approach is too sophisticated.


jfk EO-11110(Posted 2005) [#7]
Additionally:

If every soldier has multiple ways (or routes), you can use them for pathfinding as well. Simply parse all waypoints and find the one that is closest to the target location, then use that route. When there are multiple routes to the target then you may compare the number of waypoints to determine the best way.

I would use a star-structured group of routes. So every route leads to the group center point and if the soldier needs to go to a certain waypoint on a certain route, he simply has to go to the center first. I once tried a system with crossing routes that would allow to jump to other routes when they cross oneantother, but what sould I say, in the end it didn't work :).

A next step would be to use Linepicking to determine if an enemy can see you. If they are in attack mode, they will shoot etc. when they can see you. As soon as they cannot see you anymore (because you run away etc.) they continue running after you. When they see you again, they continue shooting. This looks already pretty intelligent, although it's very simple to code.
In the same time when they are in escape mode, they will run away when they can see you (=you can see them), and then they will pause as soon as you cannot see them anymore (or a little later), thinking they are save now.

I did some tests with A-Star pathfinding algorithms in 3D and it turned out it's way to slow to be used in a game. Some people suggest to use a retarded 3D a-Star method that is in fact 2D (and therefor faster) with multiple levels. but honestly: first there's a big lot of work to make the soldiers act naturally an their computed ways, and the level oriented 2D pathfinding is also an omnipresent limitation during level design, that will complicate things massively.

Some people talk a lot about the theory of pathfinding and AI, but when you try to watch their work you'll see they did nothing but theories. So make sure to check peoples work before you believe what they say.


Rafiq(Posted 2005) [#8]
Got it jfk ..Thanks