2014-07-31 10:38:45

Hi,
Here is my problem.
I have a map class, with a 2 dimensional array of x and y coordinates.
It also has other properties, such as weather conditions and size.
I want to be able to read the properties from a file on disk, and initialise the class with these properties.
Anybody have any ideas?
Thanks,

Underworld Tech.
Accessibility from us, to you.
Visit us

2014-07-31 12:11:03

the serialize function is your friend.
Go look it up in reference/foundation layer/functions/serialization
Also read the serialization tutorial
You will love it

I like to sleep, Sleep is good,
This is how I do it: Lie on a nice warm cozy bed, and dream dreams about how to rule the world!
Follow @TheGreatAthlon5 on twitter for humorous facts and game updates!
If you like my posts, thumb me up!

2014-07-31 14:56:06

Hi,
I really don't love it. The reason I don't want to serialise is that I'm planning for people to be able to create maps themselves.
Danny gave me a re-event the wheel kind of solution, but I'm reluctant to try it.

Underworld Tech.
Accessibility from us, to you.
Visit us

2014-07-31 16:40:55

Hmmm. Do you have an array of classes? I have been thinking about this myself for something I want to create. Maybe devided all the data up by tabs or commas? You could have each class in the array be assign to its' own line in a file and have each peace of data in the array devided up by commas or tabs on the line assigned for the array. It could look like this. 2,2,cold,rain The numbers will be your x and y. HTH.

All that is gold does not glitter, Not all those who wander are lost; The old that is strong does not wither, Deep roots are not reached by the frost. From the ashes a fire shall be woken, A light from the shadows shall spring; Renewed shall be blade that was broken, The crownless again shall be king.
DropBox Referral

2014-07-31 16:46:54

Even if you want to allow people to create their own maps, you can use serializations by creating map buildor. Otherwise, you'll have to read a text file in which a certain format is defined.
The easiest way is to separate a file into sections. In the first section, you write numbers that will be directly put into the map array, and the second section should contain some additional parameters such as wether, conditions in PRM_NAME=value format or something like that.

I don't speak as good as I write, and I don't listen as good as I speak.