-9
\$\begingroup\$

I'm thinking of creating a Game Engine with a C++ Compiler using OpenGL but I don't know how to create a compiler in an application. Do I have to write the compiler? or could I use (for example) the Visual C++ Compiler?

\$\endgroup\$
6
  • \$\begingroup\$ don't think this is game dev related. Sameh Hany needs a basic introduction to compiling stuff with C++... or how C++ applications are built in general, which I think belongs on SO. \$\endgroup\$
    – TravisG
    Sep 17, 2011 at 21:55
  • 15
    \$\begingroup\$ Really, with a question like that, I honestly doubt you're ready to make games. Start a little smaller; you'll get to games eventually (if you are persistent, that is). I'm not trying to be a jerk or anything, but you obviously are just getting started with programming. \$\endgroup\$
    – Paul Manta
    Sep 17, 2011 at 23:25
  • 1
    \$\begingroup\$ Does he ask to get a compiler embedded into an application? \$\endgroup\$
    – FxIII
    Sep 18, 2011 at 7:54
  • \$\begingroup\$ Guys, there's no reason to downvote and hate, just answer the question! \$\endgroup\$
    – bobobobo
    Sep 18, 2011 at 11:57
  • 6
    \$\begingroup\$ @bobobobo, there isn't any "hating" going on here - in fact, Paul gave as polite an answer as is possible, given the poor question. Giving someone constructive criticism, or any kind of negative feedback, isn't the same thing as "hating". And poor questions should be downvoted - it's part of how these sites work. \$\endgroup\$
    – Cyclops
    Sep 18, 2011 at 12:18

2 Answers 2

6
\$\begingroup\$

The only reason that I can see for including a compiler in an application is that you wish users to be able to write their own code in C++ which is compiled, linked, and executed at runtime. This isn't a brilliant idea, and in fact there is a common game engine technique called scripting that allows users to do write their own code and have it executed.

A short extract from Jason Gregory's Game Engine Architecture (third edition) from page 794 can be found below:

A scripting language can be defined as a programming language whose primary purpose is to permit users to control and customise the behaviour of a software application.

...

In the context of game engines, a scripting language is a high level, relatively easy-to-use programming language that provides its users with convenient access to most of the commonly used features of the engine. As such, a scripting language can be used by programmers and non-programmers alike to develop a new game or to customise - or "mod" - an existing game.

A short list of benefits of scripting:

  • You can only expose the parts of the engine to the scripting system that you want to.
  • The scripts are loaded at runtime and can be edited off-line without the engine needing to be recompiled.
  • They help support rapid iteration times and are sometimes quite lightweight.

I would suggest you look into adding scripting functionality as this would be a better solution to your problem. There are many scripting related questions on gamedev.stackexchange to get you started!

\$\endgroup\$
2
\$\begingroup\$

Yes, you can (and in my opinion should!) use the Visual C++ compiler. It is currently one of the best compilers out there.

Furthermore, while it is very interesting to write your own compiler, it's not very wise to use it for speed-critical applications like games.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Maybe, but if he wants it to be cross platform using another compiler could be helpfull. \$\endgroup\$ Sep 18, 2011 at 10:54
  • \$\begingroup\$ A reasonable answer. \$\endgroup\$
    – bobobobo
    Sep 18, 2011 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .