Is there any way to know that the object is "built and placed" on the scene?

Greetings,

I want to know if there is a method like scene: hide (event), which can make the object perform the next action after being on the scene.

When I create a large number of objects, there will be a situation where the delay is not smooth. At present, I can only do estimated reroute (build the next every few seconds).

Is there some more precise way that can be used(like listener), can be executed after the object appears on the scene?

Thank you.

  1. There is no onCreated event in Corona, but …

  2. Objects are visible the very next frame after you call the create function.

So, if you’re seeing delays, it means you’re making too many objects and/or doing something that is slowing down the entire process such that your frames are actually getting delayed.

Questions:

  • How many objects are you creating per batch?
  • How many use textures?
  • How big are the textures?
  • Are the textures in discrete files, one texture to one file, or are using tilesheets?
  • If you’re using textures in sheets,
    • How many sheets are you using in one batch?
    • How big are the sheets (resolution)?

I think you really need to work out why you are seeing delays between when creation code is executed and objects are displayed.

  1. The number of object used each scene is not necessarily (I will explain this below).

  2. The battle scene is about 1200MB. (Normally it will only be delayed here)

  3. The maximum texture of each image paper is 2048 * 2048.

4 and 5. I use image paper packed by Texture Packer. The number of paper is not necessarily but complex animated characters will need to use 10 sheets of 2048 * 2048 paper.

I now let him only create a maximum of 100MB per second, and it will not cause a delay, but I am not sure whether this is a reliable way.

In addition, I did not want to publish to old mobile phones.

The phone is at least iPhone 7 level.

But I am not sure how to calculate the performance of such a mobile phone.

Two routes to go here:

  1. CODE: run a test to see how many objects the current device can display in a certain period of time and use that to determine if the device is fast enough to satisfy your performance requirement.

  2. CHECK EXACTLY:
    system.getInfo(“manufacturer”) for an “Apple” result
    system.getInfo(“model”) for an “iPhone” or “iPad” result
    system.getInfo(“architectureInfo”) for more info to answer your question more precisely.

Here are some examples I grabed from my gamer database for architectureInfo for Apple made devices:
iPhone6,2
iPhone7,2
iPhone8,2
iPhone9,4
iPhone10,1
iPhone10,2
iPhone10,3
iPhone10,4
iPhone10,6
iPhone11,3
iPhone11,6
iPhone11,8
iPhone12,1
iPhone12,5

iPad2,5
iPad3,1
iPad4,2
iPad7,3
iPadi7,5

The point here is that for iPhone, you can grab the number between the “e” and the “,” (i.e. iPhone6,2 would give you the iPhone version of 6).

@troylyndon

Thank you very much for your comments, sorry to respond so late.

I have been trying to solve this problem.

I am now testing on a mobile device, my phone is (Asus Zenfone4)

The following is the problem I have encountered in the past few days

  1. After I run more than 1600MB on Corona Simulator, the rendering of the manufactured picture will become a black rectangle. I do n’t quite understand the reason why the simulator has to do this limitation. My PC has 16GB of RAM.

  2. When I do the test on my mobile phone, there is no such limitation, I tried to let him run an image with a higher value (2800MB) than I estimated, and the result is feasible.
    And no black rectangle appears, all the images are still high-quality 1080P.
    But when I turned off him and released the memory, I found a weird point that the phone only released less than 600MB of memory (less than many large games), but I checked the memory in the settings of the phone The maximum usage of the phone system is indeed 2800MB (the average usage is 163MB), and there is indeed no memory leak problem. The memory usage is quite low, which makes me confused. Why the actual consumption value is different from the release, but there is no leakage in the memory part ?

I would like to ask whether the high consumption of mobile phone memory during the game will affect the mobile phone?

The result I found seems to have only the option of power consumption.

  1. Your computer’s 16GB of RAM are inconsequential here. On your computer, texture memory related tasks are handled by your GPU. Once it runs out of memory, the subsequent display objects are rendered black. In other words, your game requires around 2GB of vRAM minimum (and that may not be enough if the OS or other tasks are using up RAM too).

  2. Mobile device RAM works differently. There is no GPU specific vRAM for texture memory. It’s all just one RAM. Depending on your Zenfore 4 model, it most likely has either 4GB or 6GB of RAM, which is enough. To my understanding, OpenGL textures are released when the app is suspended, which is why your memory usage goes down.

We’ve gone through this before, but here I go again:

You’ve said that there’s no way to reduce the size of your sprites or require any fewer of them, but without seeing the project, I just can’t believe that. As things are developing, you will find it difficult to distribute your game because it will not run on low to medium range computers or mobile devices. You need to load fewer and smaller sprites at a time.

1 Like

