file name problem

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

file name problem

Post by dougeff »

I just finished a project, and am about to work on another one...I wanted some input from some smart people.

I have a habit of separating my files by room. So the first room I made, I called all the associated files room01. tiled file, room 01. rle file, room 01. etc. And I had 25 rooms, all names like this. But I added 5 rooms after I made the boss room 25...So now it goes like 23,24,26,27,28,29,30,25.

which is annoying, but I wrote a little note to myself, in a readme file, but still confusing.

and I'm thinking of this other project, and I planned 100 rooms, and the order is 100% going to be heavily rearranged. I already have half of rooms files done and named 01,02,03,etc....So if I rearrange the rooms, I will either have to rename every file...possibly multiple times, or keep a (error prone) readme file, explaining any rearranging, or some 3rd option that eludes me.

and it's far worse than that. I have endless arrays of room data, that will be a nightmare to rearrange by hand.

If I had put them in some kind of excel spreadsheet, and export to csv, and wrote some program to auto-generate an included file that would have worked better. I'm not even sure how to rearrange an excel file easily.

Is there some convenient way of managing a large project like this? like even the naming issue. It won't make sense if the rooms go 23,02,17,29,53,etc. how do you even have a conversation about room 6 if all the files are called room 51?
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: file name problem

Post by Kasumi »

"Level 25" could be called "boss room", and you could create a txt file your export program loads to control the order at a really basic level. If you don't have a separate export step (you're including the files themselves, rather than including something created by a second program from the files themselves), all you need is that second step.

Inside levels.txt

Code: Select all

Introducing Bridges
Happy Hills
Rabbit Fight
Introducing Bridges would be the first level because it's the first line, Rabbit Fight would be the 3rd level because it's the third line.

If you needed to add two levels before Rabbit Fight, you'd just add their names before Rabbit Fight in that txt.
Inside levels.txt after revision

Code: Select all

Introducing Bridges
Happy Hills
Exploring Water
Into the Rabbit Hole
Rabbit Fight
Introducing Bridges would be the first level because it's the first line, Rabbit Fight would be the fifth level because it's the fifth line.

No existing levels would need to change or be renamed as you add or even rearrange levels, and there would be no confusion. As another step, you can put all the level files in a folder with the right name, but have a set name for every piece of data the level needs.

Introducing Bridges/rle.bin
Introducing Bridges/level.tiled
Introducing Bridges/levelpreview.png

Rabbit Fight/rle.bin
Rabbit Fight/level.tiled
Rabbit Fight/levelpreview.png

There are a few file formats that are basically named zip files with specific named files contained inside just like this. Pyxel Edit's .pyxel is one that comes to mind, as well as many openoffice formats. (Last I checked.)

Then to rename a level, you only need to change one thing's name. (The folder). You could even write a program that would load say... "levelpreview.png" from each folder in the txt, and then when you click and drag the levels around and save, a new txt is generated with that new order and no renaming takes place at all.

Edit: I guess in short: I'd give everything actual, memorable names (even if they don't appear in game) and let something else handle the ordering. I definitely suggest the folder thing if nothing else, so that if you do want to continue as you are (the names are numbered) you only have to rename one thing per level.

Irfanview's batch rename support can rename things by increasing index. So if you wanted to insert level 99 in between levels 2 and 3, you add levels 3-whatever to the list of files (removing level 99), start at named level 4 and you're done, except for renaming level 99 to level 3.

Edit: Removed spacetornado Renamer reference, if it can do the thing I can't find how in the docs.

