Re: game development question:reading and writing game data to and from files

  • From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 13 Jul 2009 14:20:13 -0600

what are you saying? we know .net does. he's talking about c/c++

----- Original Message ----- From: "black ares" <matematicianu2003@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, July 13, 2009 1:56 PM
Subject: Re: game development question:reading and writing game data to and from files


java and dotnet has serialization.
More over dotnet implements the xml serialization concept.
Also there are a lot of libraries about xml binding.


----- Original Message ----- From: "Bill Cox" <waywardgeek@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, July 13, 2009 3:31 PM
Subject: Re: game development question:reading and writing game data to and from files


In my DataDraw based system, if I want to save or load a
mysqldump-like version of my data, it's 1 line of code.  It's similar
if I prefer a binary dump.

The fact that C++, Java, and other languages don't have this simple
feature blows me away.  How hard is it to auto-traverse your data and
print it to a file, and to load that same file later?  I'm amazed at
the waste of effort and time programmers spend on this automatible
task.

Anyway, for the vast majority of programmers without such simple
solutions available, here's what I recommend.  Print your data to a
file.  If flex/bison is too complex, then use fscanf.  It's really
that simple.  Extra credit if you make your save file a list of
commands that recreate your data when executed.

Bill

On Mon, Jul 13, 2009 at 1:45 AM, black
ares<matematicianu2003@xxxxxxxxxxx> wrote:
it sounds some how as an over engineered system.

----- Original Message ----- From: "Bill Cox" <waywardgeek@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, July 12, 2009 10:39 PM
Subject: Re: game development question:reading and writing game data to and
from files


So long as we're talking about some more esoteric stuff, I'll go ahead
and describe how I actually deal with saving data. However, be
warned, it will make your brain hurt.

I do a semi-object-oriented style of C, based on a database code
generator I maintain at datadraw.sf.net. It keeps all the data
in-memory rather than on disk, and has an interface somewhat like
mysql, but with speed that's faster than plain C. When I want to
save, I have the database manager write out an ASCII database, similar
to what you get with mysqldump. As users take actions that modify the
database, I log the commands that modified it to a log file, so to get
to the current state, I load the ASCII database, and replay the log
file. If I wanted all this automated, I'd use a persistent DataDraw
database, but I prefer the version where I replay commands from the
log file.

I would recommend you don't do what I do. It's way cooler and more
efficient and easier in the long run to deal with than a Mysql
database, but then again, I wrote the DataDraw tool, and am the
leading expert in it's use.

For multiple users interacting with a server, I use a simple tool I
wrote called Command Serialiser, at comserial.sf.net. It allows
front-end tools (typically in PHP for web pages) to connect in a way
similar to mysql. My back-end engine reads commands from it one at a
time, so it can be single threaded, and uses a simple console style
command interface. The overall architecture, I feel, is far more
secure, many times faster, and easier to write and maintain than
typical LAMP applications. However, LAMP runs the world. My system
currently runs only one web site, and learning it will turn you into
an alien.

On Sun, Jul 12, 2009 at 3:16 PM, black
ares<matematicianu2003@xxxxxxxxxxx> wrote:

xml files is all he needs.

----- Original Message ----- From: "Rui Batista"
<ruiandrebatista@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, July 12, 2009 9:17 PM
Subject: Re: game development question:reading and writing game data to
and
from files


Why don't you use DBM files or sqlite or something?

Flex/bison/parsing-almost-from-scratch stuff is better to do things more
complex then that, like programming languages, complex configuration
files, Etc... You are just saving data I think.

Just my to cents.

Best regards,

Rui Batista
Dom, 2009-07-12 às 10:50 -0600, Tyler Littlefield escreveu:

I like that idea. Do you have any good resources for bison? I've tried a
few
times and never managed to understand how it works all that well.

----- Original Message ----- From: "Bill Cox" <waywardgeek@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, July 12, 2009 10:48 AM
Subject: Re: game development question:reading and writing game data to
and
from files


In general, for complex databases, I prefer to write custom
reader/writers using bison/flex. An ASCII file that mirrors your
classes well has many advantages. You can edit it easily, and it's
fairly simple to maintain backwards compatibility with previous
versions.

Bill

On Sun, Jul 12, 2009 at 12:39 PM, Tyler Littlefield<tyler@xxxxxxxxxxxxx>
wrote:
> hmm, so I would store the pointer to an int/string/double.
> I need to be able to tell what it is though, no?
>
> ----- Original Message ----- From: "Sina Bahram" <sbahram@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Sunday, July 12, 2009 10:36 AM
> Subject: RE: game development question:reading and writing game data > >
> to
> and
> from files
>
>
>> The map definitely handles this bro.
>>
>> Just don't make it a map of primative to primative, make it a map >> of
>> primative to object. That object can be of any type you like.
>>
>> Take care,
>> Sina
>>
>> ________________________________
>>
>> From: programmingblind-bounce@xxxxxxxxxxxxx
>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Tyler
>> Littlefield
>> Sent: Sunday, July 12, 2009 12:18 PM
>> To: programmingblind@xxxxxxxxxxxxx
>> Subject: game development question:reading and writing game data to
>> >> >>
>> and
>> from
>> files
>>
>>
>> Hello all,
>> I've started work on a custom mud, and am trying to figure >> something
>> >> out.
>> Each player will have a set of keys that will be stored, name, >>
>> connect
>> time,
>> creation time, etc.
>> I was thinking of storing these in a map, but that requires that >> the
>> >> map
>> hold multiple values; something which the c++ map doesn't do.
>> So, I'm trying to figure something out.
>> I'd like to be able to store player data, and a list of the >> player's
>> inventory so the objects can be recreated when the player connects
>> somehow.
>> I would need to store object type, name, etc etc.
>> I'm not quite sure how I could achieve this easily; I could >> possibly >> itterate through the map once I've gotten the data type thing >> figured
>> >> out
>> and do something like write key=value.
>> Then when I loaded it I could just strtok on the = and set that up,
>> >> >>
>> but
>> I'm
>> not quite sure how I'd handle inventory and that.
>> This is the only snag I'm having so far, and I'm not able to move >> on
>> without
>> it, as I'm to the point where I need to start saving player data, >> so
>> >> help
>> would be really appriciated at this point. :)
>> Thanks,
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Rui Batista
E-mail/googletalk: ruiandrebatista (at) gmail (dot) com
MSN/WLM: ruiandrebatista (at) hotmail (dot) com (don't send mail to this
on)
Skype: ruiandrebatista
twitter: http://twitter.com/ragb
weblog: http://outputstream.wordpress.com

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: