EN
Magomet Kochkarov
Magomet Kochkarov
1 subscriber

DooM autoaiming

Hey!
Recently I've decided to recreate doom 1 autoaiming in GameStudio 3D aka Acknex 8. It's been awhile since I've been working with it, but I've never accomplished this task. I've seen a very nice video on the youtube where decino explain in details how autoaiming in doom worked and I decided to give it a go! It turns out to be much easier than it seems.
So the logic is quite simple, but it yet might need some tweaking:
1) I scan in front of player's camera for any shootable entities (in my case enemies or props). Scan cone has following parameters width = 10 degrees, height = 120 degrees and range 1024 quants. All found entities are saved into the array.
2) Since scanning ignores all the level geometry and detects only shootable entities, I additionally need to check if entities which are found within the scanning cone are visible or not. To do this I use a raycast from camera to each entity one by one. And here comes the trickiest part, since some parts of the enemy's bbox might be hidden behind level geometry, I don't simply raycast to it's origin position. Instead, I have 6 points per each entity. They are : center, head, top right corner, top left corner, lower right corner and lower left corner. So auto-aim will try it's best to aim at enemies bbox center position, if it's not visible, it will try to aim at the head, and if it's not visible too, then it will try to aim to any visible bbox corner.
3) Last thing we need to check for is the distance to found entities. Since we want to shoot the closest one to the camera. 
You can see the end results here on my youtube channel:

Subscription levels

No subscription levels
Go up