How do I save json state family? How not to unload graphics from memory?

  • Hi! Sorry for a few questions at once, just really need an answer)

    We are a team are now developing an idle game, we have different clients (30 pieces), these are different sprites, as they open as the game progresses, all clients are added to the family, it is necessary to save state when moving to another level.

    I save each instance of the families to the JSON array, then when I come back, I go through the array, create a family instance and load JSON and make errors, because the wrong sprite may be created (for example, a man was needed, and a man was created and the man’s parameters were loaded) you have to separate all clients and record them separately, and then download them separately, is it possible to make it somehow easier?

    The second question is that preloading of images has now appeared in C3, this is excellent, it simplifies downloading, but what to do if there is a restaurant layout, whose images in the debugger occupy 250mb and there is a store layout on which several objects need to switch quickly between layouts (less than 1 second so that it is pleasant to the user's eyes), is it possible not to unload images from memory?

    There was an option to duplicate sprites on other layouts, is this a good idea?

    The third question - is it possible to make parallel work of layouts?

    The game has a hall layout and a kitchen layout; it is necessary that they work in parallel.

    Now just objects are on the same layout, switching simply by moving the camera (scrollx), this is not very convenient when developing, given that you can’t center objects that are not in the layout area, but also inconvenience in the number of layers and that they cannot be divided into groups .

    Any tips?

    For any information, links to useful articles, etc. I will be very grateful! :)

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • JSON: As I understand, your mistake is that you are creating a family instance, and it creates a random family member. You need to create specific object instances.

    To do this you need to also save object names in the array, you can get them with Family.ObjectTypeName expression. Then, when you restore these objects, use "Create object (by name)" action.

    Memory issue: I actually made a very similar post yesterday. I guess adding objects to all layouts is the only way to keep them in memory..

  • Yes, in the case of a family instance it really turned out to be easy, thanks.

    In the case of placing images on each layout, it takes a lot of memory, in the debugger it is shown that 300 megabytes of images are used, while this is only a draft project.

    In the end, there may be 3 times more graphics and I am very worried about the performance on a mobile device, and especially about reloading the application when it was minimized and reopened.

    Ashley Could you please say whether this is a normal load.

    We are developing a game in the "idle" genre and we have a lot of improvements.

    For example, there is a furnace, which has 5 different improvements, now it is one sprite with five animations and it turns out that only 1 animation out of 5 is needed, what is the best way to proceed? Perhaps it is worth creating 5 separate sprites and merging them into a family, and already while loading a level - creating the necessary object? This imposes some inconvenience.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)