Register

How to format save/map files

Discuss issues related to the fx-9860G Software Development Kit
Junior Member
Posts: 12
Joined: Fri May 11, 2012 1:25 am
Location: US
Calculators: Casio fx-9860GII

How to format save/map files

Postby Xadiant » Sat Oct 06, 2012 1:56 am

Hello, I am very new to the SDK... I am at the skill level of knowing C language somewhat well and am able to make a very simple game of PONG on the fx-9860.

In the past I have always stored map data in arrays and was done with it... but everybody says that is a bad idea and it does seem to take a lot of space and perform slowly... How should I store such data? What is an easy way to store data that requires minimal work to call up again?

Thanks :DDD

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: How to format save/map files

Postby SimonLothar » Sat Oct 06, 2012 7:37 am

The use of arrays is not necessarily a bad idea. It depends on the kind of data, you want to store or process.
How are the map data, you want to save/restore, organized? Do they have a fixed length?
Possibly arrays of fixed size may consume more space than necessary. Dynamically allocated arrays could be more efficient.
Are the arrays simple screen-bitmaps, which have to be moved from one memory location to another, only?
Or are they arrays of structures, which specify each objects' properties like type and coordinate, f. i.?
I'll be back!

Junior Member
Posts: 12
Joined: Fri May 11, 2012 1:25 am
Location: US
Calculators: Casio fx-9860GII

Re: How to format save/map files

Postby Xadiant » Fri Oct 12, 2012 8:53 pm

For my first project I want to make a top-down game much like Pokemon where objects can be specified with x,y, and a number for what the id of the object is. A 2-dimensional array seems easiest because all I need tehn is to specify the object id and x/y is what field it has been stored in.

I am also playing around with the idea of a map that is expandable in any direction and is virtually unlimited... that has a few issues with storing value on an array.

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: How to format save/map files

Postby SimonLothar » Sat Oct 13, 2012 9:58 am

Xadiant wrote:For my first project I want to make a top-down game much like Pokemon where objects can be specified with x,y, and a number for what the id of the object is. A 2-dimensional array seems easiest because all I need tehn is to specify the object id and x/y is what field it has been stored in.

I am also playing around with the idea of a map that is expandable in any direction and is virtually unlimited... that has a few issues with storing value on an array.

A two dimesional array, where the array's indexes represent the coordinates, would be a waste indeed. And it would depend on the display's resolution. Above that, if you want some of the objects to move around, it would not be possible to control the object's movement in a realistic manner.
You should use an array of a structure instead. The structure would contain the coordinates x and y and the object's id and perhaps other object-specific information (like health, actual speed f. i.). And if you want to have it as flexible as possible, you have to establish the arrays dynamically (malloc, realloc, free).
I'll be back!

Junior Member
Posts: 12
Joined: Fri May 11, 2012 1:25 am
Location: US
Calculators: Casio fx-9860GII

Re: How to format save/map files

Postby Xadiant » Sat Oct 13, 2012 5:27 pm

Cool, I was researching dynamically allocating arrays before you posted. If I were too build an array as you said how would I efficiently search this massive array for specific objects or objects that are In a specific x, y range?

Thanks for answering my questions by the way! I just cannot find other examples of people doing this.

Senior Member
Posts: 369
Joined: Tue Jan 03, 2012 11:24 pm
Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400

Re: How to format save/map files

Postby helder7 » Sat Oct 13, 2012 8:02 pm

For the map, the easiest way is to use the program "Tiles Creator" by Kristaba from Planet-Casio.

Below a sample "pokemon map demo":
Image

This tool seems to be quite flexible and practical. Can be used to create for example a RPG like game.

Documentation can be found here: http://tilescreator.calctools.fr/doc/ (but is only available in french)

Is possible export generated maps to casio fx9860 SDK.

BTW: you can get some sprites here
SiO2 + CaCO3 ----------> CaSiO3 + CO2

Junior Member
Posts: 12
Joined: Fri May 11, 2012 1:25 am
Location: US
Calculators: Casio fx-9860GII

Re: How to format save/map files

Postby Xadiant » Sat Oct 13, 2012 10:38 pm

I was actually planning on writing up the tale based builder directly in my program so that I can pass my calc to my friends in class and have them make a map for me to play.

What type of format does it save in?

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: How to format save/map files

Postby SimonLothar » Sun Oct 14, 2012 2:26 pm

Xadiant wrote:...If I were too build an array as you said how would I efficiently search this massive array for specific objects or objects that are In a specific x, y range?


Code: Select all
// a structure, which implements every object's property, which is needed.
typedef struct{
   int x;
   int y;
   int id;
   // possibly more properties like speed, color, shape a. s. o.
} TObject;

#define CountOfObjects 100
// CountOfObjects could be as well a variable, so the program can react dynamically

//
void ProcessObjectArrayByID( void ){
// declare a pointer to an ObjectArray
TObject*ObjectArray;
int i;
// grab memory
   ObjectArray = (TObject*)malloc( sizeof( TObject )*CountOfObjects );
   
// loop through array and decide by id (as well you could decide by x or y or both)
   for ( i = 0; i < CountOfObjects; i++ ){
      switch ( ObjectArray[i].id ){
         case 1 :
            break;
         case 2 :
            break;
      }
   }
   
// finally release the memory!
   free( ObjectArray );
}

/*
Of course it is possible to define different ObjectArray-types, f. i. TMovingObjects and TStaticObjects.
And it would come in handy to use C++ to implement a genuine object-oriented approach.
*/
I'll be back!

Junior Member
Posts: 12
Joined: Fri May 11, 2012 1:25 am
Location: US
Calculators: Casio fx-9860GII

Re: How to format save/map files

Postby Xadiant » Sun Oct 14, 2012 10:08 pm

Hey, thanks man! I am getting a lot more of an idea of how to approach this type of project. Ill get back to this topic once I have something working (Or hit a wall).

Return to Casio fx-9860 SDK

Who is online

Users browsing this forum: Google [Bot] and 6 guests