Richard and Ian are back with their State Plugin that they worked on for their last two streams (Part 1, Part 2). Now they are using it to not only control quests, but to detect an input combo was triggered for a fighting game. Come see the versatility of C++ plugins in UE4!
Feel free to ask any questions on the topic in the thread below, and remember, while we try to give attention to all inquiries, it’s not always possible to answer everyone’s questions as they come up. This is especially true for off-topic requests, as it’s rather likely that we don’t have the appropriate person around to answer. Thanks for understanding!
When you wanna fix a problem that will take a couple minutes and Ian says no lol. Like auZON3 asked, is this plugin gonna be in the marketplace? Or should we just wait until all the videos are done to go through this tutorial… And about how many videos is this gonna take? Pretty hard to focus on the tutorial when its done bi-weekly. I understand time management is a huge factor, but I’d really hate to see this take 2+ hours per video as well as half a dozen+ videos over the course of months. Any clarity to keep people interested?
Well, we did have a hard 4:00 stop time that day, and it was 3:57 when he called it. I had enough material for at least another 15-30 minutes, so at some point we did have to call it, we knew from the start we weren’t going to get to the end (that’s why we did the preview of the mannequin doing punches at the beginning) and Ian let it go as long as he could. We’ll be back next week to pick up right where we left off.
I don’t think we’ll need to do quite that many streams, but there’s not much I can do about the two-week pacing. This series is a little long because we jumped topics a lot. We’ve hit code plugins, state machines, the quest-tracking system, and now fighting game input. Also, our next stream will not be a 2-hour one. It might even be the final stream for this series, depending on what people want to see.
hi, i have question i changed UFGInputBranch base class to USM_BranchBase and then compiled, but in the editor still see AcceptableInputs from USM_Branch class?
i restart the editor but the problem is not solve.
i search and the answer is i should Delete Binaries folder from root project. this is solve the problem, but why i do this way?
(Editor version 4.16.2)
That’s very strange. Recompiling the project should have fixed it, and even if UE4 had a hot reload bug, recompiling and restarting the editor definitely should have done it. I’m not sure how that could happen, given what you’ve said here. This might be a good question to ask our QA people. Can you provide a sample project or any further information?
I found the problem, when i change the source code and hot reload, editor show a warning(Load hot reload is failed) and compile icon from the editor is hide.
error message: “Unable to load module… because the file couldn’t be loaded by the OS”
so for fix this issue i close the editor, remove Binaries folder and then build the solution from visual studio
Hi, I’m developing a online multiplayer, 3rd person fighting game with weapons using your fighting state plugin. It’s working well so far on 4.18 and I have plenty of long combos functioning. I was wondering what am I supposed to replicate in regards to your fighting state plugin to get multiplayer to work. My guess is I would just have to replicate the DoMove function in blueprints because that is what plays the montage. Or do I have to replicate anything in the state classes like FGAtoms, FGInputBrach, FGMove, FGMoveLink or FGState?
Also, I heard from some people that networking such a game(with combos and accurate collisions) is very difficult and it might not possible (due to too much data having to be sent). What do you think?
Usually, fighting games have two players, so it’s really not a lot of data at all, once you realize what information you actually need. As there are numerous examples of online fighting games, including those using UE4, I would say it’s proven to be possible. Rather than data size, I would say your biggest concern will be lag, or network latency. Fighting games often require split-second reactions to your opponent’s moves, and there are usually some moves that are deliberately so fast that a human being isn’t supposed to be able to block them “on reaction”, but rather they must be anticipated. Throwing a random amount of internet delay into the mix can damage the experience if you don’t build your game around that expectation. I would suggest replicating whenever a character issues a command input that will cause a change to a new state. I would also suggest putting a delay in the input if your game is primarily meant to be played online, though you may (or may not) wish to disguise this from the local player, depending on how your game is supposed to feel. While having lots of input lag isn’t desirable, a small amount may be acceptable. For example, if you put a 100 millisecond delay in your input, that is, when you detect a new move input, you wait 100 milliseconds before actually starting the move, you can play with a P2P connection and have up to a 200 ping without either player feeling the lag. This is because you can transmit a message saying “Do move X at time Y” as soon as the input is received, and as long as the far side receives the message before time Y, the move will begin in sync on both machines. You’re basically just buffering your moves slightly ahead of time to cover for some latency in your network connection. The shorter the buffer time, the sharper your game will feel, but the longer you make the buffer, the smoother and more consistent it will be online. Finding a balance is going to be a matter of tweaking that delay time. I would suggest looking up articles about how the major fighting game franchises do it, especially since several of them are using UE4. Thanks for your question!
EDIT: Oh, almost forgot. Things like position syncing can be done with state-change input updates to ensure that each move starts from the right place. Barring really bad lag, this should be OK since the game’s moves generally control the character’s positioning completely. If your game has more free-form movement, then using a standard position update like you would in a shooter or any other game would be fine. Fighting games should actually be an easier case for this because movement in fighting games is highly deterministic based on what techniques the fighters are performing.
Thx for the help. The game we’re making is pure multiplayer with matchmaking and there can be up to 4 players playing together in a death match scenario. Player have weapons (swords, axes, etc) and can do combos with it. The mechanics are similar to some of those hack-n-slash mmorpgs or God of War. So its in a 3D open world environment.
I’m slightly confused how they would be in sync when you add the delay. Wouldn’t there always be the same lag since the only change you’re making is delaying it by a small offset? Do you mean after I receive the input, I should check the time it was supposed to execute and wait for the remainder of the delay until that time, and then execute it? So does that mean the receiver decides when to execute the inputs? Sorry, I’m not that experienced with networking. The only online game I made was a simple online wave-shooter using blueprints. I’m definitely going to look up some articles as you suggested.
Oh yeah, I forgot to add. The way I’m doing collision detection may cause a lot of lag when networking which is my concern. All the weapons have multiple sockets attached to it. I do a SweepSingleByChannel with a Sphere between last socket positions and current socket positions every tick in an array (each entry in the array is a socket on the weapon). So the game is constantly updating socket positions and when there is a hit detected, I break out of the loop and return that hit result. Because this is happening every frame, I feel this might cause lag issues when I network it. The trace only happens during a certain section in the move montage. So when the sword start swinging, I enable collisions through an anim notify and at the end of the swing, I disable it. So the trace happens only when collision is enabled. Not sure if this changes things from what you mentioned earlier.
Yes. Playing over the Internet has lag, so network programming always has to deal with that. As a result, making online games requires designing the games around the lag. For example, look at the Souls games past Dark Souls. All of the parry options used to be instant, they happened in one frame. As PvP got more popular, they started compensating for lag by making delayed parries the standard, so the game was more about setup and anticipation, and less about quick reaction times. The same thing can be seen going from Soul Calibur 4 to Soul Calibur 5 - more resource management (bars), fewer moves, but more focus on second-guessing the other person. You may need to design your game around lag to some degree.
Yes, exactly. So instead of saying “I’m doing Move X right now!” (which is guaranteed to be late), you say “I’m doing Move X at Time Y” (which is hopefully not late). All players will need a synced game time, which you can get by having the server tell them what time it is and subtracting half your ping from that. E.g. if the server says it’s time 5000 (milliseconds) right now, and you have a ping of 100, then it was roughly time 5050 (milliseconds) when you received that message from the server.
You can do a few things here. One, simulate the hits and any particles/sounds/etc. or whatever on each client, but have the server verify the hits and actually change health values. This can look a bit odd, as there may be some times the server disagrees with the client, meaning either an attack that hits but doesn’t play the impact effects, or an attack that misses but does play impact effects, but it does minimize traffic and makes the effects come out at the right times. However, you’ll still need the server to arbitrate, because even two non-cheating players might disagree about whether or not a certain attack landed.
Another way to do it is to have the server decide everything and then tell the players “you got hit with Move X at Time Y”, in which case the player’s local machine needs to make the hit reaction happen. This is probably your safest bet, because this puts all clients on equal footing and ensures they all agree on what happened during an exchange. You might even give the same 100 ms delay, so the server is really saying “Player A got hit by Player B with Move X at Time Y” to all clients. Player A is then allowed to continue whatever move is currently being performed until Time Y, at which point the hit reaction takes over. As a note, the server can actually use a shorter delay than player inputs, because the server’s messages go straight to the players, while player messages will go to the server for validation and then onto other players, meaning server-originating messages get there in one “hop” rather than two. But at that point, we’re talking about configurable variables that you should tweak when you have a working prototype and a reasonable testing environment. I hope this helps!
It definitely helps. I guess I’ll have to get a multiplayer prototype going to determine what extent the lag affects everything. Then I can change responsibilities of the server and client and set appropriate delays for better gameplay experience. Thanks for the tips!