Answer the question
In order to leave comments, you need to log in
How to program a game within a game?
A lot of games are generally dependent on their audience, this usually happens either when the author of the game has written himself out, or when the game was intended to be. This has been implemented in various ways. Some make third-party programs for creating mods, others sew in some kind of constructor to create levels. So, how to create a game in the game itself??
Lol, I almost answered my own question again. But I'm interested in the mechanism itself. Let's say I want to create an enemy in the game itself. How should I implement this in the creator itself? Can use a normal class that has normal physics for the enemy and make him attack from the secondary functions of bullet spawn, and normal moves. But I'm interested in something else. How will he live without the code?
After all, I will write it in the game, but it will not be registered in the program.
I've been scratching my head over such a simple feature for a long time, help me understand the concept of game programming in the game itself
Answer the question
In order to leave comments, you need to log in
Let's say I want to create an enemy in the game itself. How should I implement this in the creator itself? Can use a normal class that has normal physics for the enemy and make him attack from the secondary functions of bullet spawn, and normal moves. But I'm interested in something else. How will he live without the code?
After all, I will write it in the game, but it will not be registered in the program.
I've been scratching my head over such a simple feature for a long time, help me understand the concept of game programming in the game itself
Usually a scripting engine is used for this. The most famous is Lua.
They also use triggers, the reference example is StarCraft.
But when working with triggers, it is necessary to separate the "condition" and "cause". An occasion is an impulse event that MAY cause a trigger to fire. Conditions are already additional things that are checked later.
The third possibility is a data-driven engine. For example, we set the type of attack, the amount of HP, the type of movement, and so on, and this entire library is already written in the code. A reference example is Doom (the very first, 1993). By the way, scripts appeared in his successor Hexen.
Let's look at this situation using the example of a 3D shooter where we have a map editor.
For example, we have an enemy class (He has variable damage, health, etc.) and the player wants to spawn him, also let's say that everyone spawns on LMB. After pressing the LMB by the player, we will spawn the enemy where the damage and health are selected by the player in advance (I.e. we will spawn the enemy in the same way as in a normal game, but when pressing the LMB with other parameters of health and damage, or the same). The player also wants to spawn a wall (Let's say the player chooses the spawn location using x,y,z in the editor). We'll just step on the same wall, but x,y,z is chosen by the player. To specify variables x,y,z, damage, health, etc., let's say on the right in the game there is a trim for variables (Like in Unity, UE4, etc.), the player enters variables for the item (class, object) that he selected with the mouse then he enters a variable there and when pressing Enter confirms that the variable EnemyDamage = 23, the same variable we use to denote damage when we spawn enemies. There are a lot of details like how objects get into textures, the maximum allowed damage so that the int variable does not overflow, instead of specifying x,y,z the flying camera with the selected object, etc. But I hope I explained the basics to you at least a little bit.
And this is easy, first you create artificial intelligence and give it tasks
When working with triggers, it is necessary to separate the "condition" and "cause". An occasion is an impulse event that MAY cause a trigger to fire. Conditions are already additional things that are checked later. I found what I was looking for in Kosmolot when I played slots.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question