File path rules

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
gnombat
Posts: 706
Joined: June 10th, 2010, 8:49 pm

Re: File path rules

Post by gnombat »

Often you might be able to get an idea of what the "best practice" conventions are by looking at the source code for mainline campaigns. For example, in the latest stable version of Wesnoth (1.14.14), there is an images/attacks folder in Dead Water, Liberty, and Under the Burning Suns, so that is probably a good place to put attack icons.

Of course, there are some things that might not be found in mainline campaigns (e.g., I don't think any of them have anything like an animated title sequence), so you might need to invent your own convention in such cases.
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: File path rules

Post by octalot »

Helmet wrote: November 8th, 2020, 2:27 am What is the "best practices" folder structure?
There's a Wiki page for this: AddonStructure. It's not entirely in sync with Celtic Minstrel's answer, but will be updated soon.
User avatar
Celtic_Minstrel
Developer
Posts: 2211
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: File path rules

Post by Celtic_Minstrel »

Helmet wrote: November 8th, 2020, 2:15 pm I renamed my "sounds" folder to "audio",
Sorry, it looks like I got this one wrong. It should be "sounds" after all. I've also edited my previous post to correct it.
Helmet wrote: November 8th, 2020, 2:15 pm I'm not familiar with the term "terrain definitions." Is a definition that same as .cfg? I thought terrain.cfg and terrain_graphics go in Your_Addon/utils?
You can put them basically anywhere you want. If you have lots and lots of new terrains, having a dedicated folder for terrains might be a good idea. If you only have one or two, then there's no point.

Now that I think about it again, I don't think I've actually seen anyone actually use a "terrains" folder like that. Even mainline just dumps them into two files directly in the "core" folder. So, I guess that particular suggestion isn't one that many people have actually followed. I probably just got confused because the terrain images do always have a separate folder.
Helmet wrote: November 8th, 2020, 2:15 pm
Celtic_Minstrel wrote: November 8th, 2020, 7:47 am [*]Unit type definitions (as well as other other unit-related things such as races and movetypes) go in Your_Addon/units.
I have several custom attack icons, such as military_fork.png. I put them in Your_Addon/images/attacks. Should I use Your_Addon/images/icons instead?
I don't think it matters, but just for the record, mainline does put attack icons in an "attacks" folder.
Helmet wrote: November 8th, 2020, 2:15 pm I have the following folders within the images folder: halo, icons, items, portraits, projectiles, scenery, story. And I have a custom .png depicting a zoomed-in view of the Wesnoth map, which I put in Your_Addon/images/maps. Correct?
This seems pretty standard, I think. It doesn't matter as long as it makes sense to you, though. There is one weird thing that I'll mention a bit later, though.
Helmet wrote: November 8th, 2020, 2:15 pm I made an animated title 180 frames long for my campaign. I decided to put the frames in a folder call title in Your_Addon/images. I almost named the folder animation, so I could put other animated sequences in it. What would you do?
I'd probably make a folder called "animations" and move the "title" folder into that.
Helmet wrote: November 8th, 2020, 2:15 pm I have a lot of custom units, so my images folder now contains a lot of files (halo, icons, etc.). I kinda would like a folder that is only custom units. Is that a bad idea? If not, what would you call a folder containing nothing but custom unit images, and where would you place it?
You don't have a "units" folder in "images"? I think most add-ons that have more than one or two custom unit images do that, and the same goes for mainline. Some also have a subfolder under "units" for each unit, since once you animate them there can be quite a few files for each unit.
Helmet wrote: November 8th, 2020, 2:15 pm Lastly, would you define or describe a "cut-scene" in Wesnoth? I've heard the term used in at least two different ways, but I don't recall ever seeing a cut_scene folder. I have seen a movies folder, however.
A cutscene is anything that takes the player out of standard gameplay for some plot advancement. By this definition, any event that uses [message] is a cutscene, though typically you wouldn't call it cutscene unless there are a few messages in the same event. The story screen at the beginning of the scenario could also be called a cutscene, and you can also call the storyscreen mid-scenario. In addition to the common uses of storyscreen in mainline, this could probably be used to create visual novel style cutscenes set against a custom background (rather than showing over the map). I haven't seen this done, but I think it's possible at least in the upcoming 1.15 release.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: File path rules

Post by Helmet »

Thanks, octalot. Somehow I never came across that webpage. I was missing a "misc" folder.
The page also answered another question I had: What is textdomain for? (It's used for translations.)
Celtic_Minstrel wrote: November 8th, 2020, 10:19 pmI'd probably make a folder called "animations" and move the "title" folder into that.
I like that idea! I'll do that.
Celtic_Minstrel wrote: November 8th, 2020, 10:19 pm You don't have a "units" folder in "images"? I think most add-ons that have more than one or two custom unit images do that, and the same goes for mainline. Some also have a subfolder under "units" for each unit, since once you animate them there can be quite a few files for each unit.
No, I don't have a "unit" folder under images. When looking at other people's scenarios, I guess I overlooked that detail. Man, I am so glad I made this thread. My images folder was a disaster. I'll add a "units" folder in a minute.
Helmet wrote: November 8th, 2020, 2:15 pmA cutscene is anything that takes the player out of standard gameplay for some plot advancement. By this definition, any event that uses [message] is a cutscene, though typically you wouldn't call it cutscene unless there are a few messages in the same event. The story screen at the beginning of the scenario could also be called a cutscene, and you can also call the storyscreen mid-scenario.
Ohhhh. I thought "cutscene" might only apply to scenes with animation, like the beginning of "Bad Moon Rising." But it's actually a more versatile term. Thanks for explaining.
Celtic_Minstrel wrote: November 8th, 2020, 10:19 pmIn addition to the common uses of storyscreen in mainline, this could probably be used to create visual novel style cutscenes set against a custom background (rather than showing over the map). I haven't seen this done, but I think it's possible at least in the upcoming 1.15 release.
I'm looking forward to this.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Celtic_Minstrel
Developer
Posts: 2211
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: File path rules

Post by Celtic_Minstrel »

Helmet wrote: November 8th, 2020, 11:05 pm Somehow I never came across that webpage. I was missing a "misc" folder.
You don't really need a "misc" folder if you don't want one; and if you have a bunch of stuff that fits together, you can make whatever extra folders you want. For example, if I recall correctly, my add-on has an "overlays" directory because I use several "overlay" icons.
Helmet wrote: November 8th, 2020, 11:05 pm Ohhhh. I thought "cutscene" might only apply to scenes with animation, like the beginning of "Bad Moon Rising." But it's actually a more versatile term. Thanks for explaining.
Well, an actual animated movie would also count as a cutscene, though Wesnoth doesn't actually support that. You can probably kinda fake it with the unit animations system (maybe that's what BMR does?), but I think you'd have to severely limit the FPS to get decent performance… unit animations aren't built to use fullscreen images.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: File path rules

Post by Helmet »

Celtic_Minstrel wrote: November 9th, 2020, 12:10 amWell, an actual animated movie would also count as a cutscene, though Wesnoth doesn't actually support that. You can probably kinda fake it with the unit animations system (maybe that's what BMR does?), but I think you'd have to severely limit the FPS to get decent performance… unit animations aren't built to use fullscreen images.
That's what I did that with my animated title. It's actually an animated unit, where each frame is 800x600 pixels. I was inspired by the opening of inferno8's "To Lands Unknown," where his name appears and some lines moves. It's a workaround, but it works.

It would be great if WML allowed big animated scenes without a workaround. Maybe one day...
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Post Reply