Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Multiplayer turnbased battle game suggestions?

Hey everyone.

A while ago I was working on a fully evented multiplayer turn based battle game.  The game was quite simple.  It gave two players the option to choose between a slew of characters.  Then each player took turns.  They each had 5 spaces to move within the map, then they could rest, heal, or attack.  Rest would restore one energy, heal would restore one hit point out of ten, and attack would allow them to choose from different attacks.  Ranged, melee, and magic.  Each successful attack gave the player experience and when they had enough, they could learn a new attack, get new weapons, armor, and so on and so forth between each round/game.  It was quite epic actually and it would have been extremely addicting had I finished it.

My problem was/is this.  I had no idea how to use events to check to see if the two players were close enough for melee, or far enough for ranged.  So I came up with this idea.  Let me know if you think it would work correctly.  (My girlfriend is an aspiring math teacher and she helped me out a bit... I'm NOT an aspiring math teacher. XD)

I used a common event to record the first and second player's x and y coords.  Next, I checked to see which was higher between the x's.  The lower of the two coords was then subtracted from the higher.  Then the same was done for the y.  Then I checked to see which was higher between x and y.  Then the lower was subtracted from the higher.  If the end number was less than 2, a melee attack would be successful, if not, a melee attack would get a "too far away" message.  A ranged attack, however; would be successful unless the range was over 5 spaces.

This was the only way I could see to get the game to work.  But after I ended up getting ONE segment of this to work, then something else would go wrong, and eventually, the entire system would stop working all the way back to the "IF variable:  'move' is >= 1, move up." stopped working and you couldn't even move the players.  Ultimately I gave up because it got so complicated.  But if I could get some advice on how to simplify the game, I'd like to give it another shot.  The prototype game was quite fun.  lol.

I know this post is extremely confusing, but I honestly don't think I can simplify it anymore than it already is....  I'm sorry!
Thanks
 
That was rather difficult to understand, but I think I've got it  :wink:

About your distance checking method, everything seems fine up to the point where you subtract the x and y coordinates. You should add them instead, and then check if the sum is less than 2. Using this method, you can check if the opponent is on any of the 4 surrounding sides.

If your problem lies with the eventing rather than the math, though, you'll have to post everything you have so far. Otherwise it might be a tad difficult to figure out the problem.
 
Are you sure that would work?  If player 1 was on 4,5  and player 2 was on 4,6 they would be close enough to attack.  But you... Oh.  Wait, you mean add player 1's x and y?  Like...  Player 1 is 9, player 2 is 10?  Then you subtract the higher from the lower to get 1?  Meaning that they are definitely close enough to attack?

I think that might have been the problem I ran into.  The event systems were sooo long and confusing that it was almost impossible to write them out without confusing the hell out of myself.  But I think I could do it now that I've simplified it a bit.

If anything, writing all this out has helped me understand it better, meaning that I'm sure I'll be able to finish this game up.  Thanks a million, Regi!
 
Okay, this is an update.

I believe I've got everything working again, EXCEPT for the step system.

Since it's sort of the same type of question, I'll post it here.  How do you suggest giving each player 10 spaces to move per turn.  And then how would I remove only 1 step every time the players moved.  And on top of that, how would I freeze the first player without freezing the second also?  I can do it vice versa quite easily using the WASD keys for the p2 movement. 

Help??
 
I don't know how well this would work, but you could replace the player with an event (so you'd use 2 events for p1 and p2). Set the player to "Through", and use "Change Transparent Flag" to make him/her invisible. Then place the player in the center of the map. If you use this method, make sure to change the variables so it refers to an event, not the player.

Now, use a Parallel Processing event for movement. You can have one page for each player's movement. When it's P1's turn (the first page), set a variable (let's call it Movement) to 10. Now use "Button Input Processing" to check if the left, up, right, or down arrow is pressed. Use a Conditional Branch to check if the variable Movement is greater than 0, and if so, have the player move in the selected direction and subtract 1 from the variable. If the variable Movement == 0, then all 10 steps have been reached, and another event (page) should be triggered.

Repeat this for P2 (on a second event page) and it should work. Seeing as they're on two separate events/pages, only one player will be able to move at a time. Just use a self-switch to switch between the two players' turns.
 
Perfect.  That really was a great idea.  I kept ending up subtracting like 3 of the steps variable every time I moved the player because I held the key too long.  But I guess if I use a "wait for move completion" then it should work great.  And that way, moving into a wall won't subtract steps.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top