School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,485 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,774 people online right now. Registration is fast and FREE... Join Now!




Map File

 

Map File, ini vs xml

e_barroga

22 Jun, 2009 - 09:18 AM
Post #1

D.I.C Regular
Group Icon

Joined: 16 Feb, 2009
Posts: 435



Thanked: 23 times
Dream Kudos: 825
My Contributions
Not sure which one to use.

Right now I'm using an ini file.

There's a "Settings" section for general info such as map size.

Then each instance is its own section, starting from 0. The instance's attributes are in keys.

User is offlineProfile CardPM
+Quote Post


Tom9729

RE: Map File

22 Jun, 2009 - 11:22 AM
Post #2

Debian ninja
Group Icon

Joined: 30 Dec, 2007
Posts: 2,129



Thanked: 53 times
Dream Kudos: 425
My Contributions
It depends what you need.

For anything simple I would probably take ini over XML.

Parsing XML is more difficult than parsing ini, and XML files generally take up more room on disk, but XML lets you easily do things like nest element inside each other.

Edit: Could you post an example of what you're using now?

This post has been edited by Tom9729: 22 Jun, 2009 - 11:23 AM
User is offlineProfile CardPM
+Quote Post

e_barroga

RE: Map File

22 Jun, 2009 - 12:00 PM
Post #3

D.I.C Regular
Group Icon

Joined: 16 Feb, 2009
Posts: 435



Thanked: 23 times
Dream Kudos: 825
My Contributions
Here's the format for accounts:
QUOTE

[Account]
Name=Test
Password=test
X=507
Y=545
Z=0
Online=0
Currency=0
[s1]
Item=1
Quanity=5
[s3]
Item=1
Quanity=5
[s5]
Item=1
Quanity=5
[s7]
Item=1
Quanity=5
[s9]
Item=1
Quanity=5
[s11]
Item=1
Quanity=5
[s13]
Item=1
Quanity=5
[s15]
Item=1
Quanity=5
[s17]
Item=1
Quanity=5
[s19]
Item=1
Quanity=5
[s21]
Item=1
Quanity=5
[s23]
Item=1
Quanity=5




Here is the format for map files:
QUOTE

[Settings]
W=799
H=599
BG1=-1
BG2=-1
StartX=0
StartY=0
DeathX=0
DeathY=0
DeathZ=0
[0]
X=41
Y=495
Depth=8
Sprite=1
Image=5
Angle=35
Solid=0
ScaleX=1
ScaleY=1
Alpha=1

//....SNIP

[71]
X=63
Y=510
Depth=6
Sprite=1
Image=10
Angle=0
Solid=0
ScaleX=3.10
ScaleY=3.10
Alpha=1

User is offlineProfile CardPM
+Quote Post

Tom9729

RE: Map File

22 Jun, 2009 - 12:08 PM
Post #4

Debian ninja
Group Icon

Joined: 30 Dec, 2007
Posts: 2,129



Thanked: 53 times
Dream Kudos: 425
My Contributions
Well you could do something like this. I think it would be especially helpful if you have multiple accounts per file.

xml

<account name="Test" password="test" x="507" y="545" z="0" online="false" currency="0">
<inventory>
<slot item="1" quantity="5" />
<slot item="2" quantity="1" />
<slot item="3" quantity="2" />
<slot item="4" quantity="6" />
</inventory>
</account>


But if the way you're doing it now works alright I would just stick with that. "If it ain't broke, don't fix it!" smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:06AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month