playMaker

Author Topic: Best Practice for general raycasting for info on objects  (Read 8722 times)

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #15 on: October 25, 2013, 02:42:03 PM »
[...] I am actually right now making use of this design pattern for a playmaker sequencer demo :) so more on this very soon, with an actual implementation on how to control Fsm's on a timeline. It will be quite advanced, using Xml and ArrayMaker and properties injections for each sequence items, but very interesting indeed!

bye,

 Jean

Any news on this? Sounds very interesting.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #16 on: October 26, 2013, 12:26:34 AM »
Hi,

 Yes, it's in the xmlMaker package under the examples, it's called "Sequencer"

https://hutonggames.fogbugz.com/default.asp?W1133

bye,

 Jean

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #17 on: October 26, 2013, 07:06:24 AM »
Thanks Jean. Don't want to hijack this thread but want to ask what the purpose of this sequencer example is? Can you explain in a few words how this could be used?

What I get is that an xml file is being read and executed for an order of sequence, but with a lot of checking, which is unclear why? The example itself is confusing, since moving and rotating a cube once could of course be done in one state and it hardly demonstrates what I thought a sequencer does (I was looking for examples of how to construct a step sequencer for doing rhythm patterns).

I feel as frustrated with these array/data maker examples as I did in math classes, where I felt the teacher was speaking a foreign language. I am scientific minded and am able to do math, but somehow need clearer or more visual illustrations for examples to become relevant. For what it's worth.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #18 on: October 26, 2013, 08:21:58 AM »
Hi,

Don't worry, that's fine, It's important you state when you don't understand something, no matter your level of expertize.

-- So, basically, you got it right, the xml file follow a standard I set up for the occasion of this example, this is one way to do it, but you can find any other mean of storage or data to express your sequence, it doesn't have to be xml.

 However, I strongly feel xml is one of the best way to describe a sequence, because it's very close to Plain english, which makes it easy to read, debug and edit, and xml is a standard and well known description and organizational structure, so it fits the needs, and with a little experience, xml is a wonderful structure that can grow and evolve to fit your needs as your project evolves and gets more and more complex. ALL of my complex project use xml for various descriptions and structural data. It's for me an essential tool for development.

-- What do you mean a lot of "checking", can you precise?

-- you are missing the point of the sequence expressed in XML if you think "this can be done with a two Fsm states": the reason is that a Fsm is NOT something you can change at runtime, Xml IS something that can evolve, change, be edited by the user or developer outside Unity/PlayMaker, so in that regards, the example, while simple, is very clear as to what it offers: you do not hardcode the sequence in PlayMaker, instead you describe it in an xml file and it's played back within a small framework written in PlayMaker.

So, to be clear, this sequence example can now accept ANY xml file that follow the same standard, this is very powerful because you can download/get this sequence from various places ( server, user computer, etc).

The original request for this sequence example is actually a PlayMaker member that is working on a high end simulation system and uses PlayMaker to allow engineers to define sequences. His problem was that PlayMaker is not suited for heavy modifications on how a FSM performs, and so this example was there to show an alternative that works with PlayMaker as is, meaning that PlayMaker is not the EDITOR of the sequence, it's the PLAYER.

Does the difference between EDITOR and PLAYER make sense here? that's the reason of this example, xml is the editor environment to express your sequence, PlayMaker plays it back. IF you require a new feature in your sequence, you implement it in PlayMaker by definining new properties in your xml that you will understand and process as expected, essentially adding new features to the sequencer.

Am I clear enough? Maybe the problem is that you are trying to find what to do with a system that you don't necessarly need in the first place? do you have a use case in particular that you are trying to achieve in PlayMaker?

Bye,

 Jean

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #19 on: October 26, 2013, 09:13:19 AM »
Does the difference between EDITOR and PLAYER make sense here?
Definitely, and the context (external editing for engineers) makes it much more understandable.

What do you mean a lot of "checking", can you precise?
Basically just the long sequence of states in '--SEQUENCER--' (is it a GO?, find, load and rename), which then seems to be distributed in some way down the hierarchy ending in Process with the 'Rotate process' FSM.

you are missing the point of the sequence expressed in XML if you think "this can be done with a two Fsm states"
Yes I was missing the point, but the point I perhaps was trying to hint at was that the resultant process (an unlit cube moving and rotating) was a pretty dry example of something with such an elaborate setup, but now I see why the visualized process isn't necessarily that important to the engineer member, as it was a proof of concept for a player. But for a visual learner, I guess  what makes stuff interesting is some aesthetic payoff, to whet the appetite or balance the effort of having to apply oneself to dry logic learning.

