N
N
Narical2016-10-09 21:50:05
C++ / C#
Narical, 2016-10-09 21:50:05

How to choose the right design pattern in the game?

I'm making a small game (my first project) - sort of a turn-based roguelike.
Implemented the generation of the battlefield, the placement of monsters on it, the generation of power-ups and objects (the object is a spell that can be cast by spending mana).
I ran into the problem of adding spells to existing code - they are all different and the effect must be included in different parts of the code at different abstraction levels. For example, a spell that allows you to attack first - its effect comes into play when comparing initiatives in the combat calculation function. A spell that adds a % bonus to damage should do this inside the player's stats recalculation function, because the bonus should stack with others before rounding, Fireball should cancel the fight altogether ...
Studiedbook on design patterns . I learned a lot, everything is very cool - but I don’t know how to apply any of the described patterns to my situation.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Bobkov, 2016-10-09
@heksen

For demo use MVP. The Internet is full of materials.

A
AxisPod, 2016-10-10
@AxisPod

Design patterns seem to be completely out of place here, games and learning programming are not very compatible things. For the correct OOP will lead to the burning of the chair. One way or another, here you need to dig in the direction of the State Machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question