🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Gameplay

posted in trill41 for project ABx
Published April 02, 2019
Advertisement

For the last two years I worked almost only on the foundation of this project, e.g. networking, how servers communicate, database back end, different network protocols. Now that this works more or less, I started to work on the gameplay.

Party

Cooperation is a big thing in this game. You meet in outposts, form a party and enter a game instance with this party and do stuff together, e.g save the world.

Implementing this was quite tricky for several reasons:

  1. A lot of communication between the server and the clients is needed.
  2. Player and Party objects exist only on the game server.
  3. The clients party window is complex and needs to handle many events.
  4. There are many situations a party must behave differently.

Client/Server communication

First a player must invite another player. The invited player can accept or decline the invitation.

party_invite.png.1fd7474d8705d7a7765f04478c0ec356.png

If the player accepts the invitation, it will be added to the party.

party.png.9aa57ab814616aa4e8b9cb35faafe3c1.png

Of course, party members can leave the party, and party leaders (the first player in the window) has special rights. They can kick party members and invite new players.

Entering a game as party

As mentioned earlier, when a player enters a game, it disconnects from the game server and reconnects to it telling the server what map it wants to enter. Since party objects only exist on the game server, these are destroyed when the players disconnect. But to be able to reconstruct the party when entering the new game instance, this information must be saved. I decided to (ab)use the data server for that.

Mapping

The are two distinct map types:

  1. Outposts. People can meet there and make a party.
  2. Battle areas. People face foes there and fight them.

You can map from one outpost to another outpost. Party members can not do that anymore, except the party leader. If other members want to map to another outpost, they must leave the party first.

If there is a portal that brings players to a battle area, all members can go through it, and all members of the party will enter the same battle area instance as a party.

Once in a battle area, players can not leave the party anymore, but they can map to an outpost. This will cause that these players will leave the party in the battle area. If all players of a party in a battle area type /resign they will be brought back to the last outpost. Also the leader can not kick members anymore.

There are probably more edge cases I'm not aware of at the moment.

Melee attacks

When players are in a battle area, they can fight foes. However, identification friend or foe does not work great yet. At the moment you can attack anyone not in your party.

melee.thumb.jpg.ce25a3c7235550c5fbd599d6ea515f0e.jpg

The damage depends on many different things:

  • The weapon that is used by the attacker
  • Any effects that increase damage of the attacker
  • The armor of the attacked
  • Any effects of the target that reduces damage

At the moment the damage is always 5, that's because equipment is not implemented yet, so the attacker does not have any weapon (just their fists), and the target does not have an armor.

Once the target is dead, the attacker stop attacking.

melee2.thumb.jpg.ac8fd43b1a3b297afd32982412a91045.jpg

Now that all foes are dead, we can resign.

resign.thumb.jpg.e17069a5f25ac5cc711172a5b165024d.jpg

Oh, by the way, I celebrated the 1000th commit some days ago! Next celebration is the 1337th commit ?. Some other stats (only code I wrote, no third party libraries, STL etc.):


-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C++                            308           6804           2209          47292
C/C++ Header                   395           3049           1558          18012
LESS                            15            833              7           5069
Lua                             74            301            329           1384
XML                             12              0              1           1354
HTML                            12             90             24           1032
JavaScript                       1             28             24            183
DOS Batch                        6              9              8             22
Markdown                         3              6              0             12
CSS                              1              0              7              2
-------------------------------------------------------------------------------
SUM:                           827          11120           4167          74362
-------------------------------------------------------------------------------

 

Previous Entry Collisions
Next Entry Items and AI
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Advertisement