playMaker

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 - Thore

Pages: [1] 2 3 ... 8
1
Playmaker Help / Re: Level unlock
« on: Today at 10:25:41 AM »
If they are linear, you could use a simple int counter, e.g. “progress”. At an appropriate moment, it checks how far the player got, and all levels lower and equal the counter are considered open. If you complete a level, just add +1 to progress.

If it is not linear, I’d use a list of bools, or enum flags.

2
Playmaker Help / Re: Display score in "K"
« on: October 18, 2018, 02:11:46 PM »
If it's just K, divide by 1000, rounding down, and adding a K. Check the math actions, and build string.

3
Share New Actions / Re: Button + Direction (Get Button Down And Axis)
« on: October 18, 2018, 08:27:42 AM »
Hi Jean, okay, changed my post above.

4
Playmaker Help / Re: Crating multiple levels from single scene
« on: October 17, 2018, 01:25:47 PM »
You take your level integer, use that to populate the scene, and probably show some UI text that this is level X. After the player completed it, you add +1 to level, perhaps do some cleanup (pool/destroy objects, reset things), rinse and repeat.

If objects have some starting position, initialisation, and can be moved around etc. you can make a RESET (example name) global event, which you might add to the START state. At the end of one level, broadcast RESET and everything is set to the start state.

5
Share New Actions / Button + Direction (Get Button Down And Axis)
« on: October 14, 2018, 03:33:45 PM »
You look for a simple way for Button+Direction input? Here's my version.

GetButtonDownAndAxis.cs
When a Button is pressed, sends an event based on current axis direction, i.e. up+button, left+button. Useful for fighting games, combos etc. If you only want to use one direction (say, only up+button), simply leave the other direction blank.

All my actions are now also on Github.

6
The game object in the asset folder is called a “prefab”. Once you put a prefab into the scene, it creates an instance of the prefab. When you do this on runtime (when the game is playing), it also calls them “<name> (clone)”. As Djaydino says, they aren’t the same thing. The prefab is a “blueprint” of sorts.

Normally, you only drag drop scene game objects into scripts (or actions), (a) when the game objects are child of the FSM/holder or (b) when the game object is a manager or other “default” game object, i.e. things you know are always in the scene, when called. You use prefabs in actions typically to create instances, spawn enemies, bullets, etc.

7
Unlit shaders, otherwise directional lights.

8
General Discussion / Re: Doodle Jump like smooth movement
« on: October 13, 2018, 11:32:03 AM »
Hi,

I also make a platformer, and some aspects can be more inticate than they seem ;)

I start simple. They then get refined considerably, to get to the nice juice. I use a rigidbody2D, and the actions to move set velocity2D every frame. The move FSM has one ini state (to initialize, fetch stats etc.) and only two states, one for moving left and one for moving right. Search for my actions here in the forum, I combined the core actions into one. On top of each state, I flip the sprites. Underneath, I get the axis each frame, and set velocity 2D each frame (and more for animations, particles, sound)

Jump works similar. The basic version has few states: listen to button down, next state apply velocity 2D upwards. System global transition “On Collision Enter”, on the start state.

Next, for camera, use Cinemachine (free package of Unity). See some tutorials for it, this makes the camera move smoothly and has plenty to tweak how to move. The settings totally depend on your game, but see Brackeys example below. To pass platforms upwards, Blackthornprod (other video below) uses platform effectors 2D on the platforms.

I recommend also Unity or coding tutorials. While they are eventually about coding, they use the very same concepts Playmaker also uses (or rather, vice versa). Checkout Brackeys and Blackthornprod on YouTube (generally), but here are two you’ll find useful (you can of course also ask :))

ONE WAY COLLISION PLATFORMS - EASY UNITY TUTORIAL
https://www.youtube.com/watch?v=M_kg7yjuhNg

2D Camera in Unity (Cinemachine Tutorial)
https://www.youtube.com/watch?v=2jTY11Am0Ig

9
Playmaker Help / Re: Health System - deduct one live but once per hit
« on: October 10, 2018, 01:29:24 PM »
Hi all,

Im working on health deduction. Ive set when player attack action hit an enemies,it will deduct one life(using Integer)

But when ive set the deduct event to finished and move to non deductive event, that one hit deduct a few numbers.

How to deduct once per hit?

Thanks

Could it be that the event is triggered multiple times? To find out, you can switch on the counter how often states where triggered (I think that‘s in preferenes, or in the debug mode). Another pitfall is that the formula values aren‘t nulled and refreshed each new run, i.e. you accidentially operate with values left over from previous runs, and they add up.

10
Playmaker Help / Re: What options are there for 2d navigation systems?
« on: October 09, 2018, 09:36:18 PM »
NavMesh used to have problems with 2D, but AFAIK works now, too.

11
Playmaker Help / Re: How to change default action names?
« on: October 09, 2018, 02:41:34 PM »
Or I just need to change the way Playmaker looks for "Wait" action.
If i could change which script an action refers to in Actions Browser, then i could accomplish what i am looking for.

But maybe this is only not possible because Playmaker is closed source, and i can understand that because its a commercial product.

I explained this above, but in some more detail. It has nothing to do with Playmaker. Actions are scripts. They work when their class name and filename match.

