C++ C++ : 1st Person Melee Combat in

Recommended Posts

This game's 1st person mechanics really caught my eye.  Mordhau Would anyone know the beginnings of the programming required for combo moves from the player?  I understand this is a general question and has a broad answer, but any advice from someone who has programmed something similar on the PC is appreciated. 

Note: I intend to start with the Unreal engine.  I am very early in C++ (I worked as a concept artist previously so all my game's UI/World mechanics have filled notebooks upon notebooks without programming to realize them).

This is my first post on this forum, please excuse me and notify me if I am posting in the incorrect area.  

Thank you

Share this post

Link to post
Share on other sites

To program combo moves, you'll probably need to start with a queue data structure: i.e. as the player presses buttons, you'll want to enqueue those key/button presses, along with a timestamps of when the key/button was pressed. That will allow you to evaluate whether or not the player entered a "do something cool" key combo, and if so, you can then kick off some action, such as the "animate the character doing something cool" animation.

Bear in mind, I've never used unreal engine, so I don't know the particulars of what do with it. But generally speaking, combo moves call for a queue.

Share this post

Link to post
Share on other sites

Okay thankyou.

Started browsing through Game Programming Patterns by Nystrom and found this page on queues with audio files.  http://gameprogrammingpatterns.com/event-queue.html

Is this similar to what you mentioned?  

(You can assume this is like reading Elizabethan English backwards with abbreviations for me right now)

Share this post

Link to post
Share on other sites

That article is a part of the solution. The article is about sending data around between systems.  Usually in games there is an event system that any code can listen to which says what has happened.  That's the system described.

Your combo system can be listening to the events described in that article.  When the combo system notices specific event patterns it is looking for, such as multiple hits in a row without a miss or a block or an enemy hit, then it can react as a combo.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Similar Content

    • By ekeagle
      I've worked many years in IT network security and another support related jobs.
      I really want to become a game developer and even made a video game as my university graduation project.
      I feel I need to learn more so I can program in a more elegant way.
      I'm actually unemployed and I'm not sure if the best decision is to struggle to get a job as a back end developer so I can develop more my skills in algorithms and more elegant ways of programming, while I also learn some digital animation after office. There aren't many game development jobs here and I just want to create my game by myself.
      Should I become a back end developer or should I just keep taking IT support jobs while making games and keep learning in my free time?
      Which is the best decision ?
    • By th3luck
      Hello everyone! I have decided to make a crane simulator (first person with view from cabin). Mostly, I aim on realism as I want this simulator to be used by real сrane operators to upgrade their skill. That's why I need an engine to easily work with physics (such as wind, rain, weight of cargo and etc). Have to mention that I don't really care about graphics quality. Maybe, but this has the least priority, after completing the whole project I would need a VR version of it, but for now I am planning just a PC version. 
      Here is main points of my project:
      Physics has the major priority Using tools suitable for a beginner developer Ability to make a VR version of the simulator without rewriting of the whole project My experience in programming is mostly in computer science, so I am familiar with C++ and Python, but only on a level of coding some cool algorithms. That's why I don't really depend on a specific language. 
      What engine and developer tools would you recommend to use? Easy to being with for a low-skilled like me, but suitable for my project.
    • By NeverSay
      I think I might be with a team that is deep within development hell and they are all in denial about it. I have been working on a project with a small group and we all have no previous experience or educational background. The guy who had pulled us altogether had an idea for a game but the story is so confusing and convoluted after 3 years of working on this project... I still have no idea whats going on with the story. All I can say is its a platformer with a large explorable map and systems and mechanics dreamed up so grand out of all the 100 things he wants in the game we still only have 2 mechanics down. Every time I have tried to throw my voice in and suggest maybe we should put a pin in this idea and focus on smaller experiences so we can build our skills up and tackle it later when we know more of what we are doing, I get shot down. I'm told, "oh it will only take a year to make this game" of which both I and the artist look at each other very doubtful each time he says that. 
      So leaving out the backstabbing power plays a certain member of the team kept using which blocked me from having access to the game so I couldn't test out my work for myself, phage requests on what they wanted animated which lead to me redoing animation more time then I think was needed. I mean I redid the run animation over 60 times and in the end, they chose to use the very first freaking one I made! Whenever I tried to think logically and ask for a group meeting to talk about characters and how they move so I could get a better idea of what to do I was told "No, no, no this back and forth is a faster way of working"....again run animation took 60 attempts before they used the first run cycle I made. 
      In the end, we weren't working towards making the whole game, it took us 2 years and 5 months to make a demo of the game. Then our programmer disappeared and also took with him the code for the game. We should have stepped away from that game and accepted, for the moment that it might be time to take a break from it and focused on crafting smaller experiences to build up our skills and our group's portfolio but no that wasn't to be. We where to start again from scratch, new programmer, new textures and level designs and new rigs and animations. 3 years of work has gone down the drain and now I have to start again... the only problem is I can't bring my self to do the work. 
      I have become stagnant where I am and I feel like its time I should move on. I want to try and do things my way and start small and work my way up and not plunge headfirst into a project that feels like an ocean in scale for a small team. I want to focus on my own skills and learn new ones and understand more than just one trait in the spectrum of game design. Though since I have been with the team for so long and put so much time and money into this venture...I'm scared to walk away. Though on the other hand how long are we gonna spend on this game, is it gonna be another year like the lead designer said (again and again) or will it be another 3 and all we will have to show for it is a shiny new demo and none of the full game...
      Should I suck it up and try and kick my butt back into gear or is this the time to step away and look into new possibilities?
    • By DogmaStudios
      What techniques do you use to help develop the plot alongside gameplay when you finally have an idea for a story down?
    • By Josheir
      void update() { if (thrust) { dx += cos(angle*DEGTORAD)*.02; dy += sin(angle*DEGTORAD)*.02; } else { dx*=0.99; dy*=0.99; } int maxSpeed = 15; float speed = sqrt(dx*dx+dy*dy); if (speed>maxSpeed) { dx *= maxSpeed/speed; dy *= maxSpeed/speed; } x+=dx; y+=dy; . . . } In the above code, why is maxSpeed being divided by the speed variable.  I'm stumped.
      Thank you,
  • Popular Now