#Asset Folder Structure

6 messages Β· Page 1 of 1 (latest)

tulip slate
#

Note: This post isn't really "code review" but I wasn't sure where else to post it πŸ˜…

I have two asset folder structures in mind, and I can't decide between the two since its mostly just preference (although there are a couple pros/cons of each).

I know this is mostly subjective but just out of curiosity, which one (or if you have your own structure) does everyone recommend/prefer (and if there is a reason, why)?

assets/[file type]/[specific category]

assets/
β”œβ”€β”€ animation/
β”‚   β”œβ”€β”€ player/
β”‚   β”‚   β”œβ”€β”€ base.player.anim.ron
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ enemie/
β”‚   β”‚   β”œβ”€β”€ base.enemy.anim.ron
β”‚   β”‚   └── ...
β”‚   └── ...
β”œβ”€β”€ texture/
β”‚   β”œβ”€β”€ player/
β”‚   β”‚   β”œβ”€β”€ base.png
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ enemy/
β”‚   β”‚   β”œβ”€β”€ base.png
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ level/
β”‚   β”‚   β”œβ”€β”€ level1_background.png
β”‚   β”‚   └── ...
β”‚   └── ...
β”œβ”€β”€ scene/
β”‚   β”œβ”€β”€ level/
β”‚   β”‚   β”œβ”€β”€ level1.ron
β”‚   β”‚   β”œβ”€β”€ level2.ron
β”‚   β”‚   └── ...
β”‚   └── ...
└── ...```

Or

assets/[specific category]/[file type]

assets/
β”œβ”€β”€ player/
β”‚ β”œβ”€β”€ animation/
β”‚ β”‚ β”œβ”€β”€ base.player.anim.ron
β”‚ β”‚ └── ...
β”‚ β”œβ”€β”€ texture/
β”‚ β”‚ β”œβ”€β”€ base.png
β”‚ β”‚ └── ...
β”‚ └── ...
β”œβ”€β”€ enemy/
β”‚ β”œβ”€β”€ animation/
β”‚ β”‚ β”œβ”€β”€ base.enemy.anim.ron
β”‚ β”‚ └── ...
β”‚ β”œβ”€β”€ texture/
β”‚ β”‚ β”œβ”€β”€ base.png
β”‚ β”‚ └── ...
β”‚ └── ...
β”œβ”€β”€ level/
β”‚ β”œβ”€β”€ scene/
β”‚ β”‚ β”œβ”€β”€ level1.ron
β”‚ β”‚ └── ...
β”‚ β”œβ”€β”€ texture/
β”‚ β”‚ β”œβ”€β”€ level1_background.png
β”‚ β”‚ └── ...
β”‚ └── ...
└── ...```

kind zenith
#

I think the second one is better simply because if for example i wanted to change something about a player, i could just look in one folder which contains everything about them

tulip slate
feral junco
#

I think the first is better because it generalizes the asset types by putting them as the first subdirectory, limiting the number of folders you need. Additionally if you wanted to do something say animation, you probably want to see which of your entities have an animation asset with relative ease, rather than checking all the folders to see if an entity has an animation or not. It’s kinda like what ecs tries to solve: instead of going through each entity in the scene and seeing if it has a certain component, go through all the components of a specific type. Also (this step is up to you), if you go with the first file structure, you may not want to have additional indirection i.e. instead of

assets/textures/player/base.png

Do

assets/textures/player.png

It flattens out your directory tree and makes it simpler. This really only applies if you’re using sprite sheets on a 2d game where you only have one asset per entity texture

#

(I didn’t realize the post was this old πŸ˜…)

tulip slate