Development of a computer PVP strategy game «COSMOS»
Автор: Сотников А.В., Зори С.А.
Источник: Международный научный журнал «ВЕСТНИК НАУКИ» № 3 (72) Тольятти-2024, Том 3 с. 428-435
https://www.вестник-науки.рф/archiv/journal-3-72-3.pdf
Abstract
Development of a computer PVP strategy game «Cosmos» The article explores the development of computer strategy games using the methods of PvP and PvE game models. The process of developing and testing a computer strategy game «COSMOS» has been described in the paper.
Keywords
PvP, PvE, strategy, algorithms, client-server, task scheduler, asynchronous programming.
Introduction
The PvP game implies the possibility for players to attack each other in accordance with the rules of the game.
The term appeared in order to distinguish the game of a person against computer—controlled characters (that is, the environment from the English environment — PvE) from the game against other players - PvP. This separation of terms has become necessary to explicitly separate the game against other players and against the game environment.
The purpose of this article is to analyze the basic models and algorithms of the developed computer PvP strategy game "Cosmos".
General characteristics of PvP games and their difference from PvE
PvP means player(s) vs player(s), that is, "player(s) vs player(s)", whereas PvE is player vs environment, which translates as "player vs environment". So in PvE games, you're up against computer-controlled enemies. These are often casual games.
The difference between PvE and PvP is as follows. PvE games, for example, online shooters with PVE mode, are single-player games in which everything is strictly regulated. In such games, the element of randomness and unpredictability is minimized, because the development of the game does not depend on the behavior of the participants. In a PvE MMORPG or PvE shooter, "environment" can mean an enemy monster or an abyss with lava, or even your computer-controlled opponent in a card game.
The computer PvP strategy game "Cosmos" has a PvP mode, that is, players will play against each other, but first they will need to develop their environment and science.
Descriptions of game models and algorithms implemented in the game
When developing the game, the NET Framework [2] software platform was used, which supports interlanguage inheritance, interlanguage exception handling and interlanguage code debugging and a set of components.NET, known by the common name ADO.NET, allows efficient access to relational databases and many other data sources.
C# was chosen as the programming language for game development [3], as the language is used for developing games for Windows, macOS, Android and iOS. It's all about Unity, a platform for working with 3D graphics. C# is better adapted than other languages to work with this engine.
Any strategic game should allow for the variability of its passage and player development.
There are three options for player development in the developed strategy game:
- The production path - that is, the player does not interact with anyone and develops his planet in industry.
- The research path is similar to the production path of development, but with one exception, research affects everything in the game: construction, navy, defense, science.
- The military path is the most interesting and very dangerous in the game. You need to hire a fleet from a simple transport to the most powerful warship. Balance it and go conquer the planets of other players, destroying their fleets and defenses if you have the strength to do so.
Each type of development has its own ranks and levels, which, after passing, the player will receive a new title. Production and scientific must be developed in order to open up new elements - ships or defensive structures that are needed for the military path. There is also a general rating for all these categories (buildings, science, navy, defense).
To implement the game in real time, you need to create a server (task scheduler) that will process all requests from players for actions that require temporary updates. Figure 1 shows how the client (player) and the server interact.

Figure 1 - Interaction in the game between the client and the server
Figure 1 shows the source code of the game Space.exe receives and exchanges data with the library Headers_games.DLL this library communicates with the DBMS server. Responsible for monitoring data updates in real time Server.exe – task scheduler. This server operates in asynchronous mode [4] as it is necessary to perform several functions to update data simultaneously.
The updated data in the game include: buildings, science, fleet and defense hiring, fleet flight, and combat between players.
Updating these buildings and science is an improvement of the facility to a new level of development. For example: the player chooses to build a shipyard, the object has initial parameters before improvement: level, resources for construction, time improvement. After the improvement, the shipyard will be one level higher (if it was 2). That will become level 3).
Updating fleet and defense data is the hiring of a fleet/defense in quantitative terms. Since there are many different units of the fleet and defense in the game, each of them has its own starting parameters: attack, defense, shields, flight speed, cost of hiring (metal, crystal, deuterium), time to hire one unit.
Fleet Flight Upgrade is the movement of a fleet from one planet to another with one of the missions: to explore the planet or attack the planet. It has a set of parameters: coordinates of the planet of the start of the path, coordinates of the planet of the end of the path, mission, flight time to the target, fleet, cargo.
The result of updating the fleet flight during the "explore the planet" mission will be data on what is on the planet of another player (Fig.2).

Figure 2 – Example of the espionage report form
The result of the upgrade during the "attack the planet" mission will be a battle between two players. The battle may end in a draw or a victory for one of the players and the complete complete destruction of the other player's fleet. And if the attacking side wins, then the player also makes a raid of the planet (takes half of all the resources that were on the planet at the time of the battle).
The battle report is printed on both a web page and as a table using JSON packages to generate it (Fig.3).

Figure 3 – An example of a battle report between players
Updating battle data between players is a complex feature that includes a number of sub–functions:
- Getting information about the fleets of the pretending parties
- Getting the main bonus characteristics as a percentage
- Calculation of the battle between the players
- Updating data after the battle on the status of player fleets
- Accrual of exp to the winning side
- Updating the military rank of the winner
The algorithm of the "Battle between players"
The combat algorithm in the game is implemented according to the principle of the strength of the weight of one volley from all ships on each side, as well as the general parameters of armor and shields for all ships. Such an algorithm will simplify the way to account for damage to ships taking part in battle.
The first blow is made by the attacking side, and the second by the defender, and so on alternately until the complete destruction of one of the sides.
The algorithm calculates: as long as there are shields, then the blows will fall on them without losing the fleet. As soon as the shields are knocked down, the armor of the ships takes a hit and the destruction of ships from the weakest to the strongest begins.
The battle is won by the one who survives at least one of the ships, he will be awarded all bonuses and points, as well as elevation to a new military rank (rank).
Conclusion
The general characteristics of PvP games and their difference from PvE and how they are used in modern games are carried out.
When developing the computer PvP strategy game "Cosmos", a variety of ways of passing it was implemented: production, research, military. Each of which is connected between and depends on the other. The possibility of communication between players.
For a correct real-time game, a server has been developed that updates the data in the game according to the code command and the time of its execution. The server works asynchronously, which allows it not to be overloaded and achieve high performance when processing more requests for data updates.
Despite the many advantages, there are also disadvantages in the game:
- There is no PvE mode, this mode would make the game even more interesting and variable in terms of player development.
- The game is implemented in 2D mode - that is, there are no visual effects and three-dimensional models of battles, planets, space.
List of sources
- PvP type game combat [Electronic resource] - Access mode: https://ru.wikipedia.org/wiki/PvP
- NET Framework [Electronic resource] - Access mode: https://microsoft.fandom.com/ru/wiki/.NET_Framework
- Programming guide in Windows Forms [Electronic resource] - Access mode: https://metanit.com/sharp/windowsforms/
- Asynchronous programming in C# [Electronic resource] - Access mode: https://docs.microsoft.com/ru-ru/dotnet/csharp/async
- Working with JSON [Electronic resource] - Access mode: https://metanit.com/sharp/tutorial/6.5.php