What graphics API does the Civ 3 engine actually use?

Lord_Hill

Prince
Joined
May 10, 2004
Messages
438
Location
London, UK
This one has always been a bit of a curiosity for me. Clearly the Civ 3 engine is completely bespoke, and has never been used by any other game before or since. It has a mixture of 2d and 3d elements rather than being polygons everywhere. The minimum requirement is Direct-x 8 (at least for Vanilla, I think they bumped it up to 9 for Conquests), but then I find myself reading the extended discussion for the long standing Wine bugs (linked here if anyone is interested https://forums.civfanatics.com/thre...ing-my-terrain-color-changes-to-black.684829/) and it talks about the game using a mixture of Windows GDI calls and OpenGL for graphics. Combine that with the unusual resolution options (hardcoded based on window width or match desktop resolution, all hidden away in an ini file) and complete lack of settings either in a setup program or the game itself and you have something quite odd.

Just curious if there's any information out there about how it all works under the hood?
 
No problem @Lanzelot, thinking about it, the direct x 8 requirement doesn't necessarily imply direct draw / direct 3d are used at all for graphics, as the game is certainly using direct sound for audio (otherwise indirect sound would not work) and probably direct input for controls.
 
I do recall the Conquests installer, at least, requiring DX9.0c. It's worth noting there does not appear to be any 3D rendering in the game. All 3D graphics are pre-rendered animations that can be found in the art files. If anyone knows more about the implementation it would be @Flintlock who's working with an exe patch framework.

@Lanzelot not telling you how to do your job :lol: but historically this particular subforum has been kind of a no man's land just housing the other mod projects. We've always had questions in the parent C&C forum.
 
@WildWeazel No problem, just tell me, how you want your forum to be structured/organized. I am your servant. (Or as Friedrich II said: "I am the first servant of my state", contrary to Louis XIV, who said "I am the state"... ;))

Would this also apply to some of the other threads like "Is there a way to import a new map to an existing scenario?" or "Shooting down cruise missiles?", which have originally been opened in this subforum? Better give me detailed instructions, so I can't mess it up...
 
Last edited:
I find myself reading the extended discussion for the long standing Wine bugs (linked here if anyone is interested https://forums.civfanatics.com/thre...ing-my-terrain-color-changes-to-black.684829/) and it talks about the game using a mixture of Windows GDI calls and OpenGL for graphics.
Very interesting! I've been digging around inside the executable for a few years now and I never noticed it uses OpenGL. That's because OpenGL is used for almost nothing, in fact the only thing it's used for is drawing diagonal lines. In total all the OpenGL code amounts to 200 lines at most, and most of that is for initialization. The only reason I can see why they would use OpenGL for line drawing instead of Windows GDI is that Win GDI doesn't let you create dashed lines with a thickness > 1 according to the docs. So instead they used glLineStipple to create a dashed effect. Presumably they could have created the same effect by drawing multiple little lines with Win GDI but were too lazy. Other than diagonal lines, the game does all its drawing through Windows GDI or by directly editing some pixel data. Even straight horizontal and vertical lines are drawn as skinny rectangles.
 
I guess that also explains why no modern graphics wrapper can touch it as well. it's not using direct draw or opengl (except for culture borders and diplomacy lines!? Very odd)
 
Top Bottom