Answer the question
In order to leave comments, you need to log in
How to create a "library" for NPCs in C++?
Comrades Programmers, I'm new to C++ so please explain in "understandable" language.
How to create a "library" for an NPC in C++ that includes all the necessary information about him: his characteristics (strength, level, etc.), data (name, weight, etc.), his movement on the map, and etc.
Thanks for your attention, that's all for now.
PS Code examples would be helpful.
Answer the question
In order to leave comments, you need to log in
From such a question it is clear that a person still does not know programming well, but is already trying to program a game.
And here there are two options.
1. Engine from scratch. A thin graphical layer like SDL, which leaves 100% freedom to engine writers, is also “from scratch” and is highly recommended even for advanced ones (you don’t need to write all sorts of Alt-Tabs and other rubbish far from the game). Then let him start with a “python” ( https://ru.wikipedia.org/wiki/Snake_(game) ) or a text quest.
And then, when he gets to a platformer or CRPG, he will understand how to attach characteristics to a monster.
The first approximation (not very scriptable and suitable for platformers/action-RPGs, but unusable in real RPGs) is to make each computer character a "class" (not to be confused with the OOP class), including the amount of HP, appearance, etc. As well as a "set of scripts" - for behavior in dialogues, programmed movement, transformation from a "dummy" into a computer enemy, etc. Without a set of scripts, he is just a computer enemy, stupidly attacking PiSya.
If the scripting engine is someone else's (it's no longer shameful to take someone else's) - you already see what it can do and where to shove it. And if you want to write it yourself - better make triggers, like in StarCraft.
2. On someone else's engine. Just look at what the engine can do, what features it has in the box, and which ones you will have to add with your own code and other people's modules. Not familiar with any. A foreign engine is a rather nasty thing for a novice programmer: it automatically generates some kind of program structure, and the programmer has to not only create, but deal with this structure. On the one hand, you can quickly write a rather complex game, on the other hand, there is not much joy “but it worked for me”.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question