Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - curb47

Pages: [1] 2 3 ... 15
PlayMaker Help / Re: Can't get Sprite from Hash Table?
« on: February 24, 2021, 04:33:30 AM »

Okay, thanks. I'll watch the video and learn something new.


PlayMaker Help / Re: Raycast logic mind-melt
« on: February 24, 2021, 04:15:53 AM »

So, this is what I've ended up with, and it works pretty well...

The global event 'Fire' is activated when the Titan is in range of the player.

1. Spawn Laser, spawns a pooled Prefab of the Laser which has the Draw Line action, and two child objects for the Start & End of the Draw Line.

2. Main Raycast spits out the raycast, and sets the position (every frame) of the End object in the laser/Draw Line prefab. It also stores any hit objects and has a Game Object Tag Switch, one for the player and one for other enemies. If nothing is Hit after a Wait of 3, it goes to FINISHED which sends an event to stop firing lasers/De-spawn the pooled Laser/Draw Line prefab and start the Titan hunting again.

If the player is hit by the raycast, it goes to the hitPlayer event which zips through the Subtract Player Health state which simply sends a global event to the player spaceship to reduce health by 1 (int), and then on to Aux Raycast. I did not want to use a global variable for Health because I've worked really hard at completely stripping my game of global variables.

3. Aux Raycast is a copy of Main Raycast, but with no Tag Switch for the player spaceship and is mainly used to continue driving the Draw Line laser prefab. It has a Wait of 0.3 then FINISHED.

4. Clear Hit Object sets the hit object variable stored in Main Raycast to Null, so it doesn't instantly send the hitPlayer event.

The result is pretty much perfect. If the player is hit by the laser, it takes 1 off Health, and an additional 1 off Health for every Wait 0.3 the player is in the path of the laser. It's cool, because there are loads of other enemies doing different things, and sometimes it's not a case of simply flying out of the path of the lasers, so things get quite hectic and exciting!

I'll mark the thread as SOLVED. I've done plenty of game testing and it seems really solid.


PlayMaker Help / Re: Can't get Sprite from Hash Table?
« on: February 24, 2021, 01:16:19 AM »
Ummm... what's the difference between a Hash Table and an Array?

Like, under what circumstances would you use a Hash Table, and not an Array?

I don't know what a Hash Table is.

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 23, 2021, 08:51:41 AM »

Thanks, I'm at work right now so will need to re-address this later, or tomorrow morning.

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 23, 2021, 03:14:22 AM »
Maybe I actually need to have 2 raycasts on separate FSMs for each laser? One to drive the Draw Line, with no events or anything, and one to handle the hit detection which can trigger damage etc.

I'm under the impression that raycast is expensive, so maybe it's not the best solution, but I can't think of any other way.

Broadcast All is another one you want to avoid. You'll discover this on the Send Event action, in the Event Target parameter. Basically, it's a quick and easy way of triggering events on any object/FSM that has a particular Global Event.

I guess it has the same price as Find Game Object, as the Broadcast All has to search the entire hierarchy to make sure it's targeted all the FSMs with the corresponding Global Event.

I used to use this a lot, before I discovered Arrays. After you've gotten your head around Pooling/Spawning etc, the next best thing you could get into is Arrays. Array Maker on the eco system is the go-to set of actions for this.

Generally, it enables you to store objects/variables to a dynamic list, and if you need to send an event to a bunch of objects, use can send the event to specific lists.

Find Game Object is expensive. Actually, I think any action with the word 'Find' should be avoided as it instigates searching through the entire object list/hierarchy to get the result.

