Forums

OverviewV-Play 2 Support (Qt 5) › Storage Options!

Tagged: , , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #9597

    Matt

    Got a question regarding storage, I’m working on a game which stores quite a lot of data
    it’s not huge in terms of MB (it’s somewhere between 2MB and 10MB) but it’s text data that needs to be stored and accessed easily/quickly.
    The format is quite simple (key/value pairs) but there are 10’s of thousands of them (maybe even 100’s of thousands).

    I initially had it in QML files as arrays (when it was smaller volume) but now that its getting bigger it is getting slower and is causing the app to crash (or fail to build/run).

    So, any suggestions on what would be the best way to do this?
    JSON files?
    SQL DB? (seems that we have to create and populate this on first use?)
    or should I keep it offline as service calls? (which wouldn’t be great as the app would always need connection, but maybe that’s not such an issue?).

    • This topic was modified 3 years, 4 months ago.
    #9603

    Christian
    V-Play Team

    Hi Matt,

    I’d recommend using JSON files and then parse them with JSON.parse(). You can read a file with the (yet undocumented) fileUtils context property like this:

    var dataString = fileUtils.readFile(Qt.resolvedUrl("../assets/data/yourfile.json"))
    
    var dataJson = JSON.parse(dataString)
    

    If you can split up the files into several ones, this would improve the performance a bit more.

    Cheers, Chris

    #10028

    Alec

    Christian,

     

    Is there a reason the fileUtils remains undocumented. It would be useful for me but if it’s likely to be buggy or not supported across Android and iOS, i’ll find another solution.

    #10029

    Günther
    V-Play Team

    Hi alb,

    we did not yet update the fileUtils to be 100% compatible and tested with our current engine version. So there might be features within fileUtils that won’t work as you would expect.

    I recently used the fileUtils simply for listing the images in the assets directory, which worked fine for me on android phone and iOs tablet. You may try using the fileUtils, but I recommend to especially test what you do first – to make sure everything is ok.

    Cheers,

    GT

     

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support