Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 6 7 [8] 9 10 ... 222

Author Topic: Dwarf Fortress meets The Outer Wilds? "Ultima Ratio Regum", v0.10.1 out Feb 2023  (Read 636181 times)

Clownmite

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #105 on: November 17, 2011, 07:31:33 pm »

I vaguely remember that you could use your own callback function instead of using the tcod map class to do the pathfinding, if that helps. 

http://doryen.eptalys.net/data/libtcod/doc/1.5.1/html2/path_init.html?c=false&cpp=false&cs=false&py=true&lua=false

I think you just return a 0.0 the tile is blocked (by a wall or monster) and a 1.0 otherwise.

Thanks for the help - I had been looking at the custom blocked function thing. I guess I didn't articulate my question clearly: In order for the AI to take the most current information into account, it will have to loop through every single map tile AND every single object on the map, every single turn (and every AI entity would have to do this), so I'm trying to figure out if there's a better way.
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #106 on: November 17, 2011, 10:06:39 pm »

I have no idea how Ultima RR is doing it, but the usual answer is to make the AI pretty dumb.   :P

Chances are each entity doesn't really need to know about every single tile to do what it needs to do.  Its generally just something like

1) Check my status
2) Check a target or two near me
3) Decide what to do with that, which is usually:
 - run away,
 - run towards
 - stab with the stabby sword

If you have a bunch of entities, then it'll probably look smart enough.
« Last Edit: November 17, 2011, 10:10:26 pm by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Clownmite

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #107 on: November 17, 2011, 10:25:34 pm »

I have no idea how Ultima RR is doing it, but the usual answer is to make the AI pretty dumb.   :P

Chances are each entity doesn't really need to know about every single tile to do what it needs to do.  Its generally just something like

1) Check my status
2) Check a target or two near me
3) Decide what to do with that, which is usually:
 - run away,
 - run towards
 - stab with the stabby sword

If you have a bunch of entities, then it'll probably look smart enough.

That's actually exactly what my AI does right now (although the commander AI issues some pretty silly commands to the squad leaders, who either move where the commander tells them, or have their men charge). The issue is that when I have a squad of 10 vs another squad of 10, the pathfinding AI creates a traffic jam, where there will only be 1 guy from each side fighting, with the rest of the squad piled up behind them, each one trying to get at that "closest enemy" and not recognizing that there's another guy blocking their path. I can (and will, soon) change them to look for something other than the closest enemy, but that doesn't solve the core issue of them not realizing objects obstruct their paths.
Logged

BishopX

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #108 on: November 17, 2011, 11:42:13 pm »

I have no idea how Ultima RR is doing it, but the usual answer is to make the AI pretty dumb.   :P

Chances are each entity doesn't really need to know about every single tile to do what it needs to do.  Its generally just something like

1) Check my status
2) Check a target or two near me
3) Decide what to do with that, which is usually:
 - run away,
 - run towards
 - stab with the stabby sword

If you have a bunch of entities, then it'll probably look smart enough.

That's actually exactly what my AI does right now (although the commander AI issues some pretty silly commands to the squad leaders, who either move where the commander tells them, or have their men charge). The issue is that when I have a squad of 10 vs another squad of 10, the pathfinding AI creates a traffic jam, where there will only be 1 guy from each side fighting, with the rest of the squad piled up behind them, each one trying to get at that "closest enemy" and not recognizing that there's another guy blocking their path. I can (and will, soon) change them to look for something other than the closest enemy, but that doesn't solve the core issue of them not realizing objects obstruct their paths.

You know, I'm not sure individual level path finding is that way to go in games like these. I mean historically anyone more tactically advanced than a tavern brawl fought with some level of coordination, even if it's only something as simple as "I'll stick with my mates so I'll have some to watch my back". To that end I think an AI descison tree like this:

-Check status
-Check for squadmates
-check for threats
-Make grade dependent descisions. For the grunts this would be:
     -If overwhelmed or cut of, run away
    -if ranged threat, respond/hold ranks/charge
    -if if opponents are close by attempt to engage while maintaining squad coherency.
For squad leaders you could add in slightly more advanced path finding, such are moving towards the enemy.


Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #109 on: November 18, 2011, 11:44:46 am »

Maybe something like this:

Spoiler (click to show/hide)

In theory I think that would avoid the traffic jam issue.

Edit:  I should probably stop derailing the thread though.
Edit 2:  Fixed a logic error where unit would try to avoid walking next to himself.   :P
« Last Edit: November 18, 2011, 02:23:16 pm by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Clownmite

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #110 on: November 19, 2011, 11:19:42 am »

Maybe something like this:

**CODE**

In theory I think that would avoid the traffic jam issue.

