Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Bear with me! this IS a unique Enemy AI question... =P

Author
Message
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 12th Sep 2008 06:46 Edited at: 12th Sep 2008 06:49
I've been searching and researching AI methods and pathfinding systems, and they were quite helpful -- they certainly got the ball rolling. However, I'm now ready to do specific things and it's getting confusing. I even have psuedocode, but I have no idea how to implement it! Here's what I want to do:

This enemy/monster has a projectile in one hand, and a dagger in the other. I want the monster to be able to calculate (while moving and dodging) when the best moment to hurl the projectile at the player. It also needs to be able to dodge and run all over the place to be safe from the player's attacks.

The first issue I have is what method I use to have the monster move. Pathfinding is more ideal for 2D games (though I've found code for 3D path finding). Even with that, the player's going to be running and dodging, and it doesn't look like pathfinding work well on a rapidly moving target (the monster would have to constantly recalculate).

The second issue is that I want the monster to occasionally throw this projectile (it's a disc, btw) at the player and have a sense of aim.

As I said before, I've looked at AI tutorials and I even have a diagram of what I want to do. I need something more DarkBASIC-specific.
Help? Tuts? A point into the right direction? Thanks for your help.

I'm taking a break from AI and Collision,
Currently working on - Ring Menu
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 12th Sep 2008 23:11
Can you supply the diagram/flowchart/pseudocode for me?

I'll be able to convert them into DBPro code quite easily.

The optomist's right, The pessimist's right.
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 13th Sep 2008 22:57 Edited at: 13th Sep 2008 23:02


Here is pseudocode to compliment that:


It's not complex but it's a start. I just need a push in the right direction.

One thing: when it runs it doesn't mean "leave the battle", but it means take random paths (probably pre-coded) and literally run through them. Dodge means to an acrobatic maneuver (i.e. back-flips and strafes). Thanks for your help!

Currently working on - Enemy AI and Action Battle System
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 14th Sep 2008 10:04 Edited at: 14th Sep 2008 10:48
You can use the following as a scaffold for your program:



It handles your flowchart, bullet control, movement, jumping and collision.
I've commented every few lines of code, so you should be able to understand it.
Set the waypoints in the array to set the monster's path.
Load an object instead of making a large sphere to use custom terrain.

Controls:

Arrowkeys - move player
Spacebar - jump

Good luck,
Calcyman

The optomist's right, The pessimist's right.
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 15th Sep 2008 02:35 Edited at: 15th Sep 2008 02:37
Wow, thanks! This was just what I needed!

One more thing though: do you have a tutorial on Waypoints on hand? That concept is new to me.

Thanks again!

Currently working on - Enemy AI and Action Battle System
Random color object
16
Years of Service
User Offline
Joined: 14th Aug 2008
Location: Montreal Canada
Posted: 15th Sep 2008 04:58
I have a suggestion, I just bouth Dark AI. It is wounderfull, it look great. Din't used it yet I am too new.

Just watch that video, and find out how much time you will spend trying to get that result by yourselve.
Here is the page descriving the features: http://darkbasicpro.thegamecreators.com/?f=dark_ai

***********************************
******Click on watch the video's***
***********************************



You can get is as a package here with Dark Physics and others. http://darkbasicpro.thegamecreators.com/?f=enhance

I you don't have DBP yet you can get it + dark physics for 49,99$ and you can add Dark AI. Going to be less than the 178$ package.

When it is too complicated it is because you are trying at the wrong door.
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 15th Sep 2008 07:12 Edited at: 15th Sep 2008 07:15
I'm a struggling college student. I can't afford that.

I just remembered something that's really important: I have an AI function for my monster (in it's own included file) but the Collision DLL from Sparky is in it and I can't change that in any way. Thing is, the battle algorithm is going to require movement, movement is directed by the collision system, changing the way the collision system is set up will lead to more flexible movement, but no collision. How do I add AI algorithms and actions without crippling the collision system?

Currently working on - Enemy AI and Action Battle System
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 15th Sep 2008 09:33 Edited at: 15th Sep 2008 09:34
Quote: "Wow, thanks! This was just what I needed!"




You can replace the waypoints code with your own AI system if you want, it's just a temporary solution.

A waypoint is a point in space that forms part of a path. For example, a SatNav would use junctions as waypoints, then apply a pathfinding algorithm like Dijkstra's or A*. The logic just "sees" these waypoints, and lines connecting them.



In this example, there are 4 nodes, A, B, C and D. The shortest path spanning A and B, in this case, is ACDB. (60 units)

A graph can also be directed, and have one-way sections. These are usually shown as arrows, rather than lines.

Everything in Dark AI could be programmed, with more flexibility, in Dark BASIC. In my opinion it's better to make your own system, as you can control every detail of it.

You add the AI algorithms and actions seperate to the collision, since the code I provided contains the XCollision procedures. The collision is automatic, so you can make your own movement procedures without having to even consider collision.

To add the run AI, place the routines in the if bmode = 2 .... endif section of the battle_mode subroutine.

Remove all of the sparky collision code from your AI function, and the monster will still feel collision due to the XCol() function.

Good luck,
Calcyman

The optomist's right, The pessimist's right.

Attachments

Login to view attachments
cyangamer
16
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 21st Sep 2008 06:02
UPDATE!

AI as been going well, but I need something more complex. I'd really be grateful if who ever is reading this would take a look at my pseudocode and tell me if I'm on the right track:


I might just start a new topic since this one may have run its course. =/

Currently working on - Enemy AI and Action Battle System

the sig limit needs to be raised...
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 21st Sep 2008 16:36
It looks alright to me, and your code is well-structured. Certainly a lot better than when I started programming.
I'm under the impression that you've had experience with other languages.

There is a key element missing from your code - arrays! I've used arrays in most of my programs, and I'm sure that your game will need them at some point or another. For example, if you want multiple things to be treated indentically (like enemies) you'll use arrays.

You'll also need to put the following at the top of your code:

global ManeuverTime

Note that it's actually spelled "Manoeuvre".

The optomist's right, The pessimist's right.

Login to post a reply

Server time is: 2024-11-24 19:35:12
Your offset time is: 2024-11-24 19:35:12