3D Car Simulator- Released (by JojoDude)

competition
top5win
leaderboard

#41

Correct. That part you have to figure out through test/experimentation. Any there’s many different ways to go about that. But you’ll, temporarily, need to add a text to display the X position of the 2D car.

Then modify the project (in a temporary test version only) so that you can clearly tell when the cars are positioned so they’re “bumping” & then note the 2D Car’s X positions.


#42

It took quite a bit of trial and error, as you said, but:

If you’d give the game your final attempts, I’ll find 1 or 2 other people and form the Top 5 list.

Thanks for all the help, especially @ThinBuffalo and @BlastFusion with the laggy 2D Car and random deaths. Thanks to @William04GamerA for help with testing and suggestions and @MyPi for offering help. I really appreciate it.


#43

I got to level 7, when the screen suddenly turned white:


I don’t know if it is a bug in the actual game though or just a bug with the HS editor.


#44

The screen turning white is a problem with the Set Text block.

I’ve reported this, but there has to be a business case to justify the expense associated with fixing bugs. @awesomeonion doesn’t believe this problem is prevalent enough to justify fixing.


#45

Just FYI, I have spent time on this bug, it’s not an easy fix!

Each time you change text it creates a new image. This usually isn’t a problem, but when you use a counter you start to generate a lot of images.
This is also usually not a problem as we discard the images once they are gone.

I am not 100% sure about what is happening here, but when you have the text updating on every frame it seems to move too fast for the garbage collection to catch up, or maybe some of the images go through too fast and they don’t get marked for removal. Either way, the memory of your app eventually grows out of control causing the player to crash (or if you are on an older iPad, it might be the whole app).


#46

But writing this just gave me an idea, I can try to force the updates to be slower (i.e. I will only update the images every 4th frame or something of that nature). That would mimic the effect of adding a wait block in between and might mitigate the issue.


#47

Hi @awesomeonion, sorry this is off topic, but did you see the activity bug I reported? Anyways that is a rather good idea, but the con of that would be hops getting annoyed at the wait for each new frame.


#48

If that’s what you think will fix it, I’m in!

Let me know how that goes and if you like, we can use my game to test it.


#49

Hi @awesomeonion

I should have said that the problem wasn’t prevalent enough relative to the scope of the problem (knowing that you have previously looked into fixing it). If it was an easier fix, I’ve no doubt that it would already have been addressed.

Not quite understanding how the Set Text block relates to creation of images (are the images masks used for collision detection?), I do have a concern with the proposed solution to update the text every N frames.

Would that not de-optimize code that only changed the text in response to discrete events which (albeit only in highly optimized, timing sensitive projects) could impact the end result? That assumes that, for example, collision detection after the Text change (when using emojis as characters) could be delayed by up to N - 1 frames.



The issue only manifests when the value of the Set Text block is a variable. Does that make sense with the generalized relation to creation of images? I.e., a repeat forever loop could contain 2 Set Text blocks

Set Text (Hello)
Set Text (World)

This will continue indefinitely, in my experience, without causing the blank screen.



Since you mentioned/confirmed that this is a memory related problem, I’ll mention that in a last couple days I tried uninstalling and reinstalling the app. Prior to that I was not able play Jojo’s project to completion (numerous attempts all resulted in white screens before the game was over). Now, I am able to play the project to completion. Once. After restarting or returning to the Editor and playing again, it quickly crashes. After closing & reopening Hopscotch, I can once again play the game to completion. Once.

Naively, I’ll suggest it seems that some cache isn’t being cleared or some garbage collection isn’t occurring (that isn’t time dependent since it persists between restarts). I hope that helps…


#50

I can’t play any projects so what is the point of being here :disappointed:


#51

That’s exactly right.

When I play my game “fresh” after opening Hopscotch, there are no issues.

The second time around… once the 2D and 3D cars start to speed up (the 3D Car speeds up in time with the 2D Car), the screen will go white.

I agree that there must be something that is filled up by the game and needs to be emptied, similarly to how it is when Hopscotch is swiped up and restarted.


#52

Hi @JojoDude

We can mitigate (reduce the risk of occurrence) the Set Text / White screen bug on your project (or any project) by not updating the text as often.

Instead of this:

Replace that rule with 2 separate rules. One will update the text at a slower rate (delaying the white screen). The other will update the points at the same rate. The original code updates the points every 3rd frame, whereas the new code updates the points every frame so the increase is divided by 3 so points are accumulated at the same rate. Note also that the Set Position is moved out of the Repeat Forever block as it’s only needed once.


Try this and let me know if you have less issues with the white screen.


#53

Isn’t the way you showed me a lot simpler?


#54

@blastfusion Your scenario was different. The text (points) only changed occasionally. His points are continually changing so the method I showed you doesn’t apply here.


#55

@ThinBuffalo, you are a coding GOD!

I’ll try this out and test for “The White Screen of Doom” a few times.


#56

Okay. This is weird, and I don’t know if my high score counts then. But I am glad that @awesomeonion is working on it, even though it is hard to solve. Good luck trying to fix it @awesomeonion!


#57

I did put out a fix that might mitigate the problem (we can update the player without updating the app). If you guys want to try it out, I’d be curious to see if it helped.


#58

Hi @awesomeonion, I just tried Jojo’s project a couple times. Unfortunately, now it’s worse than before. Yesterday, I could play the project though to the end once. The crash would occur on the 2nd attempt after a restart. Now I can not play the project though to completion without a crash.


Just to confirm (since I’m sure you get tagged a lot), did you see my additional comments above?


#59

Might the change only work with new projects?

I created a new project and re-ran the baseline tests documented in this topic.

Instead of about 60 sec to crash, it ran about 6 minutes!

Now, I did uninstall & reinstall the app a couple days ago. Jojo’s project ran longer before crashing after that. So the 6x increase is either due to the reinstall, your recent change to the player, or a combination thereof. I don’t have metrics, but I don’t think the reinstall alone produced a 6x improvement.


#60

:+1: I think the 6 minutes was my fix!