playMaker

Author Topic: Runner Game - spawning objects  (Read 4948 times)

elijah123

  • Playmaker Newbie
  • *
  • Posts: 5
Runner Game - spawning objects
« on: February 29, 2016, 04:16:27 AM »
Hi,
I was wondering if something was possible with playmaker and if anyone could point me in the right direction if yes...

I know it is best practice to try and figure something out first but i really have no idea where to begin.

I am doing an endless runner game and i want to have platforms and other objects in the scene to come in to view then go away once out of view.

I tried looking up code tutorials on endless runners but couldn't find one that covered more than just platforms spawning...I'm new to coding so i thought i'd try it in Playmaker. I am after having platforms spawn but also other objects like collectables above the platforms or obstacles...I thought that maybe if i had multiple scenes and just had them display at random but maybe that is a bad idea.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Runner Game - spawning objects
« Reply #1 on: February 29, 2016, 07:32:47 AM »
The "create object" action creates objects which does the same as "spawning" but a lot of the time when the words "Spawn" and "Despawn" are used- it refers to the use of a pooling system- which is a more efficient way of adding and removing objects from a scene-

You can create your own pooling/spawn/despawn system with Playmaker but you are better off just buying PoolManager- it has easy to use Playmaker actions and is rock solid-

So you can use the "create object" action to spawn things and the "destroy object" to despawn them BUT if you want the real thing and the performance benefits that come along with it get a pooling system-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Runner Game - spawning objects
« Reply #2 on: February 29, 2016, 07:40:59 AM »
Hi,
Yes, i think multiple scenes is a bad idea for a endless runner.
I think a good way is to have your different platforms  placed out of game view, have collectibles and obstacles positions preset as a child and give them the same name/number on each platform.
then set the platform in front of the player (but still out of view) and activate the desired collectibles and / or obstacles.

when the player has passed the platform place it back out of view and reset all the children on that platform.

elijah123

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Runner Game - spawning objects
« Reply #3 on: February 29, 2016, 11:21:40 PM »
Hi,
Yes, i think multiple scenes is a bad idea for a endless runner.
I think a good way is to have your different platforms  placed out of game view, have collectibles and obstacles positions preset as a child and give them the same name/number on each platform.
then set the platform in front of the player (but still out of view) and activate the desired collectibles and / or obstacles.

when the player has passed the platform place it back out of view and reset all the children on that platform.

Thanks for your reply.
Being new to Unity and Playmaker I just want to see if i understand correctly...
I create  platforms with different collectables and obstacle scenarios, name the collectables and obstacles the same thing and parent them to their platform.

The next section i don't understand because if i have multiple platforms which one do i place in front of the player?

So i make it so the platform resets position and starts over?

Sorry, i'm so new to this, i know  with practice i will learn but it can be difficult to get started when you are completely new.

elijah123

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Runner Game - spawning objects
« Reply #4 on: February 29, 2016, 11:24:46 PM »
The "create object" action creates objects which does the same as "spawning" but a lot of the time when the words "Spawn" and "Despawn" are used- it refers to the use of a pooling system- which is a more efficient way of adding and removing objects from a scene-

You can create your own pooling/spawn/despawn system with Playmaker but you are better off just buying PoolManager- it has easy to use Playmaker actions and is rock solid-

So you can use the "create object" action to spawn things and the "destroy object" to despawn them BUT if you want the real thing and the performance benefits that come along with it get a pooling system-

Thanks for your  reply.

I had a look on the Unity asset store but can't see anywhere where it says it works with Playmaker...is there any complicated setup required or does this come pre working with Playmaker?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Runner Game - spawning objects
« Reply #5 on: March 01, 2016, 06:29:11 AM »
The actions are here https://hutonggames.fogbugz.com/default.asp?W839

You add a "pool" to a game object- you add your prefabs you want to spawn/despawn to it-

then you just use the simple "spawn" and "despawn" actions- really easy to use.
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

elijah123

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Runner Game - spawning objects
« Reply #6 on: March 01, 2016, 07:52:43 AM »
The actions are here https://hutonggames.fogbugz.com/default.asp?W839

You add a "pool" to a game object- you add your prefabs you want to spawn/despawn to it-

then you just use the simple "spawn" and "despawn" actions- really easy to use.

Hi, i brought the asset and installed it and playmaker along with the addon in Unity but i get a bunch of errors saying "fsm state action could not be found" what have i done wrong? I've attached a screenshot.

elijah123

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Runner Game - spawning objects
« Reply #7 on: March 01, 2016, 08:00:21 AM »
Nevermind, i think i worked the error out.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Runner Game - spawning objects
« Reply #8 on: March 01, 2016, 11:13:57 AM »
A note about spawning stuff- if you ever spawn things that uses physics/force etc- be sure to include some actions that reset it right when its spawned or else it can get weird-

To be safe I set the velocity/angular velocity to zero and turn is kinematic on/off which I have learned from this forum- example pic
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Runner Game - spawning objects
« Reply #9 on: March 01, 2016, 01:24:24 PM »
[quote author=djaydi

The next section i don't understand because if i have multiple platforms which one do i place in front of the player?

So i make it so the platform resets position and starts over?

Sorry, i'm so new to this, i know  with practice i will learn but it can be difficult to get started when you are completely new.

Hi,
What i mean is, when you have several different platforms :1 for turning left, 1 for turning right,1 T Split, 1 going straight from north to south, 1 from east to west and some different designed platforms... (btw i am thinking in the style of 'temple run') Which are placed randomly in front of the player out side the camera view.

Then when a platform is behind the player ( player passed the platform)
you can place them out of view or destroy if you want to use the poolmanager.

Also instead of moving the player you should move the platforms.
the reason for this is that (for as far as i know) the x/y position is limited.