Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  AI Combat  (Read 1442 times)
0 Members and 1 Guest are viewing this topic.
Offline novasharp

Junior Duke


Medals: 1
Projects: 1


Gamemaker


« Posted 2013-04-29 15:32:30 »

I implemented combat (for the player) and allowing AI to follow a path, but I can't figure out the best way to implement combat for the AI. My game is meant to be a stealth shooter, so I want the AI to call in reinforcements when you are spotted and the game to get much harder, but to allow the player to hide and the AI will slowly return to their positions. The thing is that I can't figure out how to have enemies:

  • Spot the player
  • Stop current "patrol" and chase after player
  • Call in reinforcements from a certain distance
  • Implement combat so that AI is smart (will use cover), but not unbeatable (no instant reload, aimbot, instant turn, etc...)
  • ...

My code is at: https://github.com/novasharper/LocotusDesperatus

novasharp
Offline ReBirth
« Reply #1 - Posted 2013-04-30 01:52:20 »

Why use TinySound when libgdx already there?

Offline deepthought
« Reply #2 - Posted 2013-04-30 01:59:52 »

  • Spot the player
  • Stop current "patrol" and chase after player
  • Call in reinforcements from a certain distance
  • Implement combat so that AI is smart (will use cover), but not unbeatable (no instant reload, aimbot, instant turn, etc...)
  • ...

1. use a raytrace between the enemy and the player. If the raytrace is unobstructed and the angle of the line is within the enemy's field of view, the player is visible.
2. Once the player is found, save the old path and position, and set a new path towards the player.
3. Use the distance formula. If you're within a certain distance, call a method on the other enemies to alert them to the player, so they can do #2
4. I don't know about cover, you might need to place some sort of "cover hint" entity. to avoid instant turn give each entity a turn speed which it will turn by until it hits the right angle.
to avoid instant reload, use a countdown.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline novasharp

Junior Duke


Medals: 1
Projects: 1


Gamemaker


« Reply #3 - Posted 2013-04-30 12:06:21 »

Why use TinySound when libgdx already there?

I still have tinysound included from when I was trying to make this as a Java2D game. I just haven't removed it yet.

novasharp
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!