GAMES GATHERING 2021 KYIV

The benefits of polymorphism and inheritance in GE of games

Talk recording: The benefits of polymorphism and inheritance in GE of games

Maksym Sliadniev

Hall:
Air Hall (Production Track)

What the talk is about

Maksym Sliadniev uses a free-to-play pony tycoon game to show how polymorphism and inheritance speed up development of a bundle-selling feature. A base bundle class exposes virtual methods, and descendants (currency, costumes, ponies, presets with ready-made object sets) override granting and purchase. New game-designer requests, such as quantity limits or hiding a unique item the player already owns, are added in one place, and a new bundle type takes under a day with little risk of bugs. He warns that inheritance is not always right, so real-money payment was moved into a separate billing class via composition. He also advises against building for needs that may never arise. He ends by mentioning Unity prefab variants as a similar mechanism. In Q&A he suggests adding flexibility only when it is cheap and checking it with future users. Useful for gameplay programmers.