Login
User Name:

Password:



Register

Forgot your password?
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
I3 and IMC
Dec 8, 2024 6:35 pm
By Remcon
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
LOP 1.5
Author: Remcon
Submitted by: Remcon
Users Online
DotBot, AhrefsBot

Members: 0
Guests: 56
Stats
Files
Topics
Posts
Members
Newest Member
494
3,808
19,707
588
Mortrex

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » General » General Discussions » Key'd area format
Forum Rules | Mark all | Recent Posts

Key'd area format
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 21, 2013 10:09 am   
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

 
Good Morning,

I am just wondering how people like the key'd area format. I know I could add it, by changing area version, making backups of my files first, and then putting in all the changes.

If you didn't have key'd area format now, would you do it again? I mean I know it makes the files easier to read, but when your used to them as they are would it still be something you would do again?

I am thinking of doing it, because upping area version anyway to add something for objects.

Post is unread #2 Sep 21, 2013 11:52 am   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005

 
Well it does make adding stuff in the files manually easier also, same for removing it.

Post is unread #3 Sep 22, 2013 8:41 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
If you're adding such a thing from scratch, I'd suggest looking into JSON.

You can easily just use one of the man JSON libraries out there to handle reading and writing objects in that format, it's easy enough to edit by hand if you like, and it gets rid of the ugly code involved in reading files now.

Post is unread #4 Sep 22, 2013 8:22 pm   
Go to the top of the page
Go to the bottom of the page

Guest - (Unregistered)

 

Thanks for the suggestion, I never heard about JSON, but I will look at it now.

I will likely not do a full key'd conversion, but just somethings that are easily mistaken on what they are in the file, namely integers.

Post is unread #5 Sep 23, 2013 12:48 am   
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

 
Just as a note... C sucks for having self-documenting data types, but if you're willing to spend a little extra memory, you can still use a serialization library and not have to maintain seperate read/write code.

If your data structure looks like:

struct {
    int foo;
    int bar;
    int pfft[2];
    char *ack;
} thingy;


A serializer (like JSON) will output something like (for example):

{ 3, 8182, [ 23, 90 ], "some element" }


This can be read or written, usually with a single line of code (the library will handle allocations). Nice. But, of course, the file itself has no hints about what each thing actually is.

You can waste a bit of memory to add documentation elements:

struct {
    const char *fdoc = "Foo is the user's hit points\nBar is their breath stink level\nPfft is their money in gold and silver\nAck is their name";
    int foo;
    int bar;
    int pfft[2];
    char *ack;
} thingy;


Since most Dikurivatives use bitflags all over the place (because they used to run on machines with 4M of RAM), you could also redo the code to expand all of those into first-class elements That, however, is a fairly tedius exercise since you have to find all the nasty bits of code that do stuff like if(bitflags & (BIT_FOO | BIT_BAR)) and change them to be like if(thing.foo || thing.bar).

Pages:<< prev 1 next >>