Stupid Fraking Programming

Stupid Fraking Programming

Post just about everything that isn't directly related to Spring here!

Moderator: Moderators

Post Reply
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Stupid Fraking Programming

Post 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!!!
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post 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.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post 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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I think sometzimes you have to omit the lib part.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post 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.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Post 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.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

and if you really really have to use XML, use tinyxml.
User avatar
Erom
Posts: 1115
Joined: 25 Apr 2006, 05:08

Post by Erom »

+a lot, xml is almost always the worst choice.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post 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.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post 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.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

well, I see your points. I think I'll probably try flat text files for my first version at least.
Post Reply

Return to “Off Topic Discussion”