Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  TravisG Sep 17 '11 at 21:55
14  
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. –  Paul Manta Sep 17 '11 at 23:25
1  
Does he ask to get a compiler embedded into an application? –  FxIII Sep 18 '11 at 7:54
    
Guys, there's no reason to downvote and hate, just answer the question! –  bobobobo Sep 18 '11 at 11:57
6  
@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. –  Cyclops Sep 18 '11 at 12:18
show 2 more comments

2 Answers

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!

share|improve this answer
add comment

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.

share|improve this answer
1  
Maybe, but if he wants it to be cross platform using another compiler could be helpfull. –  Psykocyber Sep 18 '11 at 10:54
    
A reasonable answer. –  bobobobo Sep 18 '11 at 11:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.