Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Implementing pathing algorithms in GLSL  (Read 1653 times)

mikekchar

  • Bay Watcher
    • View Profile
Implementing pathing algorithms in GLSL
« on: October 08, 2016, 07:32:43 pm »

I have this potentially very stupid idea.  In text based rogue-likes, the amount of data that's needed for pathing should be fairly small.  At least for 2D pathing, you should be able to create a texture and then perform transformations to find a path on that texture using  GLSL.  I'm completely naive when it comes to OpenGL, but looking at the limitations of the shader language, I don't think there is anything that would prevent this.  Does anyone know if this has been tried before?  I'm thinking of playing around with it in the near future.  It would be cool to use graphics processors to offload processing for a text game ;-)
Logged

mikekchar

  • Bay Watcher
    • View Profile
Re: Implementing pathing algorithms in GLSL
« Reply #1 on: October 08, 2016, 07:41:18 pm »

Sorry to reply to my own post (and so soon!).  Indeed, there is work on this.  This youtube video shows examples of Dijjkstra's Algorithm vs A* vs an GLSL implementation of a concurrent Dijkstra's algorithm.  There is a link to a paper on the topic in the video discussion.  So it is definitely possible!

https://www.youtube.com/watch?v=cSxnOm5aceA
Logged

IsaacG

  • Bay Watcher
  • Mad Engineer
    • View Profile
    • JJoseph on Deviantart
Re: Implementing pathing algorithms in GLSL
« Reply #2 on: October 09, 2016, 07:27:41 pm »

I have this potentially very stupid idea.  In text based rogue-likes, the amount of data that's needed for pathing should be fairly small.  At least for 2D pathing, you should be able to create a texture and then perform transformations to find a path on that texture using  GLSL.  I'm completely naive when it comes to OpenGL, but looking at the limitations of the shader language, I don't think there is anything that would prevent this.  Does anyone know if this has been tried before?  I'm thinking of playing around with it in the near future.  It would be cool to use graphics processors to offload processing for a text game ;-)
Heh, now that is interesting.  So far, I'm of the impression that not much research is done on optimizing the performance of text-based games, as those are expected to be light-weight enough that everyone expects it to always run at full speed (excluding Dwarf Fortress).
That said, I'm more interested in hearing about a text game that would burn through that kind of processing power.
I'm afraid I don't know much about OpenGL either, but I'm a quick study.
Logged
LCS 4.12 Thread
https://discord.gg/HYbss8eswM
Quote
Many people, meeting Aziraphale for the first time, formed three impressions: that he was English, that he was intelligent, and that he was gayer than a tree full of monkeys on nitrous oxide.
Constitution of the Confederate States
Article I Sec. 9 4
No bill of attainder, ex post facto law, or law denying or impairing the right of property in negro slaves shall be passe

mikekchar

  • Bay Watcher
    • View Profile
Re: Implementing pathing algorithms in GLSL
« Reply #3 on: October 11, 2016, 06:57:27 pm »

I also don't know much, but I'm planning to do some work on it in the near future.  I'm on vacation for a few weeks and likely won't be near my computer, but hopefully starting in November I can get something done.  I'll post here when I have some code to show.

I was thinking that quite a lot of things that are problematic in DF would actually work very nicely in a shader -- for example temperature calculation, water flow, etc, etc.  The nice thing about text games is that even on the cheapest  laptop these days you have oodles of power just sitting idle.  It seems like a waste not to use it ;-)

Edit: I just realized that this is a completely inappropriate place to post this (missed the "our" in the description).  Apologies.
« Last Edit: October 17, 2016, 03:50:13 am by mikekchar »
Logged