SFML community forums

Help => General => Topic started by: orella on April 24, 2017, 04:41:16 pm

Title: Creating standalone of specific RenderWindow
Post by: orella on April 24, 2017, 04:41:16 pm
Hi!

Image that I have 2 RenderWindow. One with the game I'm developing and one with a button. How can I do to create a standalone (.exe file) of the game when i press that button?

Thanks
Title: Re: Creating standalone of specific RenderWindow
Post by: Mario on April 25, 2017, 09:58:22 am
What exactly are you trying to do?
Title: Re: Creating standalone of specific RenderWindow
Post by: orella on April 25, 2017, 09:34:30 pm
What exactly are you trying to do?

I'm creating a game engine like Unity. And in Unity (i'm sure you know it) you have an scene where you create your game placing gameObjects and when you want to build your game then just clik on Build option and an standalone is created on the project folder. And this is what i want to do on my engine.

PS: My engine scene is a RenderTexture where i draw the gameObjects sprites.
Title: Re: Creating standalone of specific RenderWindow
Post by: sjaustirni on April 25, 2017, 09:58:07 pm
I'm creating a game engine like Unity.

Sounds.. bold :D

Anyway, back to your original question - it depends on how your engine is used. For instance, if in your engine one writes C++, you simply start gcc/clang on the user's project including your API headers, statically link your library to it and then you embed the assets into the exe. If one uses a scripting language, you could write your own compiler with bytecode generaton (LLVM is there to save you), or the exe could be just an interpreter with the scripts embedded in the exe and ran everytime the interpreter is clicked on, or you could compile the scripting language to C/C++ and then go the gcc/clang path.

And I just scratched surface on this one. I need to stress, however, that none of these are an easy thing to do, even though the first one is the easiest one by a large margin.
Title: Re: Creating standalone of specific RenderWindow
Post by: orella on April 26, 2017, 12:29:31 am
When i say "like Unity" i mean that the way it works is similar. It have a scene where you place/create the gameObjects, you can add components to them and scripts, etc. But it's only 2D. Obviously it's far from being like Unity ;D.

The engine is made in c++ using visual studio and the scripts you can add in gameObjects will be also in c++;
Title: Re: Creating standalone of specific RenderWindow
Post by: DeathRay2K on April 26, 2017, 03:32:05 pm
You probably want to create a separate program that can take as input what the design program outputs. So for example, you might use your design software to write some scripts, include some resources, and set up everything you want the game to do. Then to create a distributable, you would export that data alongside a second program that can read, interpret, and execute those scripts, using the resources, etc.
That's what I would do, rather than trying to write or include a compiler.
This won't be as fast as a compiled project, but I think it will be a whole lot easier to put together.