Generating a NavMesh / Point Graph for 2D Procedural Platformer Levels

  • 2 Replies
  • 2704 Views
*

JekasG

  • Roomba
  • *
  • 3
Hi everyone,

I am trying to create an algorithm which handles a NavMesh / Point Graph Generation for 2D Procedural Platforms Level in Unity3D.
The reason why i say NavMesh / Point Graph is because i dont know for sure which one would be better for my 2D Procedural Platform Levels.

What i believe is that Point Graph would be better.

The major things i think i would have to face are;
   - Navigating through the Platforms
   - Jumping from a platform to another

I have read through the basics of Pathfinding;
   - http://arongranberg.com/astar/features#
   - http://www.redblobgames.com/

Although i have never made a Pathfinding System and my coding skills arent all that good, but i am willing to learn. Please, if possible could you guys reply with simple English. I dont understand the complicated terms. Thanks in advance for that.


So this is what i have in mind. SInce i know how to say it in theory i dont know how to put it in code. So please, give me advises, criticisms and most of all new theories. Since i already have a working Procedural Platform Generator, I plan to work from that.
   From that Point Graph, I plan to generate Points above the Platforms, on each end. So the AI knows where it can navigate.
   Once it can navigation from one end of the Platform to another. Its time to implement Jumping.
   So to do so, i plan to Raycast some Math Trajectories. So when the Raycast has hit the next platform ( in some way , i havent figured out exactly how ) and it needs to jump to the next platform. Then it will jump.

Some slight problems i have right now are;
   - Generating the Grid to do the Pathfinding ( Main Problem )
      I know for normal Pathfinding, Normals Linear Grids are used. But i am certain that for my situation i cant use that.
      So how can i generate my Graph ?
      Please include some algorithms
   - How is jumping done ? ( Major - Minor Problem )
      Am i to program some code for the computer to input some buttons so the AI will jump ?
   - How can i perfectly do the Trajectories ? ( Major - Minor Problem )
   - How are cost / weight calculated ? ( Minor Problem )



Thank you so much. Your help is very much appreciated.

*

ivan.moony

  • Trusty Member
  • ************
  • Bishop
  • *
  • 1729
    • mind-child
Re: Generating a NavMesh / Point Graph for 2D Procedural Platformer Levels
« Reply #1 on: February 16, 2015, 06:30:51 pm »
I'm aware of a method for path finding, but I don't know if I can put it in simple words...

Let's say that we have infinite size chess board and a horse on it. We have to find how to drag a horse in multiple moves from its starting position to specified place. The trick is that we have to grow a tree of every possible move from starting position. Starting position then gets 8 possible new positions after first move. Each of that 8 position then gets its new possible 8 positions for a second move and so on. With each branch we check is specified ending place equal to any of new places. Once we get ending place inside some branch, we forget all other branches and memorize branch that canonically led to ending place.

Analogically, with each platform, I guess you should enumerate platforms to which you can jump or fall to. Then you start building tree from the current platform and check for ending platform. At the end, you'll get an ordered list of platforms which you have to pass to get to the ending platform. Jumping/falling complicates things a little bit, but I think it should be sufficient to store information about direction of jump or fall when enumerating possible movements.

Sounds complicated, but once you get it, it is really simple thing.

*

Korrelan

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1454
  • Look into my eyes! WOAH!
    • YouTube
Re: Generating a NavMesh / Point Graph for 2D Procedural Platformer Levels
« Reply #2 on: February 16, 2015, 10:59:59 pm »


Being as your just starting out with AI I suggest you start with a simple vision system.  You have the right idea for casting rays.

If you scan from Mario’s eye level out into the game space you’ll end up with very basic idea of the layout in front of your character.  Then use simple pattern matching between the degree of the ray and the distance until it encounters an object, note the main colour of the hit surface (use an averaged colour block).  The patterns can easily be stored in an array and checked for the next best appropriate move. 

Gaps (red triangle) and jumps (blue triangle) can easily be detected this way.

Without the use of genetic algorithms you would have to play the game while the system learns to play.

I know it’s very basic but you got to start somewhere  :)
« Last Edit: February 17, 2015, 08:16:56 am by korrelan »
It thunk... therefore it is!...    /    Project Page    /    KorrTecx Website

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

274 Guests, 0 Users

Most Online Today: 497. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles