playMaker

Author Topic: [SOLVED]3d Object or Animated Sprite for Coin Meter - What's best?  (Read 2436 times)

Neikke

  • Full Member
  • ***
  • Posts: 134
https://gph.is/g/EGyXVgp

Please look at this Coins Meter in the upper left corner, do you think they're using actual rotating 3d Coin object or it's just animated sprite that gets tweened to that Coins Meter location?!

With my game, I'm aiming for mobile platforms, what would be the best for performance - using actual rotating 3d coin object Moved Towards that Coin Meter location or animated sprite (containing sequence of PNGs)?

Thanks!
« Last Edit: July 13, 2019, 07:53:22 AM by djaydino »

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #1 on: July 11, 2019, 12:14:06 AM »
Sorry, this is my 2 cents without knowing what I'm talking about.... but  ;D

I think those are actually 3d. I'm guessing this because you can move around in the game and change your relation to the object, without them following you to only show their 1 side.... well unless they do, and then that's your answer  ;)

As for performance; maybe you should just try 3d and see how it goes?

I mean faster is faster, and I would presume that the code running a 2d animation is less expensive than rendering a 3d object (by how much will depend on how many triangles the 3d object needs to draw), but does it really matter? Are you going to blow up mobiles if you go the 3d route, or are you saving on performance when you have tons to spare? If you have hundreds on screen, maybe so, if they are scattered... eh, I dunno.

Another factor to consider: You could actually make and animate a basic 3d coin or other simple object very easily and quickly. I mean you can even just grab a unity sphere, squash it, slap a yellow material with emissions on it, and Bob's your uncle. To animate that to spin or what ever would take you 5 minutes.

On the other hand, animating a 2d object is much much harder. You need to be able to draw and will have to draw the same image (at different angles/stages) a dozen or more times. That requires more skill and much more time.

Well, unless you buy one or something.

So that's another thing for you to consider what is right for your project, not just a project for mobiles. Do you want to spend money? Is one or another option something that you can actually make yourself?

The last thing that comes to mind; is 2d going to suit the rest of the game? When you move in a 3d space, will the coins look like they are rotating their flat face to watch the camera? Does that matter if they do?

So there you go. You asked 1 question and I "helped" by asking you a dozen more.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #2 on: July 11, 2019, 04:20:38 AM »
Hi,

I am pretty sure it's 3d, it will be easier this way for seamless animations of rotation.

Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #3 on: July 11, 2019, 08:25:36 AM »
Hi.

You can easily change a 3d animation 2 2D with this asset :
https://assetstore.unity.com/packages/tools/sprite-management/sprite-baking-studio-3d-to-2d-31247


But to move the 3d object to the ui meter, i guess you need to use 'Screen to world point' position where your meter is, you will probably need to update during the movement.
So maybe have a empty object 'Folow' the ui pos every frame, or only when coins are moving toward it.

and then use move towards and move toward the empty object.

I did not test this btw, so not sure if that works, just an idea :)

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #4 on: July 11, 2019, 11:13:45 AM »
2daniellogin,

woa that was a long but very interesting one! ;) You're right it's best to have a kind of a test and see what's best. I just wanted to check may be there's some already widely known opinion on that. I'm just really in doubt what's more performance friendly - playing PNGs sequence again and again, or having actual 3d object. I'll take a closer look. Thanks a lot!

2jeanfabre

Thanks! that totally makes sense!


Neikke

  • Full Member
  • ***
  • Posts: 134
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #5 on: July 11, 2019, 11:17:22 AM »
2djaydino

I actually quickly tested having a 3D coin object spawned from a Player and moving towards Title and it works. Thanks! But I wanted to ask you one thing:

When I'm picking one coin after another everything works fine, once collected - they're being spawned at my Player's position and moved towards Coins meter one by one, but when I have Magnet activated and attract let's say 10 of them at once, then I have a mess - cos instead of one nice queue of rotating coins moving towards Coin Meter - I have 10 coins which look as one - cos they're all travelling at the same speed and starting at the same time.

So I want to ask, is it possible to somehow make them to be spawned with slight delay one after the other even if I collected all 10 coins at once? Thanks a lot!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #6 on: July 11, 2019, 12:43:29 PM »
Hi.
On collecting a coin place it in a fsm with an array (preferably array list instead of build-in array)

in the fsm for the array, check if array list is empty with Array List Is Empty. (the original action does not have a every frame event, you can try the one i have below in the attachment)

Then if not empty, loop thru the list and trigger (send event) each coin to move to the meter then remove from list (using index) and have a wait in between.

the movement fsm should be on the coin as you can have multiple items.
You could use some holders and a pool, then parent to holder and move.
but that's a bit more advanced and maybe not necessary unless you would have performance issues.
« Last Edit: July 11, 2019, 12:45:29 PM by djaydino »

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: 3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #7 on: July 11, 2019, 01:35:23 PM »
Sounds great! Thanks for the heads up Djay!

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: [SOLVED]3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #8 on: July 18, 2019, 12:07:14 PM »
in the fsm for the array, check if array list is empty with Array List Is Empty. (the original action does not have a every frame event, you can try the one i have below in the attachment)


Hi, I tried that ArrayListIsEmpty2 action and in Unity 2019.1.7f1 it gave me lots of 'namespaces' errors so I had to delete it. Are there any other ways to check if there are items in my Array list? I was thinking of having an Int variable of number of items in the Array, and comparing every second if it's greater than 0 - then loop through. But I'm just not sure if checking every frame or every second for this is a good idea for mobile platforms. Would you have any info on that please? Thanks!

On collecting a coin place it in a fsm with an array (preferably array list instead of build-in array)

Sorry, looks like I need some clarification here too. Do you mean some special Array List action which is not included (built-in) in the the latest Playmaker version? Thanks a lot Djay!
« Last Edit: July 18, 2019, 12:23:39 PM by Neikke »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED]3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #9 on: July 19, 2019, 04:02:03 AM »
Hi,

 What are these errors you get?

 Bye,

 Jean

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: [SOLVED]3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #10 on: July 19, 2019, 04:44:30 AM »
Attaching errors log.

But I was able to kind of solve it by checking if Array list is empty or not by checking an Int variable of Array Length every 1 frame. If Array Length equals 0 -> I'm checking for it again. If Array length is Greater than 0 -> I'm doing Array Get Next looping through the items in Array, each loop around saving the next item in Array in its Result variable.

is it a good way of doing this? I'm just not sure if checking every frame is a good idea for this performance wise.

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: [SOLVED]3d Object or Animated Sprite for Coin Meter - What's best?
« Reply #11 on: July 19, 2019, 11:57:01 AM »
Oh, me stupid, figured out that I have to install Array Maker first before installing ArrayListIsEmpty2. I installed it and that action is installed smoothly. Thanks Djay!