Loading/reading JSON file during gameplay: Right or wrong?

I’m prototyping a game which involves a number of different scenes. The scenes switch during gameplay. Now as soon as one scene ends, I want to parse a JSON file ( e.g. level2.json) to read the settings for that level. There will be between 20 to 100 lines of settings.

Is this going to stall the performance of the game, or would a file this small be fast enough to load and parse, without giving any hiccups?

I’d like to hear your thoughts. [import]uid: 86582 topic_id: 31435 reply_id: 331435[/import]

If it’s on the device, should be no problem - 10 millisecond type delay.

If you’re going to download it, you’ll get a hiccup - a big one on a cell connection (transmit the request, server processes, server transmits reply). The cell transmission time up and down will insert a second or more of pause…

Otherwise, if you have a bunch of graphics to load for the new scene, I’d guess that would take more time to process… [import]uid: 79933 topic_id: 31435 reply_id: 125634[/import]

Thanks, mpappas! The data will be stored on the device. I really like JSON and have been using it in web environments so often that I can’t live without it :slight_smile:

The number of graphics are limited, really. A lot of graphics will be re-used. I’ll store those in a table to cache them to prevent any hiccups. Since the graphics are small and not too many of them, this shouldn’t give it a performance hit. At least, I think. [import]uid: 86582 topic_id: 31435 reply_id: 125643[/import]

If it’s on the device, should be no problem - 10 millisecond type delay.

If you’re going to download it, you’ll get a hiccup - a big one on a cell connection (transmit the request, server processes, server transmits reply). The cell transmission time up and down will insert a second or more of pause…

Otherwise, if you have a bunch of graphics to load for the new scene, I’d guess that would take more time to process… [import]uid: 79933 topic_id: 31435 reply_id: 125634[/import]

Thanks, mpappas! The data will be stored on the device. I really like JSON and have been using it in web environments so often that I can’t live without it :slight_smile:

The number of graphics are limited, really. A lot of graphics will be re-used. I’ll store those in a table to cache them to prevent any hiccups. Since the graphics are small and not too many of them, this shouldn’t give it a performance hit. At least, I think. [import]uid: 86582 topic_id: 31435 reply_id: 125643[/import]

A little late response, as I’ve just continued working on the prototype. I chose to go with lua metatables to hold the data that I need. It should be a lot faster since it will be compiled, whereas json files need to be parsed during runtime.

Correct me if I’m wrong, though! Just thought I’d share in case anybody else was wondering the same. [import]uid: 86582 topic_id: 31435 reply_id: 126517[/import]

A little late response, as I’ve just continued working on the prototype. I chose to go with lua metatables to hold the data that I need. It should be a lot faster since it will be compiled, whereas json files need to be parsed during runtime.

Correct me if I’m wrong, though! Just thought I’d share in case anybody else was wondering the same. [import]uid: 86582 topic_id: 31435 reply_id: 126517[/import]