Lua and Dev-C++

Started by
24 comments, last by jbadams 13 years, 11 months ago
Quote:Original post by overeasy
and now for some actual lua related questions:

should my xml map parser be in lua or c++?

are there any other libraries that would make the production of a full game easier?

i'm using c++, haaf's game engine, and lua.

do any sort of database languages make sense to use?
i'm not looking to do any networking any time soon (plus every complains that networked games should be built from the ground up FOR networking).


bump
Advertisement
Quote:i'd use visual c++ if i was creating a windows app - instead i'm using a game engine library.
That doesn't really make sense as a reason not to use VC++. You can create pretty much any kind of application you want (and use pretty much any engine or library you want) with VC++.
Quote:Original post by overeasy
should my xml map parser be in lua or c++?


If you're going to have Lua, don't even bother with XML.
Lua was actually designed partially as a data description language, and is very nice for this purpose. I would go so far as to say that Lua is superior to XML for non-document data.

Just as an example of how to do this, consider a map for a text adventure type game:
In XML:
<map name = "twistymaze">  <room>    <description>you are in a maze of twisty little passages, all alike.</description>  </room>  <room>    <description>you are in a twisty little maze of passages, all alike.</description>  </room></map>


In Lua:
twistymaze = map{  room{description = "you are in a maze of twisty little passages, all alike."},  room{description = "you are in a twisty little maze of passages, all alike."}}


The Idea is that you make your data file as a lua program that constructs whatever data you need as tables and so on. Note that 'map' and 'room' are functions that might do some processing on the tables they are given, like error checking, etc.

The book 'Programming In Lua' is a good read, and will give you more info on this idea. The old one is available on-line free, the new one you can buy (They arent much different, only buy if serious).
Quote:Original post by apefish
Quote:Original post by overeasy
should my xml map parser be in lua or c++?


If you're going to have Lua, don't even bother with XML.
Lua was actually designed partially as a data description language, and is very nice for this purpose. I would go so far as to say that Lua is superior to XML for non-document data.

Just as an example of how to do this, consider a map for a text adventure type game:
In XML:
<map name = "twistymaze">  <room>    <description>you are in a maze of twisty little passages, all alike.</description>  </room>  <room>    <description>you are in a twisty little maze of passages, all alike.</description>  </room></map>


In Lua:
twistymaze = map{  room{description = "you are in a maze of twisty little passages, all alike."},  room{description = "you are in a twisty little maze of passages, all alike."}}


The Idea is that you make your data file as a lua program that constructs whatever data you need as tables and so on. Note that 'map' and 'room' are functions that might do some processing on the tables they are given, like error checking, etc.

The book 'Programming In Lua' is a good read, and will give you more info on this idea. The old one is available on-line free, the new one you can buy (They arent much different, only buy if serious).


I agree this is a clean solution for the game data, but what about raw map files? IE

0,1,0,2
1,5,2,6
0,1,2,3
5,1,2,3

This is where I was planning on using XML (the implementation was trivial in java)
Quote:Original post by overeasy

I agree this is a clean solution for the game data, but what about raw map files? IE

0,1,0,2
1,5,2,6
0,1,2,3
5,1,2,3

This is where I was planning on using XML (the implementation was trivial in java)


Is this some output from another program? ie. are you bound to use comma separated values (CSV) syntax for some reason? If so, that's not XML syntax any more than it is Lua syntax. If you have a bunch of data in that form, you can use sed or something to turn it into a friendlier format.

For a raw rectangle array map file, i would do:
map = {  {0,1,0,2},  {1,5,2,6},  {0,1,2,3},  {5,1,2,3},}

which can then be indexed like map[row][column]. eg map[2][3]==2

Note that all I did was cut and paste that thing and put braces around it.
Quote:Original post by overeasy
i used eclipse for java but dev-c++ looked like the beginner standard.

It was, many years ago. By now, it's just horribly outdated. I've found an article that explains it a little more in depth. Hope that helps.

Quote:Original post by overeasy
no microsoft products please.

I hope that's not because of some antipathy towards Microsoft (that sentence looks like that), because you'd miss a really excellent tool just because it is made by the "wrong" company.
Code:Blocks is the "new" Dev-C++. As the article states: Dev-C++ is no longer being maintained. If you want to work with the same IDE on multiple platforms, go with Code:Blocks.
Actually, wxDev-C++ is the new Dev-C++. It looks like it's still only for windows.
Quote:Original post by overeasy
Quote:Original post by Promit
Eclipse also has C++ support. Not sure how the CDT is nowadays, but it can't possibly be a worse choice than Dev-C++. Though frankly it's a pretty blockheaded idea to use anything other than VS on Windows unless you really can't.


except for refactoring, i don't need the additional functionality. maybe eventually, but i am happy as is. i have lua confirmed working and can proceed with my coding. i'd use visual c++ if i was creating a windows app - instead i'm using a game engine library.


Except when you do need the extra functionality you wont know where to start with Visual Studio because you will have never used it before.

Also I have news for you, if your planning on releasing your game on Windows you are creating a windows app.
Quote:Original post by apefish
Quote:Original post by overeasy

I agree this is a clean solution for the game data, but what about raw map files? IE

0,1,0,2
1,5,2,6
0,1,2,3
5,1,2,3

This is where I was planning on using XML (the implementation was trivial in java)


Is this some output from another program? ie. are you bound to use comma separated values (CSV) syntax for some reason? If so, that's not XML syntax any more than it is Lua syntax. If you have a bunch of data in that form, you can use sed or something to turn it into a friendlier format.

For a raw rectangle array map file, i would do:
map = {  {0,1,0,2},  {1,5,2,6},  {0,1,2,3},  {5,1,2,3},}

which can then be indexed like map[row][column]. eg map[2][3]==2

Note that all I did was cut and paste that thing and put braces around it.


Alright. I'm writing from the ground up again so I don't have any data format that I need to preserve. You're right, I guess I might as well use Lua for the maps too.

This topic is closed to new replies.

Advertisement