The Daily Click ::. Forums ::. Klik Coding Help ::. Saving/Loading Help (Array)
 

Post Reply  Post Oekaki 
 

Posted By Message

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
29th May, 2012 at 29/05/2012 14:42:25 -

I'm in the process of attempting to make my Sim City - styled game save/load. I've decided to use the array object to do this as suggested by people in these forums. I had previously had NO experience using this object so please forgive my lack of understanding

I'm using the method I learnt in the World Editor tutorial found here: http://www.castles-of-britain.com/mmfexamples-w.htm

I implemented this into my game and I've noticed a big difference in the time it takes to save and load my game and the time it takes in the example file. The actual array files differ in size pretty dramatically also and I can not work out why?

Here is my file in case someone wants to take a look at it: http://www.craigeatscrayons.com/SaveTest.mfa

Another thing I need to do is save/load each objects alterable values a,b&c. I'm not entirely sure how to go about doing that so any help would be very much appreciated!

 

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
29th May, 2012 at 29/05/2012 16:35:03 -

I don't have MMF2 to hand at the moment but one thing i would check is your array dimensions first.

I assume you left them as default when you put the array object into your application. The problem with this is that MMF2 will fill up every single slot of your array when saving it.

To change this simply change the dimensions in the array properties to just what you need.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
29th May, 2012 at 29/05/2012 17:01:13 -

You need to use the buildings' grid coordinates, not their screen coordinates.
The way you're doing it, you'll need a massive 960 x 480 array, when you should only need a 7 x 7 array (in other words, about 9400 times the size it should be).
If you don't want to do the maths yourself, there's always the "Isometric Grid" extension that will convert between screen and isometric grid coordinates.

 
n/a

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
30th May, 2012 at 30/05/2012 06:56:27 -

Oh dear, things have certainly gotten a lot more complicated since the old Klik n' Play days...

Thanks for the replies, guys.

Unfortunately I want to release this on iOS devices so I only have a handful of extentions I can use and I don't think the isometric grid object is one of them.

So do I set the grid coordinates in the Array objects properties or do I set these with an event in the event editor?
By the sounds of things I can not just enter the dimensions of the tile 128X64, and I have to work out some crazy calculation? Because if that IS the case, I am pretty much screwed.

 

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
30th May, 2012 at 30/05/2012 15:49:34 -

The calculations aren't that crazy - they're pretty simple actually:

http://skydrive.live.com/redir?resid=B1E7EE094271BBDA!529

Grid -> Screen
X_Screen = X_Origin + (X_Grid * Tile_Width * 0.5) - (Y_Grid * Tile_Width * 0.5)
Y_Screen = Y_Origin + (X_Grid * Tile_Height) + (Y_Grid * Tile_Height)

Screen -> Grid
X_Grid = Round((Y_Screen - Y_Origin) / Tile_Height + (X_Screen - X_Origin) / Tile_Width)
Y_Grid = Round((Y_Screen - Y_Origin) / Tile_Height - (X_Screen - X_Origin) / Tile_Width)

 
n/a

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
3rd June, 2012 at 03/06/2012 11:06:35 -

Thanks heaps Sketchy! I think I've finally figured this out. I appreciate all your help.

 
   

Post Reply



 



Advertisement

Worth A Click