How to set up a button combo without use of timers?
I have one working right now but it gets wonky past 2 hits in. I have (circle) as my input and this fills a [counter 1] which then plays an [animation 1]. If [counter 1] is full it will power on [counter 2] and if you press (circle) again while [animation 1] is still playing then the [counter 2] will fill and [animation 2] will play after [animation 1]. My main point of struggle seems to be when to get the counters to restart. It's easy for [counter 1] since you just need [counter 1] to be full AND [animation 1] to end. when adding the second hit then you have to wire that same AND with a NOT from [counter 2] full. and wire [counter 2] to restart when [animation 2] is done. so the NOT will send a signal once more when [animation 2] is done. A ton of stuff sounds good in theory but doesn't seem to actually work unless someone sees my flaw for this especially when going past 2 hits. I want to move forward without the use of timers as it sounds easier to mess with key frames etc later on thus making it easier to add on top of strings.
-
I'd need to see an image of your setup, but I think what you're trying to make could be achieved with a selector. Am I right in thinking you only want to go back to [animation 1] after all of the animations have been completed?
Let's say you have 3 animations, which need to activate in sequence each time you press circle. Add a selector onto your microchip with 4 output ports: A, B, C and D. Now wire the selector output B, C and D into your 3 animation timelines, in the appropriate order. Next, add 3 AND gates and connect their outputs into the inputs of B, C and D of the selector. Let's call them [AND B], [AND C] and [AND D].
Each AND gate should have 2 input ports. For [AND B] connect (circle) from the controller sensor and also the output of A from the selector. [AND C] should have (circle) and the output from the [animation 1] timeline (when it's complete). [AND D] should have (circle) and the output from the [animation 2] timeline. Finally, connect the output of [animation 3] timeline into the input of A for the selector.
With this setup, by default the selector will be on A and no animation will occur until (circle has been pressed for the first time. Each animation must be fully completed before you can press circle again to start the next one. You can also easily adapt this setup to add more moves by making the selector bigger and using the same pattern of logic.
You may also want to reset the combo if (circle) hasn't been pressed for a certain amount of time. This is fairly easy to add with some small modifications. Just make a timer for every selector output. Connect each timer output into the the selector's A input (you may want to place an OR gate in front of A if you're doing this.
By the way, I haven't had access to my PS4 for the last few weeks, so I won't be able to help you out in-game during this beta. If you can reply here to let me know how you get on, then that will be great, thanks. -
You need timers, pretty much, or signal manipulators that blend over time or something.
Here's the deal: combos work sequentially and you have to give humans some time to input the next keypress. There are different ways to do this, of course:
Some games have logic that branches to check your input at runtime, i.e. the moment you press a button. So when you press square for a punch, you have to give the user some time to input the next square (for a left-right, let's say), otherwise you'd have a frame-perfect trick that nobody really could pull off all that well.
Other games buffer your input. Basically, each input is arranged in a list, regardless of how far into your combo you currently are. Your animations (and damage, visual logic etc.) then runs sequentially, depending on different conditions. Here's how I'm thinking you could achieve this:
Make timelines for each move in your combo. Arrange them according to what move they transition into, e.g. left-jab in timeline 1, right-jab in timeline 2. Arrange them horizontally. Between both timelines, you'll have to do something a bit more complicated to check whether you buffered the commands. Double-jab combo will be square square.
When playing the jab, you'll have a check in place asking whether there is currently any other animation playing or a combo in progress. If not, you're good. You'd need to find a way to keep track of your inputs. I can't quite visualize how at the moment, but there's definitely a way. Maybe like this:
Have variables for each button. If your max combo-length is 3, three should do. Assign the buffered button presses a number. When you press any significant button, and if no combo is running, you assign the combo button's value to the first variable.
So, the first variable is stored. Somewhere you have logic that checks whether the variable is non-zero/a specific number corresponding to your combo moves. Since this is the first move, we want it to play instantly - we already checked if there is a combo going on, which it isn't.
Now, one jab takes a couple of hundred milliseconds, and that is enough to allow humans to enter additional input. We'll be using the "is finished" output on the timeline and wire it up to check whether we continued the combo in time. First of all, when the timeline is finished and combo variable number 2, as mentioned earlier, has a value of 0 (meaning we never entered something during the window), we want to reset the combo - something I glossed over earlier in this part. Which, basically, means resetting the combo vars.
If you want to check whether you're in a combo, you just have to check your combo variables. On ending each timeline, you check whether the next possible combo moves have a corresponding variable, if not - you just break out and reset whatever would prevent you from starting a fresh, new combo.
There's lots to consider and it can get confusing, but if you know the basic structure, things can get easier, You also don't have to buffer inputs, although I think it'd be a nice project. And remember to share your stuff so we can look at it, debugging verbally is way slower, regardless of how happy I am to help. This was more like a conceptual tutorial.
It's totally feasible, by the way. I've experienced a bug where the in-game animation differs from when I play it back in my timeline, so watch out for discrepancies; some bugs still need fixing. -
There's totally an easier way for either of these, I pretty much described what to look out for and what might be needed to get it working reliably.
-
Ok, I just re-read you first post (pro tip: add paragraphs!) and I think I slightly misunderstood what you want to do. I take it you only want the next animation to play, if you press circle again before the current animation is complete?
This should be achievable by adapting the system I outlined, although it's slightly more complex and it might be difficult for me to explain properly without having access to Dreams myself to test the method. I'm still certain it can be done without timers.
One of the changes you'd definitely need is for the completion output for every animation to be wired into an AND gate, which connects to OR gate, which then connects to [selector A]. Disconnect (circle) from [AND B - D].
Create 3 counters, with a current count of 0 and a target count of 1. They should be placed to the right of the selector. Also create 3 more AND gates and connect them into the counter's 'increase count'. Use the selector outputs A, B and C to connect to each of the 3 new AND gates. Wire (circle) into the other port of these 3 AND gates. Now, take the 'count complete' for each counter and connect them into [AND B-D] (using [counter A] to [AND B], then [counter B] to [AND C], etc.).
Add 3 NOT gates to the right of the counters. Each 'count complete' should be connected to a NOT. Take the outputs of the NOTs and connect them to the spare input of the appropriate AND gate in the top left area (the AND gates which are connected to an OR gate, which connects to Selector A input).
Also, you'll need to connect something to each 'count reset', most likely the appropriate outputs from the timeline completion (you might need a self-resetting 0.1 second timer to act as a buffer, if the logic timing is causing the counters to reset too early (before they can activate the next selector input)).
Well I hope this is enough to get you started, there may be an oversight or two in this design but you should be able to work out any bugs without making too many changes. -
first time using the feedback site so sorry if I get things wrong.
I guess I can't edit/ add an image after? :(
@OgTheClever,
Sorry for no paragraphs, I was on mobile late night when I posted because I was frustrated haha
Yes, the timeline and its keyframes are technically a timer. so lets say the duration is 0.58 seconds for the animation? you would only be able to press circle again to activate the next hit while the current animation plays. But if I want to adjust the animation later on, I'm already adjusting a timer here and that's all I need to mess with.
Let me read what you outlined but I'll still reply in order of everything else.
I'm not familiar with selectors and exclusive gates and they seem to be my holy grail at the moment. I may ask you how to wire that up more specifically later on if I can't get it right.
Ahh I see you already wrote specific instructions on how to do it. I'll have to try that tomorrow since I'll be busy all day today :/
Yes, I tried a self resetting 0.1 timer for resets actually but couldn't get it to work right. I had it to reset when counter full but it would continuously play and reset so my first animation would restart and play again immediately if I pressed circle again. I then tried it with completion pulse of the animation but I forget what went wrong there. I'll look into it more again later.
I see you typed a comment before that one so I'll get into it so I don' have to address you again further down.
I can send you a pic of my set up through PSN if you'd like unless it can be uploaded through mobile here. But yes, I want to reset the combo and go back to the first animation if the combo is complete or an animation ends and the next counter is not filled (the combo isn't completed)
Ah, see I tried using a selector before and couldn't get it right but it sounds like that would work (minus the times but your later comment elaborates on that)
No big deal, I can keep you updated through here (if I can contact you personally or you get notified to updates on this post)
@skillphiliac,
with the current set up, the timelines for the animation are timers. So if you press (circle) (circle) really fast the 2 animations will play, or if you do it more slowly then there is no difference, as long as the animation hasn't ended for the previous hit you are good on this. I can have visual changes such as a glow on the character to aid players to let them know the progression of the current animations timeline. Like hey, when you're glowing red when performing no animation but it will change to white until the animation ends, which will then put you at red or something again to let you know you can start a combo once more.
That actually sounds a lot on how I have it! I uploaded the demo over the weekend since I was looking if you could have different combos play based on whether you're walking or not, and that's when I started getting into this. What is published is not tidy as I only wanted to see how far I could get into it but it should be remixable. If it is not contact me here or on PSN and I will do that for you. I have messed with it a lot more since and tried many different way to get it to restart all the counters but there are some constants always such as:
timelines will always have a counter to them. Animations past the first one require current counter to be full AND previous animation to end, that way you don't cancel the current animation halfway when pressing the input. Counters past the first one require the previous counter to be full AND the input to be pressed to increment it.
I'd have to actually be looking at it to give you more info but like I said, the original is published so you can search it there! -
'@xXEl_DonXx Thanks for the reply. If you want to try out my method, then set it up first as I outlined in my first post, then edit it based on my post 2. I'll be able to see if you post back in here, although I won't be able to use my PS4 for the next couple of months.
الرجاء تسجيل الدخول لترك تعليق.