If your levels will be linked (i.e. there's a door in level 3 that goes to level 99), you just use the actual "memorable" names and you'll almost never have problems regardless of how you reorder them.
Last edited by Kasumi on Thu Dec 21, 2017 12:28 am, edited 2 times in total.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: file name problem

Post by rainwarrior »

Yeah, I'd suggest the same thing. Name everything, and reference everything by lists of names.

Let your compilation tools worry about numbers.
User avatar
Bregalad
Posts: 8055
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: file name problem

Post by Bregalad »

Well, you could arrange rooms in groups of reasonable (humanly manageable) size, and name them like 101-120 for group 1, 201-213 for group 2, etc...

As for the arrangement of rooms how they are physically connected, you should just write it down somewhere and always update it when it changes.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: file name problem

Post by DRW »

I'll get into a similar situation with my new game where it scrolls screen-by-screen.

Each screen is defined by its own data array and then I have one array where all the screen arrays are referenced, so that you can access the screens by an index.

So, how do I call each separate screen variable?

Using a number would be problematic if I want to reorganize them and keep the order clean.

Naming each screen individually is bothersome. I don't want to find a name for 16 x 16 screens + dungeon rooms.

So, I will probably name each screen with a random letter combination, like gdjz, nbhe or bdfr. This way, the name is not tied to any actual position in the array and you can switch them around at will without the naming scheme getting screwed-up.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
never-obsolete
Posts: 411
Joined: Wed Sep 07, 2005 9:55 am
Location: Phoenix, AZ
Contact:

Re: file name problem

Post by never-obsolete »

I had the same problem and ended up having to draw myself a map with the room numbers. I have separate MapEd "projects" for each area. The only time I have to reference the numbers is when making connections between rooms.

A part of me wants the room numbers to be in a logical order, but at this point it's too tedious to try and manage it.
. That's just like, your opinion, man .
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: file name problem

Post by tokumaru »

In this situation, I'd probably draw the entire thing as if it was one single map, and let the encoder script take care of dividing the large map into rooms and encoding them all, creating all the necessary tables on the fly, so that the actual numbers don't matter to me (and might even be different each time the map is encoded).
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: file name problem

Post by Kasumi »

For the scrolling thing, you don't name the individual screens, they're just named automatically in the export step too. They don't have to be randomly named, they can be sequentially named. Because the idea behind any of this is you (the programmer) are not the one doing the naming anyway. So if something changes, the names change automatically, rather than being a thing you worry about.

So to state a bit more, I only recommended naming the levels because that's the easiest thing to add for his final use case. But you can avoid naming anything with good enough tools. (Need a door to connect to another door in another level? Click the 2 doors in the GUI you created and link them. The link is automatically updated when the levels change order or get renamed or anything else.)

I am working on levels. They will never change order.
I am working on levels, they need to change order. (Add a .txt with the names, so order can be changed without you having to think about it.)
I am working on a scrolling game, with many collections of screens in each individual level. (Make the exporter export the the screens named something like level0_screen0 so the names don't collide and you don't have to think about it.)
I am working on a scrolling game with many collections of levels that I want to place freely in some greater world map. (Make a map format that stores references to the levels. The exporter can export the levels freely, then the map freely so you don't have to think about it)

Whenever you have to think even a little about it, think about if your tools can be improved.

My tool here:
https://imgur.com/QCsImfw
Also seen here:
https://www.youtube.com/watch?v=2bJW64G_tHY
with like 78 levels.

It gives me data like this:

Code: Select all

bank00_meta128_00_0E3 = $A788;Blocksize: 328
bank00_meta32_02_00 = $A860
bank00_meta16_02_03 = $A795

bank00_meta128_00_0E7 = $A8D0;Blocksize: 17
bank00_meta128_00_13F = $A8D7

bank00_meta128_00_0E8 = $A8E1;Blocksize: 213
bank00_meta16_02_04 = $A8E9

bank00_meta128_00_0EB = $A9B6;Blocksize: 24
bank00_meta128_00_135 = $A9C1
And a giant binary blob that those labels are in reference too. And you'll notice there is 16x16 metatile data and 32x32 metatile data in the middle of what might be considered 128x128 metatile data. It's "random" because the data is stacked on top of similar things for compression, all automatically. Me changing a single tile anywhere could wildly change what gets exported, but the end result (what the player sees) will be the same, because the exporter is designed to deal with all of that. Even the order of my tilesets can change after being exported (it'll dedupe tiles, and strip unused tiles by shifting the stack down.)

I can delete levels, insert levels, change the size of levels, change the order of the tiles in the tilesets and I don't have to think about anything while doing it. There are some things I currently need to think about (arranging enemy sets so enemies outside the CHR for the level can't be placed), but even that could be handled automatically by doing the reverse. Creating the CHR sets based on the enemies in levels in the export step. I'll probably eventually do this.

Tools programming isn't always the most fun, but it's worth the time spent, I promise. One doesn't necessarily need to spend all the time writing an all in one tool like I've done, but definitely add new things whenever existing things are making you think about things you shouldn't be.
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: file name problem

Post by gauauu »

never-obsolete wrote:I had the same problem and ended up having to draw myself a map with the room numbers. I have separate MapEd "projects" for each area. The only time I have to reference the numbers is when making connections between rooms.

A part of me wants the room numbers to be in a logical order, but at this point it's too tedious to try and manage it.
I don't know what this is, but I want to play it.
Post Reply