Edit:  I should probably stop derailing the thread though.
Edit 2:  Fixed a logic error where unit would try to avoid walking next to himself.   :P


Thanks! I appreciate the help. And as long as nobody else is trying to carry on a discussion, and we're bumping this thread to the front page, I don't think derailing the thread is a bad thing.

I'm still having trouble understanding the custom function though - don't you need it to loop through EVERY tile on the map, along with every object? Here's my pathfinding function, and my move function:

Spoiler (click to show/hide)

The trouble is obviously in my path_func - if I comment out the objects bit, it works fine (but the pathfinding doesn't take into account other objects: the very issue I want to solve); but if I keep the object code in, nobody moves. Any thoughts? Feel free to pm me if you don't want to clutter the thread.
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #111 on: November 19, 2011, 11:46:35 am »

Thanks! I appreciate the help. And as long as nobody else is trying to carry on a discussion, and we're bumping this thread to the front page, I don't think derailing the thread is a bad thing.

I'm still having trouble understanding the custom function though - don't you need it to loop through EVERY tile on the map, along with every object? Here's my pathfinding function, and my move function:

Spoiler (click to show/hide)

The trouble is obviously in my path_func - if I comment out the objects bit, it works fine (but the pathfinding doesn't take into account other objects: the very issue I want to solve); but if I keep the object code in, nobody moves. Any thoughts? Feel free to pm me if you don't want to clutter the thread.

Nope.  The a* algorithm is the one that calls the function whenever its appropriate.  The custom path function ONLY tells the A* algorithm if the current cell is accessible or not.

Your code is almost right I think.  I'd take out all the checking of the xFrom and yFrom.  Only look at xTo and yTo when doing the comparisons.  The problem is that xFrom and yFrom are probably always going to match against the unit who is trying to move.  He is essentially blocking himself.  So your code would be more like:

Spoiler (click to show/hide)

I think that would probably work.

Edit:  I'm actually working on some similar code that is having a few technical problems.  If I get it worked out I might have a better idea of how to make things more efficient too.
« Last Edit: November 19, 2011, 11:50:14 am by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Clownmite

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #112 on: November 19, 2011, 02:47:36 pm »

Nope.  The a* algorithm is the one that calls the function whenever its appropriate.  The custom path function ONLY tells the A* algorithm if the current cell is accessible or not.

Your code is almost right I think.  I'd take out all the checking of the xFrom and yFrom.  Only look at xTo and yTo when doing the comparisons.  The problem is that xFrom and yFrom are probably always going to match against the unit who is trying to move.  He is essentially blocking himself.  So your code would be more like:

Spoiler (click to show/hide)

I think that would probably work.

No, if I try that the game freezes up (and if I do this:
Spoiler (click to show/hide)
It runs, but again, they don't take each other into account when pathfinding.

What I don't understand is the purpose of the xFrom, and yFrom in that definition. How does the path function know the xFrom and yFrom, since they're never specified? Why does xTo and yTo even matter: Shouldn't this definition be just building a path map by looking at all map tiles and checking which ones are blocked?
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #113 on: November 19, 2011, 05:25:41 pm »

It freezes?   I don't have an explanation for that.   :(


The change you made doesn't take each other into account when pathfinding because it just looks at the first unit and then returns 1.0.  It should look at all of them, and then return 1.0 if none of them matched.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Leatra

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #114 on: November 19, 2011, 05:40:07 pm »

Erm... No offense but you guys could discuss this with MSN or something too you know :D
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #115 on: November 19, 2011, 05:47:47 pm »

No, you are right.  I'll keep it in pms or in the programming help thread.  Sorry about that!
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

klingon13524

  • Bay Watcher
  • The Mongols are cool!
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #116 on: November 20, 2011, 04:11:23 am »

Bump, because this seems like exactly the game of my dreams.
Logged
By creating a gobstopper that never loses its flavor he broke thermodynamics
Maybe it's parasitic. It never loses its flavor because you eventually die from having your nutrients stolen by it.

Enzo

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #117 on: November 20, 2011, 04:42:29 am »

I don't know if bumps are necessary on a day-old topic :/
Logged

KaelGotDwarves

  • Bay Watcher
  • [CREATURE:FIRE_ELF]
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #118 on: November 20, 2011, 05:51:14 am »

Posting to encourage and to follow the project.

Rex_Nex

  • Bay Watcher
    • View Profile
Re: Ultima Ratio Regum - a 'strategy roguelike' in the making...
« Reply #119 on: November 20, 2011, 08:12:44 am »

Same as above. Hoping to see URR become something grand :)
Logged
Pages: 1 ... 6 7 [8] 9 10 ... 222