cassius Posted April 22, 2011 Share Posted April 22, 2011 In my third person game there are several sword fights.In every case if the player disengages and walks off the enemy remain static.Sometimes I need the enemy character to run after the player and re confront him. How could this be coded? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Naughty Alien Posted April 23, 2011 Share Posted April 23, 2011 ..you have to create 'behaviour engine' what will deal with tasks like that..such engine should contain all elements describing behaving pattern of specific NPC and its states..something along this lines should work just fine.. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted April 23, 2011 Share Posted April 23, 2011 Two subjects you need to read up on: Path finding and AI Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
cassius Posted April 23, 2011 Author Share Posted April 23, 2011 Thanks both. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
puki Posted May 6, 2011 Share Posted May 6, 2011 It could just be as simple as a distance check from the enemy to the player (depending on your game level design) and also how soon the enemy starts pursuing the player - so you may not need to worry too much about the pathfinding. It's just a case of logic really - you may have a set value that is basically a critical distance check so, if the player has exeeded the set distance, then the enemy assumes the player is fleeing and will then home in on the player - when they are within a set distance you can them deem the enemy to be confronting the player - the easiest way being to just assume the player is going to turn and face the enemy based on the enemy being so close- other than that you'll have to overtake the player based on the direction they are heading in and then have your enemy turn and face the player when he has overtaken the player (could get messy though, if the player is not interested in the confrontation and is just changing direction to shake off the enemy), so you could just force the player to slow down as though the enemy has grabbed them - again, this is purely done on a distance check (or collision check if you want) - then you deactivate the 'grab' on the player to allow both player and enemy to have a scrap (or to allow the player to try and flee again). Quote Link to comment Share on other sites More sharing options...
cassius Posted May 7, 2011 Author Share Posted May 7, 2011 Thanks puki. Some interesting ideas. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.