Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial setup for the new chunk template concept #5633

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

Garanas
Copy link
Member

@Garanas Garanas commented Nov 4, 2023

The chunk templates will eventually replace the base templates. It is similar, if not equal, to the templates used by the LOUD community.

We use the navigational mesh to divide a map into squares. These 'chunks' templates represent what an AI could populate (in terms of structures) in one of those squares.

image

We can then create templates that are similar to build templates that fit in exactly one of those squares. As an example:

image

Each of those squares represents a chunk. A chunk of an AI base. We can create many variations of each size of a chunk to make sure one base is unlike the other.

The idea is that the AI will claim additional chunks as it tries to build structures. This way the AI can expand the base and gain more ground.

We need chunks to prevent the AI from exhaustively searching for a place to build. An example are the current base templates. These are gigantic files with gigantic tables that the AI can use to find a build location that is 'nearby' of the intended build location. On average there will be a lot of negative tests before a valid build location is found.

@Garanas Garanas added the area: AI related to AI functions label Nov 4, 2023
@Garanas Garanas added this to the Development iteration V milestone Nov 4, 2023
@Garanas
Copy link
Member Author

Garanas commented Nov 4, 2023

As an example output of a chunk at this moment:

{	
  Faction = UEF, 	
  Size = 32, 	
  BuildAreas = { 	
    { { -6.50, -8.50 }, { -6.50, -10.50 }, { -6.50, -9.50 }, { -2.50, -10.50 }, { -4.50, -10.50 }, { -3.50, -10.50 }, { -5.50, -10.50 }, { -2.50, -8.50 }, { -2.50, -9.50 }, { 1.50, -8.50 }, { 1.50, -9.50 }, { 1.50, -10.50 }, { 3.50, -10.50 }, { 5.50, 13.50 }, { -3.50, 13.50 }, { -4.50, 14.50 }, { -4.50, 13.50 }, { -2.50, 14.50 }, { -3.50, 14.50 }, { -2.50, 13.50 }, { 4.50, 14.50 }, { 4.50, 13.50 }, { 5.50, 14.50 }, { 6.50, 13.50 }, { 6.50, 14.50 }, { 2.50, -10.50 }, { 5.50, -10.50 }, { 4.50, -10.50 }, { 5.50, -9.50 }, { 5.50, -8.50 }, { -0.50, 3.50 }, { 0.50, 3.50 }, { -2.50, -6.50 }, { -2.50, -7.50 }, { 1.50, -6.50 }, { 1.50, -7.50 },  }, 	
    { { 10.50, -2.50 }, { 12.50, -2.50 }, { 14.50, -2.50 }, { -5.50, 7.50 }, { -5.50, 11.50 }, { -4.50, -8.50 }, { 3.50, -8.50 }, { -0.50, -6.50 }, { 3.50, -6.50 }, { -4.50, -6.50 }, { 8.50, -2.50 }, { 5.50, -4.50 }, { 5.50, -0.50 }, { 5.50, -2.50 }, { -0.50, 1.50 }, { 0.50, 5.50 }, { -5.50, 9.50 }, { 10.50, -4.50 }, { 14.50, -4.50 }, { 8.50, -4.50 }, { -8.50, -2.50 }, { -12.50, -2.50 }, { -10.50, -2.50 }, { -14.50, -2.50 }, { -12.50, -4.50 }, { -10.50, -4.50 }, { -8.50, -4.50 }, { -14.50, -4.50 }, { 12.50, -4.50 },  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
    { { -4.50, -2.50 }, { 4.50, 9.50 }, { -1.50, 9.50 }, { -4.50, 3.50 }, { 1.50, -2.50 }, { 4.50, 3.50 },  }, 	
    {  }, 	
    { { -11.50, 10.50 }, { -11.50, 2.50 }, { -11.50, -9.50 }, { 11.50, 2.50 }, { 11.50, -9.50 }, { 11.50, 10.50 },  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
    {  }, 	
  }, 	
} 	

Which is the chunk on the top right of the image of chunks

@BlackYps
Copy link
Contributor

BlackYps commented Nov 4, 2023

Very nice! How will the ai deal with the fact that a random location in the chunk can be occupied by mexes?

@Garanas
Copy link
Member Author

Garanas commented Nov 4, 2023

Ideally there will be a way to 'break up' an area. As an example: a 8x8 factory can be 'divided' using a chunk of size 8. This can be useful when the build area is blocked (slope, resources, etc)

Of course that logic doesn't exist yet at this moment 😃

@Garanas Garanas marked this pull request as ready for review December 24, 2023 15:50
@Garanas Garanas merged commit 0983272 into deploy/fafdevelop Dec 24, 2023
2 checks passed
@Garanas Garanas deleted the ai/chunk-templates branch December 24, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: AI related to AI functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants