Jump to content
  • Advertisement
Sign in to follow this  
Inevitab13

Quake 3 engine Renderer rewrite-Where to start?

This topic is 3846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm planning to rewrite the renderer in id tech 3 to Direct3d9. And I have plans to eventually move the whole engine to c++. But where should I start? Here is a couple of questions: 1.Can I code the renderer in C++ and retain the original c code? 2.If not, can someone guide me in what to change any help is appreciated

Share this post


Link to post
Share on other sites
Advertisement
Do you have and are you working from the ioquake3 source?

Why? OpenGL works on Mac, Linux, Windows.

C++ can interface with the C code, but I don't know how difficult it is. There are probably better forums for working with the quake 3 source, but I don't know them.

Share this post


Link to post
Share on other sites
I would like to use Direct3d for this project, as I prefer to use HLSL for the majority of my pixel/vertex shaders. Is it possible to write a d3d renderer for this engine or not?

Share this post


Link to post
Share on other sites
Yes, it is possible, but if you have to ask the question then the task is probably beyond you. It's not a very small task, especially if the rendering backend is not already modularized. It would be less work to learn GLSL if you want to use shaders with the Quake 3 engine.

Share this post


Link to post
Share on other sites
Technically C++ is only compatible with a subset of C. It's very likely that if you simply try to compile the source code in Visual C++, you'll get a whole pile of errors and warnings due to code being incompatible with either C++ or the Visual C++ compiler.

Share this post


Link to post
Share on other sites
You could just put your new renderer into a DLL and then call the DLL methods from C code. This would allow you to write the renderer in C++.

As for converting the engine to C++: Unless you just want to make it compile with a C++ compiler, this will be a mamoth task. The Q3 engine has > 1 million lines of code and putting all of that into classes would be insane.

Share this post


Link to post
Share on other sites
How much do you want to rewrite?

The easy way is to delete the entire renderer code and start from scratch. (I attempted this. Very involved.)

If you want to use HLSL without rewriting massive amounts of code, Cg is a very similar language. It's fairly easy to integrate with OpenGL, but getting around Q3's renderer can be quite mind-bending.

If you want to use HLSL and DirectX, know that the renderer is tied closely to OpenGL. Ungluing it won't be easy without lots of new code - this is where option 1 starts to make sense.

You can write the new code in C++, yes, but you'll need to carefully separate it from the C code so it doesn't become impossible to even compile, or compile EVERYTHING as C++. Otherwise, you'd have to use the COM interfaces through C, which is possible but not particularly fun.

No matter what route you choose, there is one important tip I can give you: know the code before modifying it. id tech 3 ranges from very simple to understand to utterly incomprehensible, especially the renderer.

Share this post


Link to post
Share on other sites
If you really would like to use HLSL instead of GLSL, I would suggest checking out ATI's HLSL to GLSL conversion tool.

There was a short article on MacWorld.com a while ago here:
macworld.com Article

The direct link to the tool is:
hlsl2glsl Tool

From what I have heard the tool does a pretty good job. Just curious, why not learn both GLSL and HLSL? It could look good on your resume to know both ;-)

- Bill

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!