Donate Now Goal amount for this month: 100 USD, Received: 0 USD (0%)
Donate to support this site and ThinBASIC project development

Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Storing massive amounts of data in INI files

  1. #11
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    33
    Posts
    222
    Blog Entries
    2
    Rep Power
    29
    Quote Originally Posted by Michael Clease View Post
    Where did I say the size of the file would speed it up ?
    I guess your comment about reducing bashing made me think speed.

    you say "The data and format will vary across the board: numbers and strings, long and short, precise (floating point) and integer."

    but will this data be same for each record?
    The way I picture it now (which could change) is that there might be a certain number of variables that need to be saved ... say anywhere from 25 to 1000 or more depending on the complexity of the game.

    That will be for just one iteration of the game. I want to be able to keep track of the decisions you make in the game so each set of variables will be needed in an archival mode.

    Opening a file for "random" could work, I suppose. The player wouldn't need to save the entire file to memory. If you play the game long enough, you may not have enough ram to do that (for a really complex version of the game). In archival mode, the player could simply reopen the file and get the needed data.

    Does this make sense?



    Mark

  2. #12
    thinBasic MVPs Michael Clease's Avatar
    Join Date
    May 2007
    Posts
    1,414
    Blog Entries
    1
    Rep Power
    149
    Not really.

    I just dont have enough information about what your are trying to do.

    Its like saying "I want to build a house" then not telling me what materials to build the house from, I can keep guessing but no surprises I wont.

    Mike
    Why is the world full of nobs trying to push my buttons!!

    Home Desktop : WinXP Pro SP3 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : WinXP Pro SP3 - Intel Pentium 4 - 3 Ghz - 512 MB - ATI Mobile Radeon 7000 IGP
    Work Desktop : WinXP Pro SP3 - Intel core 2 Quad Q8200 - 2.33 Ghz - 2 Gb - Quadro Fx 370

  3. #13
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    33
    Posts
    222
    Blog Entries
    2
    Rep Power
    29

    I don't think this is about INI files anymore ...

    I just dont have enough information about what your are trying to do.
    Well, I could give you more info on the game, but I think that might just confuse you.

    So, how about a small code example of what I just described to get started.

    Type tRecord
      a     As Byte
      b     As Byte
      c     As Byte
      d     As Integer
      e     As Integer
      f     As Integer
      g     As Integer
      h     As Integer
      i     As Integer
      j     As Integer
      k     As Integer
      l     As DWord
      m     As DWord
      n     As DWord
      o     As DWord
      p     As DWord
      q     As DWord
      r     As DWord
      s     As DWord
      t     As DWord
      u     As DWord
      v     As DWord
      w     As DWord
      x     As DWord
      y     As DWord
      z     As DWord
      aa    As Extended
      bb    As Extended
      cc    As Extended
      dd    As String
      ee    As String
      ff    As String
      gg    As String
      hh    As String
      ii    As Currency
      jj    As Currency
      kk    As Currency
      ll    As Currency
      mm    As Double
      nn    As Double
      oo    As Double
      pp    As Double
      qq    As Double
      rr    As Double
      ss    As Double
      tt    As Double
    End Type
    
    Okay, now ... a little bit more about my game idea.

    Now, there would be a limitless amount of these records. It would just depend on how long you play the game. Each turn of the game would be one record, and if you liked the game, and it was challenging and engaging, you could easily advance the game a thousand times or more.

    It is a simulation city builder, sort of like sim city without the graphics. The closest that comes to it now is a game on Facebook called Metropolis. Of course, as I always dream big, I would want it to be bigger than that. Who knows if I will get there! Probably not, but trying is half the fun.




    Mark

  4. #14
    thinBasic MVPs Michael Clease's Avatar
    Join Date
    May 2007
    Posts
    1,414
    Blog Entries
    1
    Rep Power
    149
    I do think your over estimating the size of the data, try this.

    Type tRecord
      a     As Byte
      b     As Byte
      c     As Byte
      d     As Integer
      e     As Integer
      f     As Integer
      g     As Integer
      h     As Integer
      i     As Integer
      j     As Integer
      k     As Integer
      l     As DWord
      m     As DWord
      n     As DWord
      o     As DWord
      p     As DWord
      q     As DWord
      r     As DWord
      s     As DWord
      t     As DWord
      u     As DWord
      v     As DWord
      w     As DWord
      x     As DWord
      y     As DWord
      z     As DWord
      aa    As Extended
      bb    As Extended
      cc    As Extended
      dd    As String
      ee    As String
      ff    As String
      gg    As String
      hh    As String
      ii    As Currency
      jj    As Currency
      kk    As Currency
      ll    As Currency
      mm    As Double
      nn    As Double
      oo    As Double
      pp    As Double
      qq    As Double
      rr    As Double
      ss    As Double
      tt    As Double
    End Type
    
    
    Dim FileBuffer As String
    Dim FileName   As String = APP_ScriptPath + "file.ini"
    Dim sMsg       As String
    Dim FirstValue As Byte
    
      FileBuffer = String$(SizeOf(tRecord)*1, 64)  
    
    '   This must be called after filling the buffer or you can use REDIM
    Dim MyRecord(1) As tRecord At StrPtr(FileBuffer)
    
      sMsg  = "Record size *1         = " + Str$( SizeOf(tRecord)*1         )+" bytes"+$CRLF
      sMsg += "Record size *100     = " + Str$( SizeOf(tRecord)*100/1024  )+" kbytes"+$CRLF
      sMsg += "Record size *1000   = " + Str$( SizeOf(tRecord)*1000/1024 )+" kbytes"+$CRLF
      sMsg += "Record size *10000 = " + Str$( SizeOf(tRecord)*10000/1024 )+" kbytes"+$CRLF
     
     MsgBox 0, sMsg
    
    Dont forget you are in control of the data so if you keep a thousand records in memory and then dump them all to a file and start a new set you can.

    This is one of the challenges in writing that sort of game, I would search for examples how other people have organised the internal usage of memory.
    Why is the world full of nobs trying to push my buttons!!

    Home Desktop : WinXP Pro SP3 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : WinXP Pro SP3 - Intel Pentium 4 - 3 Ghz - 512 MB - ATI Mobile Radeon 7000 IGP
    Work Desktop : WinXP Pro SP3 - Intel core 2 Quad Q8200 - 2.33 Ghz - 2 Gb - Quadro Fx 370

  5. #15
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    33
    Posts
    222
    Blog Entries
    2
    Rep Power
    29
    Quote Originally Posted by Michael Clease View Post
    I do think your over estimating the size of the data, try this.
    Perhaps. The problem I foresee is that the data could be large if you play the game long enough. Of course, I could program a limit so that nothing gets larger than what I dim it for.


    Dont forget you are in control of the data so if you keep a thousand records in memory and then dump them all to a file and start a new set you can.
    I don't see why I would need to keep everything in memory at one time, so worrying about the size and speed of the game may be moot in the end anyway. More experimentation is needed.

    This is one of the challenges in writing that sort of game, I would search for examples how other people have organised the internal usage of memory.
    Could you point me in the right direction here? I'm not familiar with this type of thing and/or resource.



    Mark

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Storing not allows
    By peter in forum General
    Replies: 15
    Last Post: 13-10-2008, 21:08

Bookmarks

Posting Permissions

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