D
D
DstivjTS2017-11-07 09:55:41
Game development
DstivjTS, 2017-11-07 09:55:41

How to improve the simulation of battles in the game without displaying their progress?

It is necessary to simulate battles without displaying their progress on the screen. I can’t find anything on this topic, I found it on Habré ( “Big Battalions” in continuous time (simulation ... ), but it’s a bit complicated for me.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RabraBabr, 2017-11-08
@RabraBabr

If I understand the question correctly. Yes, an ordinary random will do. In the loop, we go through pairs of units and, depending on the characteristics, generate a random number, let's say from 1 to 100. Depending on the number that has fallen, we choose the outcome.
For example, an elephant against a penny. The elephant is large and kills the spearman in 90 percent, depending on the properties of the units. So if a number fell out from 1 to 90, then the elephant won, and if from 91 to 100, then the spearman. On average, 10 spearmen will be needed per elephant. True, we must not forget about the jokes of distribution. In reality, there may be situations when 1 spearman beats 5 bishops. Hello Warlord :)

S
Sergey Kormishin, 2017-11-07
@coremission

When developing such projects, and indeed large games in general, an architectural separation of model and presentation is laid in advance . And such a question does not arise, because the whole battle takes place (calculation of damage and other combat mathematics) at the model level, and the representation is responsible for the visualization.
Read about MVC, MVVM, MVP patterns.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question