Maybe the problem is that you are trying to find what to do with a system that you don't necessarly need in the first place? do you have a use case in particular that you are trying to achieve in PlayMaker?
Yes this example is probably not what I'm looking for, but I appreciate knowing what PM can do. I'm looking to do a simple step sequencer, like discussed here:

Drag Drop Array and Audio Play-ness help
http://hutonggames.com/playmakerforum/index.php?topic=1444.msg6198#msg6198

Audio stepsequencer - and they said it couldnt be done!
http://forum.unity3d.com/threads/78003-Audio-stepsequencer-and-they-said-it-couldnt-be-done!

I'm sure I have to use arraymaker for it but I just haven't found an example yet that has made enough direct sense to me, so that I feel I can start playing with it.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #20 on: October 26, 2013, 12:19:50 PM »
Hi,

 You are right, I should elaborate a second sequencer example that is more like a Cut scene or a more complex system, but by doing so, I will hide away the core of the sequencer by having to implement a lot more features, do you see what I mean? by doing a dry example, It's easier to understand how it was made. This is always the challenge with providing a sample, it's either too lame or too complex... the right balance is very tricky to get...

 Could you give me a precise use case? and I'll work on a sample for you and use ArrayMaker if it fits, or xmlmaker if I must :)

bye,

 Jean

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #21 on: October 26, 2013, 02:05:46 PM »
Yeah I definitely recognize that teaching is a delicate balance game, like If you were to try make a simplified uSequencer with scrub function, the example could become too complex to demonstrate the essential matter of DIY (but would be nice to see), at least that's what I think you mean by saying you have to hide away the core and implement new features.

A precise use? Well I have a grand plan somewhere in my imagination for a rhythm game. But for now I would be happy just to know the basics of setting up a simple step sequencer (with some time accuracy), something like this: http://www.nullpointer.co.uk/unity/DrumMachine/WebPlayer.html

building a step sequencer is described in the unity forum thread linked above, where others try to achieve the same with script examples. The user Quickfingers say about his step Seq :

Quote
I use a metronome track but its for the whole sequence rather than just one beat and I just cache the sample count at each beat in an array by dividing the sample length by the number of beats. Then use a beat and bar counter to decide which element of the array I'm checking and trigger the samples with a delay as you do
« Last Edit: October 26, 2013, 02:08:25 PM by parallel »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #22 on: October 27, 2013, 12:18:57 AM »
Hi,

 Yes, ArrayMaker could be a good way to describe at runtime your beats ( when playing), and xml or json would be for sure a good way to store your beats and load them when required.

So here, I would study a combination of arrayMaker and XmlMaker.

I would also suggest that your beat signature is not within the array but as a meta information, say you want 16 beat per bar, your array will have 16 entries, but you should not rely on the array length cause you may want two bar of rythms, so you would have 32 entries, yet playing back at 16 beats per bar. Does that make sense?

I am a drummer myself, so I am all up for building something around this! Do you have some simple drum samples I could use for this demo?

bye,

 Jean

parallel

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #23 on: October 27, 2013, 05:22:04 AM »
I am a drummer myself, so I am all up for building something around this!
Excellent!

I would also suggest that your beat signature is not within the array but as a meta information, say you want 16 beat per bar, your array will have 16 entries, but you should not rely on the array length cause you may want two bar of rythms, so you would have 32 entries, yet playing back at 16 beats per bar. Does that make sense?

Yeah I think so, but how to make the meta FSM/metronome track adhere to a variable beat signature (Which I guess should be synced to a time action)? In the above mentioned thread I think they suggest making a silent metronome beat, at a certain length thus filling the gaps, triggered*16, adjusting BPM by tweaking the metronome samples playback speed, or at least that's how I understand it.

Do you have some simple drum samples I could use for this demo?
I like brushes and have attached some compressed wav's (Windows PCM), wasn't sure if they all needed to be the same length though. I'll resample them if you need another format (or send you the whole pack, just couldn't find your email). Or I could find some 8 bit sounds for lean demo purposes.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Best Practice for general raycasting for info on objects
« Reply #24 on: October 27, 2013, 10:38:47 PM »
Hi,

Simply fire a global event "BEAT" or something using "send event" and the right delay, looping on itself, and you'll have your beat.

Bye,

Jean