Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1375218 Posts in 65096 Topics- by 57351 Members - Latest Member: SSoft_boi

April 07, 2020, 09:36:15 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Looking for direction with 2D AI
Pages: [1]
Print
Author Topic: Looking for direction with 2D AI  (Read 1437 times)
Copywright
Level 0
**


there go the man


View Profile
« on: June 17, 2013, 02:40:44 PM »

I'm trying to figure out how I'll handle AI in my sidescroller, and I'm having some trouble (I'm really used to AI for platforming games, but this seems to be a bit more troublesome).

I just started the project I asked about a while ago, still in Unity. Solved that annoying sorting problem too:


*ignore the sprites, trying to focus on prorammingprogramming. (and apparently spelling)

Now I want to get some opinions on the ideal way to handle AI for this game. My goal isn't so much for combat AI, but for characters walking on the sidewalk, going to stores, cars driving by, etc. I envision the AI to be a simplified version GTA's where the player can interact with passing people etc. I was thinking using waypoints, and have actions be done by arrival/exiting a node on the paths. I know A* is a popular choice for 2D games, but I'm not sure how it'd work out here. Another thing for the waypoints not to mess with the z-values of the sprites, which are basically indexed by setting z to y (since -z is closer to the camera).

I'm just looking for any suggestions to handle the type of AI I'm looking for.
« Last Edit: June 17, 2013, 02:49:31 PM by Copywright » Logged
moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #1 on: June 17, 2013, 02:47:28 PM »

if there are very few obstacles (like in a standard beatem up) and the characters stay on screen, you don't really need A*, you could get away with some simpler avoidance algorythm
Logged

subsystems   subsystems   subsystems
Copywright
Level 0
**


there go the man


View Profile
« Reply #2 on: June 17, 2013, 03:41:45 PM »

Yeah, I'm completely sure there won't be many obstacles. It does seem to me that using simple things like triggers and raycasts may be the best way to go.
Logged
nikki
Level 10
*****


View Profile
« Reply #3 on: June 18, 2013, 05:01:57 AM »

Yeah A* is not necessary I suppose, and/or wouldn't solve the logic ones anyway

for that walking enemy I suspect the simplest
1) -allign Y position
2) -allign X position
3) -start swinging arms wildly

would suffice/get you a long way,
perhabs you'll need an extra step to make enemies not go and stand on the same spot.

for cars I think you don't really need AI at all,
just occcasionaly spawn one and make it move over the road.

for going to shops/other places I think a few waypoints and linechecks would do it. (as Copywright said)

all in all just a few differnt if elseifs would get you pretty far I suspect.
 
Logged
Dacke
Level 10
*****



View Profile
« Reply #4 on: June 18, 2013, 05:31:01 AM »

A* is pretty cheap and simple. No need to complicate things.

The simplest thing for me would be to treat the sidewalk as a (top-down) grid and move/pathfind the characters in that grid.
Logged

programming• free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
z84c00
Level 0
***


View Profile
« Reply #5 on: June 20, 2013, 08:43:14 AM »

A* for this type of game is completely overkill. Have a look at games (I'm sure you already have), like Golden Axe and Streets of Rage. The main strategy in those games is that generally only one character attacks, usually from behind. The premise is pretty much what was already mentioned earlier, first aligning the Y-axis and then closing in on the player, preferably when facing the other direction.

For groups you'll need to do a bit more coordination and decision making, based on health, weapons, proximity etc.

Object avoidance in these kinds of games is as simple as moving up / down as long as there's collision ( like a box or something ). Alternatively you could put some volumes (circles, really) around objects that push characters away.

-Z8
Logged
Dacke
Level 10
*****



View Profile
« Reply #6 on: June 20, 2013, 08:55:20 AM »

As Copywright stated in the original post, this isn't about combat AI. It's about multiple people moving around the sidewalk, going to stores, etc.

A* is pretty simple, costs very little in small environments and scales/generalizes well. So I'm not sure why you'd feel the need to hack together something simpler. But sure, it's completely possible and may cost less.
Logged

programming• free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Copywright
Level 0
**


there go the man


View Profile
« Reply #7 on: February 05, 2020, 02:35:38 AM »

i am so dope. MISTY WATER COLORED MEEEMORIEEES
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic