Page 1 of 1

Stupid Fraking Programming

Posted: 04 Nov 2007, 05:25
by SinbadEV
I really want to try... and I understand that the way to do it these days if to use Free Open Source Libraries... so I got SDL... made pacman (sure the ghosts don't have an AI yet but pacman eats dots and doesn't walk through walls)... and so I was feeling pretty good, thought "hey", why not use XML to define graphics sets and maps... how hard can that be... but did I find a nice simple tutorial like This for libxml2? no I find
http://www.zlatkovic.com/libxml.en.html wrote:"If you plan to develop your own programme, in C, which uses libxml, then you should know what to do with the files in the binary package. If you don't know this, then please, please do some research on how to use a third-party library in a C programme. The topic belongs to the very basics and you will not be able to do much without that knowledge."
and I do know the basics... drop the .dll files into system32 and drop the lib files into the lib folder and drop the header files into the include folder... okay... and then I add the libraries to the Link tab for the project... like I did for SDL... and it compiles... but it doesn't link... it says it can't find -llibxml ... llibxml what? .dll? .h? .lib?

This is what drives me freaking crazy about programming... I can think logically... I can read documentation... but I can't figure out how to freaking link an example program!!!

Posted: 04 Nov 2007, 07:05
by Dragon45
i dont think i can help you with this problem, but i can say that oftentimes, massive amounts of trial and error can accomplish a great deal.

Posted: 04 Nov 2007, 07:22
by Pressure Line
Dragon45 wrote:i dont think i can help you with this problem, but i can say that oftentimes, massive amounts of trial and error can accomplish a great deal.
or drive you nuts.

Posted: 04 Nov 2007, 08:19
by KDR_11k
I think sometzimes you have to omit the lib part.

Posted: 04 Nov 2007, 13:46
by AF
imo xml isnt necessary and you may be trying to take a leap too far.

imo your next step should be to learn more OpenGL and start to branch into 3d stuff and other GL effects.

Posted: 04 Nov 2007, 14:22
by imbaczek
xml is almost always a perfect solution for the wrong problem. don't use it if you don't have to; use Lua or some other scripting language (Python, Ruby, Scheme are good choices) for customization of stuff.

Posted: 04 Nov 2007, 15:42
by TradeMark
omg i hate XML, one game uses it for map format, and when loading all 500 maps at startup, it takes like 80 seconds. >>____>>
If it was just binary, the filesize would be like 50 times smaller.

Posted: 04 Nov 2007, 16:26
by jcnossen
and if you really really have to use XML, use tinyxml.

Posted: 04 Nov 2007, 21:46
by Erom
+a lot, xml is almost always the worst choice.

Posted: 05 Nov 2007, 01:07
by SinbadEV
jcnossen wrote:and if you really really have to use XML, use tinyxml.
Thanks, that looks a LOT less painful

I'm only marginally attached to xml because A, the generic map editor I found uses it and it's human readable and has a nice standard to base it on... my xml will probably be
<spriteset>
<map width=28 height=31 >
<tile type="1" />
<tile type="1" />

etc...

I figure if I learn how to do XML now it would be useful for more complicated things... I don't understand what the problem people have with xml is... it's simple, while it has some bloat when it comes to tags etc... it's not that bad... and it has the advantage of looking like HTML.

Posted: 05 Nov 2007, 01:59
by imbaczek
SinbadEV wrote:I figure if I learn how to do XML now it would be useful for more complicated things... I don't understand what the problem people have with xml is... it's simple, while it has some bloat when it comes to tags etc... it's not that bad... and it has the advantage of looking like HTML.
XML is a hype. You point out several features of XML that you'd like to see as pros, but are really cons: it's complicated and it looks like HTML.

1. Any simple data format, like a 2D array (maps) or a list of strings (sprite lists) should be simple because they don't need to be complex.
2. It looks like HTML. What's wrong with that is that HTML was designed to be made and read by humans. XML - not so; XML was designed to be a portable data format, and while it works, it hardly works well. I'll take your example and present it in several superior (= simpler) formats:

Code: Select all

ex. 1 - Lua/Javascript/almost Python tables/dicts:
{ 'spriteset': {
    'map': {
        'size': {'width': 28, 'height:': 31},
        1, 1, ...
   }
}

Code: Select all

ex. 2 - Lisp/Scheme s-exprs:
(with-spriteset
  (map width 28 height 31 (list 1 1 1 ...))

Code: Select all

ex. 3 - flat text file
spriteset 28 31
1 1 ...
In examples 1 and 2 you get a scripting language for free and with much smaller footprint than any validating XML parser. Example 3 should be so simple that I'll let it defend itself.

Posted: 05 Nov 2007, 02:37
by SinbadEV
well, I see your points. I think I'll probably try flat text files for my first version at least.