为c ++游戏引擎设置增量开发环境

时间:2022-07-09 06:54:50

Suppose I have written a game engine in c++. It was functions such as adPlayer(Vec3f position, Model playerModel), addExplosion(Vec3f position, Size explosionSize).

假设我用c ++编写了一个游戏引擎。它的功能包括adPlayer(Vec3f position,Model playerModel),addExplosion(Vec3f position,Size explosionSize)。

Now, those functions can be called in some sort of test class and then the projcet can be compiled and run. This takes forever.

现在,可以在某种类型的测试类中调用这些函数,然后可以编译和运行这些函数。这需要永远。

What would be ideal is to have some basic text editor where i can type these functions, press ctrl+u and then this somehows calls the precompiled functions of the game engine. E.g, it doesn't recompile the game engine.

什么是理想的是有一些基本的文本编辑器,我可以键入这些功能,按ctrl + u然后这个somehows调用游戏引擎的预编译功能。例如,它不会重新编译游戏引擎。

How would this be done?

这怎么办?

2 个解决方案

#1


2  

Usually you would compile your engine into a .dll and link it to your project. Then you can just link the function and don't have to compile it if you just want to use the functions.

通常,您将引擎编译为.dll并将其链接到您的项目。然后你可以只链接该函数,如果你只想使用这些函数,就不必编译它。

#2


2  

If you are asking about design iteration, you create a data format that is read in and converted to entities in your scene graph. You need to use the factory pattern. You can use a serialization library where each object knows how to read/write/persist itself.

如果您询问设计迭代,则创建一个数据格式,该数据格式被读入并转换为场景图中的实体。您需要使用工厂模式。您可以使用序列化库,其中每个对象都知道如何读取/写入/保持自身。

By having a data format that represents a "snapshot" of your game state, you can read/save it from both a game and an editor. Later you can make design changes to a running game instance by having functions that re-read the data during runtime

通过使用表示游戏状态“快照”的数据格式,您可以从游戏和编辑器中读取/保存它。稍后,您可以通过在运行时重新读取数据的函数对正在运行的游戏实例进行设计更改

It seems like right now you might have hardcoded/mixed client code with engine code, which might be hard to seperate.

现在看来你可能有硬编码/混合客户端代码和引擎代码,这可能很难分开。

If you are asking about compilation, then you will want to compile to a library (either .dll or static .lib/.so). Then compile your client/specific code against your engine lib(s). They should be in seperate projects.

如果您询问编译,那么您将需要编译到库(.dll或静态.lib / .so)。然后针对您的引擎库编译您的客户端/特定代码。他们应该在单独的项目中。

#1


2  

Usually you would compile your engine into a .dll and link it to your project. Then you can just link the function and don't have to compile it if you just want to use the functions.

通常,您将引擎编译为.dll并将其链接到您的项目。然后你可以只链接该函数,如果你只想使用这些函数,就不必编译它。

#2


2  

If you are asking about design iteration, you create a data format that is read in and converted to entities in your scene graph. You need to use the factory pattern. You can use a serialization library where each object knows how to read/write/persist itself.

如果您询问设计迭代,则创建一个数据格式,该数据格式被读入并转换为场景图中的实体。您需要使用工厂模式。您可以使用序列化库,其中每个对象都知道如何读取/写入/保持自身。

By having a data format that represents a "snapshot" of your game state, you can read/save it from both a game and an editor. Later you can make design changes to a running game instance by having functions that re-read the data during runtime

通过使用表示游戏状态“快照”的数据格式,您可以从游戏和编辑器中读取/保存它。稍后,您可以通过在运行时重新读取数据的函数对正在运行的游戏实例进行设计更改

It seems like right now you might have hardcoded/mixed client code with engine code, which might be hard to seperate.

现在看来你可能有硬编码/混合客户端代码和引擎代码,这可能很难分开。

If you are asking about compilation, then you will want to compile to a library (either .dll or static .lib/.so). Then compile your client/specific code against your engine lib(s). They should be in seperate projects.

如果您询问编译,那么您将需要编译到库(.dll或静态.lib / .so)。然后针对您的引擎库编译您的客户端/特定代码。他们应该在单独的项目中。