When you rename the class/file name, Unity no longer finds the script. For all it cares, the script is gone, and a new script was added. It’s not a mere filename, but describes a class in code. So if you change “wait” to “waitfor”, “wait” was deleted, and “waitfor” was added.

Try it with other scripts. Changing class names around the way you plan is a really bad idea. It will work, but you cut yourself off from updates, you cannot follow tutorials or advice from others, since you effectively speak a different language, and you might have conflicts with custom actions from ecosystem.   

12
This is easy, but the details matter. In principle, go to the FSM that makes the character move. Add a separate state without actions. Add a global event, called say, “STOP” connected to the new separate state. Now you can set the FSM to this empty state, disabling the inputs for a while from somewhere else. You can do this from another FSM, or send the event also from the animation in quesion.

By animation: Go to the animation clip, add an event to the animation timeline (find the tiny button above the list of gameobjects that are animated). Find SendEvent, and send “STOP” (i.e. the global event that puts movement in an idle state).

Now you need to worry about how to give control back. You can do the same in reverse, e.g. “MOVE” SendEvent at the end of the animation that sets the state back to move (and a “MOVE” global event going in at the right place where it listens to buttons/axis). The danger is that with blending animations, the reset part isn‘t executed.
 
Another way is through a second FSM, let’s call it “stopper”, without involving animation clips (probably better). I assume you tell animator anyway when to play a certain animation. Say, you want that no movement is possible during attacking. When you e.g.  set the animator bool “isAttacking” you can as well send event to the stopper, and it takes care of suspending the player input. When you also know when attacking ends, you can likewise send event to stopper to restore movement controls. The stopper functionality can also be on the FSM that deals with the mechanic (attacking in my example). But you will get into trouble when multiple FSMs use the same technique. Then you want a separate FSM that manages this.

Now some details. The stopper FSM could disable/enable the movement FSM or script altogether, but that can get wonky with physics. Another way is to set the multiplier on the set velocity action to zero, and back when done (provided you use that). Instead of using an event to restore movement, you can also use a simple wait action, if you know the time, i.e. event sets it to the empty state, it waits there and when finished, go back to normal, START etc.

I use a stopper FSM. The gist is this: the jump FSM tells the stopper to stop movement for 0.2 seconds. The stopper FSM then gets the movement multiplier from the movement FSM (to store and reset later), then sets it to zero, and it then waits, using the 0.2 seconds until it sets the multiplier back to the original value I stored, resetting the functionality.

13
General Discussion / Re: How to rename global variables?
« on: October 08, 2018, 03:03:59 PM »
Hi folks, reading through some of this has come as a bit of a surprise to me! My projects currently make fairly heavy use of Global Variables, so.... eeeek! :-)

What's their major flaw? Anyone have any information regarding the level of impact heavy use (20-30 global variables) might have on performance? Obviously it probably depends on how they're used buy any info welcome.

Basically I'm trying to figure out if I should refactor to the metadata type setup suggested.

Performance should not be the issue. The problem is that they are exposed, and by design probably updated often and from many FSMs, making them a symptom of potentially buggy design (or bug prone). If your game is simple enough, little spawning, few or no prefabs, mostly unique game objects in a fixed configuration, you should have no problem. That is, avoid them.

Quote
The use of global variables makes software harder to read and understand. Since any code anywhere in the program can change the value of the variable at any time, understanding the use of the variable may entail understanding a large portion of the program. Global variables make separating code into reusable libraries more difficult. They can lead to problems of naming because a global variable defined in one file may conflict with the same name used for a global variable in another file (thus causing linking to fail). A local variable of the same name can shield the global variable from access, again leading to harder-to-understand code. The setting of a global variable can create side effects that are hard to locate and predict. The use of global variables makes it more difficult to isolate units of code for purposes of unit testing; thus they can directly contribute to lowering the quality of the code. Source: Wikipedia

14
Playmaker Help / Re: How to change default action names?
« on: October 08, 2018, 02:04:55 PM »
When you place the action in the state, you can double click on the title and rename it. Or select and F2 should work, too. Do this.

Don‘t rename the actual action scripts. This screws up updating them later, and referencing them, and so forth. If you really want to go ahead, ignore my warning, which would be a terrible idea, then you need to change the class name and the file name to your new name (this is a general rule), which must be the exact same in both cases, must not conflict with similar named scripts anywhere in your project, must not contain space or weird letters.

Also, when you change the name in script, all scripts of course lose the reference. You must delete those empty references, and place the newly named actions instead. Again, don’t do this. Rename the title once placed instead. See some other tips, while I am at it.

15
Playmaker Bug Reporting / Re: Prefab not being saved 100%
« on: October 06, 2018, 11:41:59 AM »
Afaik, it's working as intended and is the same with scripts. For the specific issue with Get and Set Property, you must use the Linker Wizard.

I remember that I had the same issue at first. I ever since design my FSMs without any drag/drop reliances. Get owner, get parent and such are your friend. When I need references to a script, I learned to write a custom action for this (if there isn't any on Ecosystem). Some good tutorials are here in the forum how to do the basic stuff like getting and setting basic properties.

Pages: [1] 2 3 ... 8