Author Topic: How does a world file work?  (Read 2387 times)

Offline Martyn van Buren

  • Hero Member
  • *****
  • Posts: 642
How does a world file work?
« on: October 12, 2011, 12:37:44 am »
So I'm wondering if someone can explain how the world file works, or more specifically what parts of it we should upload for different types of bug reports.  Especially with the game in beta, we're putting a lot of world files into Mantis, and I'm wondering if I can save time and space by just uploading a few sub-files instead of the whole package for some kinds of bug reports?

For instance, if I have an issue with a building missing doors, is it enough if I just upload the relevant region?  And how would I identify it ---- would it be safe to assume that if I've quit while in the region it's the most recently updated region file?

If I have a spell not working properly, could I just upload the file that contains my inventory (which one would that be, if so?)?

Anyway, a guide to this would be useful; my world file is getting kinda big as I keep exploring.

Offline c4sc4

  • Sr. Member
  • ****
  • Posts: 253
Re: How does a world file work?
« Reply #1 on: October 12, 2011, 12:57:04 am »
For the missing door one, you would need the region folder, the regions.dat file and the world.dat file. You can find out what the region number is by hitting F3, near the bottom of the pop-up it will tell you the region number.

« Last Edit: October 12, 2011, 01:16:53 am by c4sc4 »

Offline tigersfan

  • Arcen Games Contractor
  • Arcen Staff
  • Master Member Mark II
  • *****
  • Posts: 1,599
Re: How does a world file work?
« Reply #2 on: October 12, 2011, 06:19:28 am »
For the missing door one, please tell me you haven't run into that in .522, I'm hoping we fixed that one.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: How does a world file work?
« Reply #3 on: October 12, 2011, 08:42:20 am »
World files (which are really a folder) are pretty straightforward overall.  They have three key components:

world.dat (central information index about the world itself)
regions.dat (central information index about the regions in the world)
Region folders (numbered 1-n, each with various other files in them for region details, chunk details, and so on)

In order to play a world at all, all we really need is the world.dat and regions.dat file.  That will give us the world map, but none of the actual contents of any of the regions.  So REALLY, since most bugs occur in a region, we also need the region folder corresponding to that region.

Presuming that the bug is localized in one specific region (generally a specific chunk within that region, even), we really don't need any of the other region folders beyond the one you are in.  If you hit F3 while you are playing, that shows you the ID of both the region and the chunk you are in.  I'd advise not trying to delete other chunks within the region (that could get messy), but making a copy of your world folder and then deleting all the region folders except for the one matching your current region's ID makes for a nice and compact world folder that you can zip and upload.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BobTheJanitor

  • Master Member Mark II
  • *****
  • Posts: 1,689
Re: How does a world file work?
« Reply #4 on: October 12, 2011, 09:20:31 am »
Would it be a lot of trouble to make a 'save only this region' command for bug reporting purposes? You could have it spit out a special save with just the files that you need. Telling people to just press F8, or whatever it might be bound to, and then to upload that save will be a lot faster than trying to explain that process each time.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: How does a world file work?
« Reply #5 on: October 12, 2011, 09:23:10 am »
Yeah, that's been something I've wanted to do for a while, actually.  I should probably do it sooner than later, I guess, but I'd been hoping to actually have the game zip them itself, which was a more complex thing to have it do.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline orzelek

  • Hero Member Mark III
  • *****
  • Posts: 1,096
Re: How does a world file work?
« Reply #6 on: October 12, 2011, 12:05:27 pm »
I have noticed one thing with world files. They fragment heavily. When doing defrag on disk quite significant chunk of fragmented files was coming from world directory.
Do chunk files or region files grow somehow?
It seemed for me that quite many files had 2 parts - like first one would be written first and then it would be extended at some point later which caused it to fragment.
« Last Edit: October 12, 2011, 12:07:55 pm by orzelek »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: How does a world file work?
« Reply #7 on: October 12, 2011, 12:18:11 pm »
I have noticed one thing with world files. They fragment heavily. When doing defrag on disk quite significant chunk of fragmented files was coming from world directory.
Do chunk files or region files grow somehow?
It seemed for me that quite many files had 2 parts - like first one would be written first and then it would be extended at some point later which caused it to fragment.

Yes, they would tend to grow, same as an AI War file would grow.  When you first enter a chunk, there are whatever entities in there.  When you play more, monsters spawn, loot drops, you put in platforms, and so forth.  They wouldn't grow enormously, but they would grow a little.  AI War savegames would tend to grow vastly more than anything here.

Region files, on the other hand, would grow a lot more like AI War files.  Each time you go into a new building, or a new cavern system, large bits of new data get added, and so on.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline zebramatt

  • Master Member Mark II
  • *****
  • Posts: 1,574
Re: How does a world file work?
« Reply #8 on: October 12, 2011, 12:48:29 pm »
Yeah, that's been something I've wanted to do for a while, actually.  I should probably do it sooner than later, I guess, but I'd been hoping to actually have the game zip them itself, which was a more complex thing to have it do.

I was going to suggest this, with zipping, but then I thought it was encouraging laziness for what's probably a nontrivial change.

Of course, once I got to thinking about it, I thought it would be good if the game separated the region, zipped it, logged onto Mantis, created a new report, prompted for a subject and description, then uploaded the file and saved the issue.

Then, surely, it would be relatively trivial to write an AI in the game to scan those reports, vet them for severity and priority, identify the problematic area of codebase, implement a fix, include it in a new release, update the software and test it.

The next step obviously would be for the game to then play itself until it came across another such issue - or had a useful suggestion which would improve its experience - and reiterate as above.

 ;)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: How does a world file work?
« Reply #9 on: October 12, 2011, 01:00:36 pm »
 :)
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Nalgas

  • Hero Member
  • *****
  • Posts: 680
Re: How does a world file work?
« Reply #10 on: October 12, 2011, 05:08:55 pm »
The next step obviously would be for the game to then play itself until it came across another such issue - or had a useful suggestion which would improve its experience - and reiterate as above.

Is it too late to retcon the origin story for AI War?

Offline Martyn van Buren

  • Hero Member
  • *****
  • Posts: 642
Re: How does a world file work?
« Reply #11 on: October 14, 2011, 02:10:09 am »
For the missing door one, please tell me you haven't run into that in .522, I'm hoping we fixed that one.

No, don't worry, I haven't seen that one since .522!  Just an example.

And thanks for that!  I wouldn't have figured that out alone.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: How does a world file work?
« Reply #12 on: October 15, 2011, 09:20:26 am »
The next step obviously would be for the game to then play itself until it came across another such issue - or had a useful suggestion which would improve its experience - and reiterate as above.

Is it too late to retcon the origin story for AI War?
I think said story is suitably vague to allow for that to be added in without a retcon ;)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!