User Tag List

Results 1 to 6 of 6

Thread: saving and loading grid co-ordinates at runtime

  1. #1
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    saving and loading grid co-ordinates at runtime

    OK, I have a grid based game and what I want to do is save the co-ordinates of some cells in a list/array/ini/whatever, (think of it as a queue file). Then I want to start a loop which runs through the list, reads the grid coordinates and does an action.

    Lets say for example i have a 10x10 grid, and I have a square brush 3x3 grid cells in size, covering the grid from cell 5,5 to 7,7. I want to save these cells into the queue list.
    It should look something like this:

    x pos,y pos
    5,5
    5,6
    5,7
    6,5
    6,6
    6,7
    7,5
    7,6
    7,7

    Once all grid coordinates have been added, a loop will start which reads the number of lines in the file and starts the loop that many times. In this case, the loop will start 9 times. On each loop, it will do some actions to the cells read from that line number.

    Loop 1 - Do actions to cell 5,5
    Loop 2 - Do actions to cell 5,6
    etc

    At the moment I am using the ini++ file with two groups named 'x' and 'y', and saving the position under each group, howver I know there is an easier way.

    I am looking for the easiest and fastest method of doing this, as my grid is much larger than 10x10 cells and the values will be added/read/deleted many times per second.

  2. #2
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jul 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: saving and loading grid co-ordinates at runtime

    Quote Originally Posted by bigredron
    OK, I have a grid based game and what I want to do is save the co-ordinates of some cells in a list/array/ini/whatever, (think of it as a queue file). Then I want to start a loop which runs through the list, reads the grid coordinates and does an action.

    Lets say for example i have a 10x10 grid, and I have a square brush 3x3 grid cells in size, covering the grid from cell 5,5 to 7,7. I want to save these cells into the queue list.
    It should look something like this:

    x pos,y pos
    5,5
    5,6
    5,7
    6,5
    6,6
    6,7
    7,5
    7,6
    7,7

    Once all grid coordinates have been added, a loop will start which reads the number of lines in the file and starts the loop that many times. In this case, the loop will start 9 times. On each loop, it will do some actions to the cells read from that line number.

    Loop 1 - Do actions to cell 5,5
    Loop 2 - Do actions to cell 5,6
    etc

    At the moment I am using the ini++ file with two groups named 'x' and 'y', and saving the position under each group, howver I know there is an easier way.

    I am looking for the easiest and fastest method of doing this, as my grid is much larger than 10x10 cells and the values will be added/read/deleted many times per second.
    I would just use an array. It works in runtime without saving to a file (which I'm assuming that's what ini++ does, as I haven't used it, just the regular ini object which is purely for saving values to a file). Using one of the array object extensions for MMF2 would be far better as you can read/write from memory, not a file. But it also allows you the option of saving the array as a file if you wish, so you can retrieve these values from a file if needed.

  3. #3
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: saving and loading grid co-ordinates at runtime

    Shawn - The ini++ file doesnt save the file to disk unless u specify it too, just like the array file. It can store information in memory.

    And I have thought about using an array file, however I already have a few other arrays storing important map information and I want to avoid using another one if possible. I am sure there is another method.

  4. #4
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jul 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: saving and loading grid co-ordinates at runtime

    Quote Originally Posted by bigredron
    Shawn - The ini++ file doesnt save the file to disk unless u specify it too, just like the array file. It can store information in memory.

    And I have thought about using an array file, however I already have a few other arrays storing important map information and I want to avoid using another one if possible. I am sure there is another method.
    My bad then. I was only familiar with the regular ini object. I don't have an answer to this one. Hopefully someone else does.

  5. #5
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: saving and loading grid co-ordinates at runtime

    Its all good now. I used the MagicDeque object. This object is working absolutely beautifully and has helped me reducing the number of fastloops and actually works a lot faster than my previous method.

    Thanks for your suggestion anyway.

  6. #6
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jul 2006
    Location
    USA
    Posts
    2,970
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: saving and loading grid co-ordinates at runtime

    Quote Originally Posted by bigredron
    Its all good now. I used the MagicDeque object. This object is working absolutely beautifully and has helped me reducing the number of fastloops and actually works a lot faster than my previous method.

    Thanks for your suggestion anyway.
    Thanks for posting your solution. I'll have to take a look at this object myself

Similar Threads

  1. Snapping to a grid in runtime
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 17th April 2012, 01:18 AM
  2. Saving and Loading on iOS
    By Bruto in forum iOS Export Module Version 2.0
    Replies: 15
    Last Post: 17th May 2011, 09:38 AM
  3. Saving and loading
    By FlyingDeath in forum The Games Factory 2 - Technical Support
    Replies: 0
    Last Post: 4th August 2008, 04:16 AM
  4. saving and loading
    By bunnyonion in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 30th July 2008, 08:49 PM
  5. Saving/Loading from INI help
    By Bruto in forum File Archive
    Replies: 4
    Last Post: 3rd January 2008, 09:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •