joonspk-research / generative_agents

Generative Agents: Interactive Simulacra of Human Behavior
Apache License 2.0
15.95k stars 2.03k forks source link

How to generate a CSV file for tiled? #157

Open a416297338 opened 1 month ago

a416297338 commented 1 month ago

The CSV file located in the directory environment\frontend_server\static_dirs\assets\the_ville\matrix is used to assist in building the map. The "id" in this CSV file uses the "firstgid" from the .tmx file. I would like to know if the CSV file under "maze" is automatically generated, and whether the CSV file under "special_blocks" is handwritten after manual observation. If not, how were they created?

wy12yw commented 1 month ago

I also want to know the answer to this question, can you please solve it

navindu-ds commented 3 weeks ago

I also have some doubts to clarify on this matter. But let me give some ideas from what I understood.

As far as I understood, the environment image is rendered using the Tiled software, and the source file for the environment can be found at environment\frontend_server\static_dirs\assets\the_ville\visuals\the_ville.tmx. When attempting to export the .tmx file to the CSV format to be saved under the folder environment\frontend_server\static_dirs\assets\the_ville\matrix, there are 2 discrepancies identified between the CSV files exported by the Tiled software and the CSV files available in the frontend folder.

1. Difference in number of CSV files generated & used

The number of CSV files exported from Tiled was much higher compared to the five maze CSV files and five block CSV files in the repository.

The figure 1 shows the list of the fifteen CSV files exported from Tiled Software Fig1 - List of CSV files exported from Tiled Software

The figure 2 shows the list of the five CSV files used by the Generative Agents repository Fig2 - List of CSV files used by the Generative Agents repository

2. Difference in content in the CSV files

The content format of the CSV files differs as well. The provided CSV files in the repository predominantly contain 0's, while the files I generated contain -1's. It is assumed the predominant 0's or -1's represents the empty cells in the given layer.

The figure 3 shows the CSV exported from Tiled with mostly -1's Fig3 -CSV file obtained from the exported Tiled Software

The figure 4 shows the CSV file available on the repo for the collision_matrix.csv filled with 0's instead Fig4 - CSV file available on the Generative Agents repository - collision_matrix

Conclusion

This discrepancy leads to believe that an additional process was applied to the CSV files during the export process, which is not indicated in the source code. It would be great if the authors (@joonspk-research) could provide some insight or documentation on any additional steps or transformations performed in this case.

Kmaffitt commented 2 weeks ago

I was thinking of making a new map and was left wondering the same thing.

from maze.py: ` # Loading the maze. The mazes are taken directly from the json exports of

Tiled maps. They should be in csv format. `

I exported the tiled project as json and grabbed the data array value from the Collisions object. After conversion to a single line and replacing all non 0 non 32125 values with 32125 it was identical to the included collision_matrix.csv. I have not yet compared the other included environment csv's and json export values but I imagine it's a similar story.

pkmnjourney commented 1 week ago

I was thinking of making a new map and was left wondering the same thing.

from maze.py: # Loading the maze. The mazes are taken directly from the json exports of # Tiled maps. They should be in csv format.

I exported the tiled project as json and grabbed the data array value from the Collisions object. After conversion to a single line and replacing all non 0 non 32125 values with 32125 it was identical to the included collision_matrix.csv. I have not yet compared the other included environment csv's and json export values but I imagine it's a similar story.

I have done the same and was able to get the characters behaving correctly within the new map. However, visually, it still shows the previous map. Were you able to get around that?