I used to use Find Game Object as a quick and easy way of setting variables on spawned prefabs (which is something you're looking into, right?), and ended up re-working all my prefabs so the variables are set in the same action immediately after the pooler spawn action.

For example: You want to spawn a wave of enemies that move towards your player, and each enemy starts as a blank page as a prefab cannot reference variables (in my case, objects) outside of its prefab state. So you need to set the player spaceship as an object variable on the prefab for either Move Towards>Player, or Look At>Player etc. The temptation is to add a Find Game Object (Player) as the first action on the prefab, as it's quick and easy.

The most efficient way is to use Set FSM Game Object (or Set FSM Int, Float, Bool etc, depending on your needs) -

You can se in this example, that when I've spawned the prefab (enemy), the object is stored as a variable 'droneWave', and then I've used Set FSM Game Object to give 'droneWave' the variables it needs. You can see in this example I've got a whole bunch of Set FSM Game Object actions stacked up, so imagine if every variable was set using Find Game Object instead, each time an enemy wave is spawned.

It can be a bit fiddly and time consuming, but is the most direct and efficient line of communication.

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 23, 2021, 02:20:36 AM »
I'm really struggling with this. It's kinda doing my head in.

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 23, 2021, 02:19:54 AM »

with your problem, try adding the line draw to the damage event, DON'T add the raycast. It should still take the last point it was given and continue drawing the line. Otherwise, seperate the draw line from the damage fsm completely. i.e have an fsm that ONLY controls the line draw, based on hit (again add tag compare to this fsm)

The but I need the raycast to be continuous because that defines the hit point/end point of the draw line. If there's no raycast, the line doesn't move as the Titan rotates to find the player spaceship. Know what I mean?

The draw line needs the 'every frame' updated position of the raycast hit point.

If I were to turn the Titan laser fire into a pulse fire weapon I can do that, no problem, that's how I've done the player spaceship lasers, but I'm trying to add variation to my enemies, and having the continuous 'hosepipe' laser is really what I'm after.

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 19, 2021, 04:44:21 AM »
Yes, I have a pooler system set up, prefabs etc. I didn't think about 'pre-fabing' and pooling the Draw Line, it makes sense.

I could then, after the raycast, spawn a Draw Line and set the start/end?

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 19, 2021, 04:36:06 AM »

I'm avoiding using global ints and floats. My understanding is that they're quite demanding. I guess, if the global variable isn't being updated constantly, it's not so demanding?

It would make it a million times easier if i could just use a global.

The issue I'm having with the raycast now is... how do i explain this...

When the Titan starts firing, and misses you, the Raycast & Draw Line are good - full length lasers, but when you 'cross the beam' it detects the hit and sends the event, but the Draw Line doesn't stop at your spaceship, it stays full length.

Another result I had was the Draw Line detached from the Titan and just sat there stationary, until you cross back into the raycast, when it would be destroyed and re-drawn as a new laser from the Titan.

I've played around with Destroy on Exit, and various other bits n bobs, but I can't get it right.

PlayMaker Help / Re: array transfer question
« on: February 19, 2021, 02:26:52 AM »

Whooaaa, dude, what happened?

I really appreciate all the help you're giving me with the raycast thing, but attacking djaydino for his Darklight sig is really rude and out of order. Come on man, djaydino is cool, and is an incredible source of inspiration, knowledge and help for people like me (n00bs) who are on a mission to learn and create.

I would have given up many many months ago if it wasn't for djaydino's help, and the idea that he might be put off from being active on the forum because it's become toxic is no good for anyone.

We're in this together, let's be cool. Please.

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 19, 2021, 02:04:50 AM »
Hi again,

So, I've gone through it again and this is what I've ended up with...

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 19, 2021, 01:34:15 AM »

Well, it's another one of those days... up at 5am to tackle this before work.

I've gone through your workflow, and I am missing something. It's still melting my mind.

In regard to you other point about setting up raycasts to avoid colliding with meshes, I think I have it set up right. The image below shows the main object with collider (sphere), and the empty game objects L1 and L2 are the raycast start points:

I will go through your previous posts again...

PlayMaker Help / Re: Raycast logic mind-melt
« on: February 18, 2021, 06:20:45 AM »
Awesome! Thank you, that's great help.

I will set up your suggestion and get back to you.



Pages: [1] 2 3 ... 15