playMaker

Author Topic: what is the best way for a simple game like this  (Read 530 times)

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
what is the best way for a simple game like this
« on: October 22, 2022, 12:38:13 PM »
Hello,

I'm actually trying to improve my game relating to memory usage and calculation.

In my game, objects are spawned, travel a distance and die.
The player should avoid some of them or grab others to make points.

I firstly started it by using rigid bodies and set velocity by object.
It was good, but I noticed some spikes on the profiler and distortion on VR.

So I decided to test another way, without physic, and instead an animated float for each object.
Seems to be worse than the first idea...

I toke a screenshot of the profiler,
each spike is the moment a new object is instantiated.
and during the time of the player loop(162ms), I noticed that the PlaymakerTriggerEnter is splitted in 2 parts of 78ms and 79ms.

So I'm wondering if there is a way to lower this and a better way to create the same effect.

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: what is the best way for a simple game like this
« Reply #1 on: October 22, 2022, 02:15:03 PM »
I fund a soluce witha a pool manager

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: what is the best way for a simple game like this
« Reply #2 on: October 24, 2022, 01:41:36 PM »
Hi again,

I'm back for the next part, which is the simple problem....

Firstly, I was thinking that instantiating the prefabs were causing the spikes.
After modifying this to pool managers, I get the same result,

and after more investigation, I understand that the problem is caused by Physics with the use of "OnTriggerEnter" on my prefabs.

The prefabs are only activated and deactivated and repositioned for each new call.

But garbage collector is constantly updating, and I don't know how to pass through this problem or avoid or dodge it... or maybe think differently.

As you can see on the screenshot, GC Alloc is 3.2 MB which is not big but big enough to cause micro freeze.

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: what is the best way for a simple game like this
« Reply #3 on: October 24, 2022, 02:00:43 PM »
I fund that the log was activated and caused a lot of Garbage collection.

I deactivate it, and also playmaker Debug Tools, gain some precious fps,
but I'm still having those spikes.

I Have no Idea if it's possible to gain more
A deep profiler shown me more details.
« Last Edit: October 24, 2022, 02:10:49 PM by blackant »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: what is the best way for a simple game like this
« Reply #4 on: October 26, 2022, 05:04:29 AM »
Hi.
the bottom one on the image already has a large ms, are there still more listed below that one?

the ms is summed up, so you should check the list from bottom to top