What is the algorithm behind base building AI?

KompaktiveKompaktive Posts: 5Member

Let's say I try to make a 2D tile based base building game, but I have no idea the algorithm behind it like

  • What node should I use?
  • How do you even program the AI to place and build structure?
  • How to prevent AI from placing structure randomly and aimlessly?
  • How do AI build a wall in front of / covering the vulnerable structure?
  • How to prevent AI from trying to build a structure on already occupied tile?
  • How to make AI to stop building a same structure when there is already near it?

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 2,810Admin

    Making AI is an extremely complicated topic, especially depending on how many features you want to add to it. I would suggest starting simple and working your way up, making more complex interactions as you need them and/or go along.

    For example, I would start with making an AI that can move around the world, first and foremost. As for which node to use, it really depends on how you want to do it. I'd suggest first trying the same type of node that your player character might use, as then you can piggyback off some of the code you have already written.
    Next, I would work on making the AI aware of the environment, perhaps moving towards a goal position. From there, maybe placing a structure at a position offset from the goal, and so on and so forth.

    I know this isn't an exact answer, but the topic of AI is so complex and there are so many ways to handle it, there is no way to give a concrete answer to any of the questions.

  • KompaktiveKompaktive Posts: 5Member

    @TwistedTwigleg said:
    Making AI is an extremely complicated topic, especially depending on how many features you want to add to it. I would suggest starting simple and working your way up, making more complex interactions as you need them and/or go along.

    For example, I would start with making an AI that can move around the world, first and foremost. As for which node to use, it really depends on how you want to do it. I'd suggest first trying the same type of node that your player character might use, as then you can piggyback off some of the code you have already written.
    Next, I would work on making the AI aware of the environment, perhaps moving towards a goal position. From there, maybe placing a structure at a position offset from the goal, and so on and so forth.

    I know this isn't an exact answer, but the topic of AI is so complex and there are so many ways to handle it, there is no way to give a concrete answer to any of the questions.

    I guess you're right. I need to start the basics first. I'm still excited to know the answer thought.

Sign In or Register to comment.