Haha, yes, we have talked about this issue many times.

I fixed some problems today, by changing the mode of operation to keep him within 2G.

I have seen that iphone6S is at least 2G, not to mention that Android is almost 3G or more (my cheap mobile phone 5 years ago (300 US dollars), also has 6GRAM)

In my survey, many games and even 3D games exceeded 3GB. The well-known Fortnite mobile phone version has more than 10 million users, and his texture memory exceeds 3GB. Obviously most people’s mobile phones can already handle such games.

I just don’t quite understand why the Corona Simulator has a 1.6G limit.

I really want to hurry and let everyone see.

Although I dare not say how good it is, but all are based on the 1080P standard, I even use many HDRP assets running in Unity. Achieve beautiful menu comparable to PC.

Incidentally, I have sliced many things into small pieces of sprites, no more than 2048 * 2048.

What GPU, i.e. graphics card do you have on your computer?

NVIDIA GeForce GTX 1060 6GB.

Although it was a product a few years ago, performance should be ok? :smile:

That should be more than enough.

Still, could you share a few screenshots of your game? It just seems like you are going about this in a weird fashion. For instance, if your texture memory usage is that high with sprites, then perhaps just use skeletal animations?

The movie should be easier to explain than screenshots.

For testing purposes, I only load the characters, and the problems appear like the black rectangles seen in the movie.

This problem only appears on the simulator.

(In order to upload smoothly, I only capture this block of the screen, and greatly compress the movie quality, please forgive me.)

Please tell me that those are not all frame by frame animated sprites with multiple sequences like idle, attack, hurt, move, use item, etc.?

When it comes to these type of animations, then you should definitely use skeletal animations. Take a look at Spine, they have Corona/Solar2D runtime available at https://github.com/EsotericSoftware/spine-runtimes/tree/3.8/spine-corona.

Sprites or frame by frame animations are simply not designed to be used for something like this.

Yes,I do use Spine, but I must tell you.

The total animation of each character you see is less than 50MB.

The main reason is special effects (they are hidden, so you ca n’t see them in the movie).

Special effects are not suitable for Spine. The special effects are very large. In order to create gorgeous effects, they occupy almost 95% of the texture memory. :joy:

Where is that video stored? I only see a white screen when I press play.

Nevermind… I ended up downloading to view it, so I assume it is stored on the site.

Question: If you edit the code showing those animations (comment out parts to play working animations), does the missing (black box) animation play?

i.e. Keep the demo the same, but comment out the working parts.

Less than 50MB of hard drive space or texture memory? What are the dimensions of your largest image sheets? What about the average image sheet’s dimensions?

Are these special effects part of the character sheets or are they on separate files? You could also take a look at using particles for (some) special effects.

They will not play, but the black frame will still exist.

The maximum is only 2048 * 2048, which will never exceed this specification. On average, there are too many files, and it is difficult for me to give a certain value.
Normally, 2048*2048 can wrap all the actions of a character.
If I use Spine actions, it can’t be so smooth.
And only 10MB of memory difference, no itch.

Special effects are independent files.
I did use native particles, but … very ugly and unsightly, this is what I think Corona worst feature …
To achieve the special effects I use now, I must use a lot of particles. In this case, the game FPS will drop significantly, which is very bad for the game experience (I used to use native particles before, and then changed to sprite sheets) .

The black screen only appears on the simulator, I do n’t quite understand why there is such a limitation …
Although it does not affect the actual results of the game, it is very troublesome for the development. :confounded:

re: Black Square
To be clear, you’re saying, that animation can’t be played even by itself? That sounds like an issue with that specific animation.

Would you be averse to creating a tiny demo using just that animation showing the issue and sharing it privately for download so I (and maybe @XeduR) can take a look? You can message me the link via the forums here.

More Questions:

  1. What are these specs for your PC (I assume it is a Windows PC since you have a GTX):
  • OS: Windows 10 Home Version 10.0.18638
  • System Memory: 16GB (you said this already)
  • Video: GTX 1060 (you said this already)
  • Video Driver Rev: 436.3
  • Open GL Rev: 4.6
    (replace my specs above w/ yours)
  1. Have you confirmed this behavior on another dissimilar PC/Mac?

  2. Are all your texture sheets using power-of-two dimensions? They don’t necessarily need to be, but it would be interesting to know.

  3. What are the exact dimensions of the problem sheet? i.e. The sheet used for the problem animation.

  4. How many sheets do you have and how many are in use at once?

I know… these questions are all kind of scattered, but it’s hard to debug w/o examining a simple example that demonstrates the problem. Thus, the shotgun approach to questions.

PS - I know you answered some of these questions above too. :frowning: I’m not trying to make you do more work, I am/was just asking questions that came to mind.