Results 1 to 2 of 2

Thread: Representing an environment in memory for use with a pathfinding system.

  1. #1
    Join Date
    Mar 2014
    Posts
    205
    Mentioned
    4 Post(s)
    Quoted
    116 Post(s)

    Default Representing an environment in memory for use with a pathfinding system.

    I'm looking to write a pathfinding AI for a 2d platforming game - I've done some reading and I think I understand the general idea. I've also found some example code, so I'm going to work through that; I think, for the most part, I can get the algorithm itself going.

    The issue I'm running into is how to represent the game (any game from the "fangame" genre, though the specific game is "I Wanna Be a Brute of a Man") in memory to run the algorithm on. For the vast majority of movement, the game works on a pixel-based system (each frame = 3 pixels of horizontal movement, game is 800x600 typically). This introduces the concept of aligns; essentially, because you move 3 pixels horizontally at a time, it's possible to touch a wall to make yourself move only 1 or 2 pixels, changing which align you're currently on (and thus which pixels you can move to) and making certain jumps easier (or, in some cases, possible) to do. This concept also exists, albeit in a slightly altered fashion, for vertical alignment; the difference here is that the alignment is sub-pixel, down to 17 decimals of precision (though for my purposes only 2 decimals are needed). This align changes when you jump, and differently when you jump in water. I'm going to be working on a formula that lets me accurately predict what my valign will be after a given jump, but for now I just want to get the basic movement working.

    So, with that wall of text explanation out of the way, I'm not sure how to represent my environment in memory in such a way that I can add valign manipulation as a possible movement mechanic (though with a cost so high it'll only happen if the jump is not possible in any other way). I do have the luxury of knowing ahead of time what each screen is, but there are moving parts within the game (moving platforms, apples which change from one stance to another and back every few frames, and triggers which cause parts of the level to change).

    An example of one of the less precise screens can be seen here: http://puu.sh/igJJt/aee879963b.jpg

    Let me know if I haven't explained anything clearly, or if extra info is needed. Thanks in advance!

  2. #2
    Join Date
    Feb 2013
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    48 Post(s)

    Default

    Won't a simple 2D array fix the problem?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •