playMaker

Author Topic: Making a 3D Random Generator Issues  (Read 141 times)

ZaanDa

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Making a 3D Random Generator Issues
« on: June 13, 2018, 08:49:32 AM »
Hi there !

As said in the title , I try to make a Random generator script for dungeon like levels.
First of all : I'm completly new to game making , to unity and so , to Playmaker.

Sooo I know this is probably a big thing I'm trying to take care of !

For the problem I encounter :

I have made assets that are close to what tiles may look like in 2D.
I make the spawn appear first , than a first random corridor between 11 assets.
The assets are already oriented so I don't have to rotate them (that's why there are that much)

Problem is , I'd like to make the corridor appear at a position induced by the spawn position.
For exemple if spawn is at 0 0 0 , I'd like the corridor to be at that position +10 on the x or z axis. (I already determined that for each assets the best number between them is 10)

But I can't find a way to use the variables to do so. For me it should be something like that :

Create the Spawn  ,
register it's position
and then do a thing like "spawn position +10 on x or z axis"
and then make the first corridor appear.
Make the position of the corridor into a variable and repeat , with this time the corridor position as a base for the next one to come.

Manually it's possible to do , but in an automatic way is what would make the script random.

(Some corridor will require to have a particular axis to move to but that's not the problem for now , I assume that once the solution for the problem is found , I will be able to do : if this particular asset appear , then put a random choice of assets according to this one and on one particular axis)

For now this is my only concern ! Thanks for your time ! ;D

verybinary

  • Playmaker Newbie
  • *
  • Posts: 47
    • View Profile
    • The Museum of Digital
Re: Making a 3D Random Generator Issues
« Reply #1 on: June 15, 2018, 12:53:05 PM »
you could have an fsm on each piece that holds variables like x or z
on the map manager set the piece you are about to place as temppiece, get fsm int from temppiece, set it as tempint on the manager, create object(temppiece) and translate by tempint

ZaanDa

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Making a 3D Random Generator Issues
« Reply #2 on: June 15, 2018, 01:21:18 PM »
Wow !
Not sure I understood all of that , but I'll try .
;) Thanks for the idea !

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3078
    • View Profile
    • jinxtergames
Re: Making a 3D Random Generator Issues
« Reply #3 on: June 16, 2018, 06:00:18 AM »
Hi.
I do something similar but i use empty child objects and place them on the edges where the next piece should connect.

Then use get child objects to get the objects and use that as the target position (+ offset distance if the objects pivot point is not on the edge)

ZaanDa

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Making a 3D Random Generator Issues
« Reply #4 on: June 16, 2018, 10:10:52 AM »
Now I have two things to try !

I did not try verybinary solution yet but I'll be on it in the next days !
I'll keep you updated on what worked best for me ;)

Thank you both.