Having worked on the port to PowerVR,...
I suspect it was never expected to be rendered at more than, say, VGA let alone 1024, so the gaps would've been masked by chunky pixels.Good lord that gorilla is awful. Even by PS1 standards. Well, it was an early game...
I'm sure "Nobby" & Mick would also be pleased to hear that. We certainly had fun doing it. Core's code was really cleanly written and nice to work with.After so many years, let me thank you for the long evenings enjoying this utterly difficult but fantastic game with my Tseng Labs plus Matrox M3D.
"listening" to you is fascinating to me. So you did program it using a double, or float? What's the language in which you programmed the game if it is not asking much?I suspect it was never expected to be rendered at more than, say, VGA let alone 1024, so the gaps would've been masked by chunky pixels.
I'm sure "Nobby" & Mick would also be pleased to hear that. We certainly had fun doing it. Core's code was really cleanly written and nice to work with.
For posterity, I should probably jot down a few things we did while doing the port.
- The transform pipeline was originally coded in fixed point, which makes a lot of sense for the machines that it was targeting, but since the Pentium now provided decent floating-point performance, we changed it over to FP.
- Further, since the PCX1/PCX2 had in effect sub-pixel precision for vertex positions (and we now had float transforms) we removed the rounding to integer in the pipeline which meant animation became smoother.
- The textures were packed as multiple 256x256 atlases, some with mixtures of opaque and translucent data. Since PowerVR gets a huge performance boost from opaque overdraw, we scanned through those atlases and created opaque 565 and, where necessary, translucent, 4444, variants, and chose the appropriate one on the fly. MIP maps were also generated but I can't recall if that was in the original code or not. (It was nearly 20 years ago so forgive me)
- However, having generated all these textures, they couldn't all be resident in the on-board texture memory (which was < 4MB: Some of the on-board mem was required for geometry/shading data). We thus had to implement a 'caching' scheme tracking active textures. This is slightly more interesting when you note that the previous frame would still be rendering and accessing textures while the SW was constructing the current list. We thus sometimes had to drop the resolution of a texture to get it to fit rather than pause the rendering.
(I have a vague feeling that the 3DFX port may have worked around this issue to some extent by using the 8bpp "narrow channel" texture compression but that might lead to some washed-out/desaturated results)
- I think we sorted translucent objects (e.g. the medical kits) by Z so were able to turn on bilinear filtering. I noticed some other variants just used alpha test to avoid the sorting issue, but this results in rather jaggy edges.
- (Blue) Fog was turned on for 'under water' objects. This was free in the hardware so seemed a shame not to use it. It, perhaps, could have been a bit more subtle but you should seen some of the settings we started with.
- The max resolution was increased to 1024 (probably in both X and Y) depending on the 2D graphics card's support in terms of resolution and memory. Initially the code only supported double buffered, but I got annoyed as my dev PC's graphics card didn't have enough RAM for 1024x768 DB, so added a single buffered mode. Because it's a TBDR, you can get away with SB as tearing artefacts are 'nearly invisible'. (FWIW, if you look at the first image I posted, you can see the SB next to the resolution)
Float or double?Hmm. I suspect it would have only been float but I can't really be certain. PCX2 took geometry in IEEE float format so that would probably be the likely choice. Further I just took a quick look at Agner Fog's x86 instruction timings to see if there's a performance difference; divide is certainly considerably faster with float than double on the Pentium so it's more likely we used the former."listening" to you is fascinating to me. So you did program it using a double, or float? What's the language in which you programmed the game if it is not asking much?
Good lord that gorilla is awful. Even by PS1 standards. Well, it was an early game...
For posterity, I should probably jot down a few things we did while doing the port.
I'm not sure if I worked on that bit but I have a feeling that the original code might have accidentally(?) been waiting 2 vsyncs per frame.And what did you do to make it run at 60 fps, whereas all the other versions were locked at 30 fps?
Thanks for the insight Simon F. It's quite curious because float and double seem to do more or less the same, although double allows for larger numbers. I can imagine how complex a game like that is, and programming it might be a work of art. Which leads me to the question....when you mean C...do you mean that you literally used C or was it C++?Float or double?Hmm. I suspect it would have only been float but I can't really be certain. PCX2 took geometry in IEEE float format so that would probably be the likely choice. Further I just took a quick look at Agner Fog's x86 instruction timings to see if there's a performance difference; divide is certainly considerably faster with float than double on the Pentium so it's more likely we used the former.
The original code from Core was (IIRC) all C and we continued with that. As I mentioned earlier, it was written in a logical and clean fashion. It was then a matter of making the necessary changes to that code in order to make calls to our triangle/quad graphics library (SGL-Lite), e.g. replacing the software triangle rasteriser call to one that added geometry to the PVR 'display list'.
FWIW another group @IMG (nee Videologic) were aiming to port a different game (I won't say what it was) but that code base was littered with random snippets of inline ASM and calls to a different vendors graphics API. They wisely gave up before insanity set in.
(also just remembered another tweak so updated the earlier post)
I'm not sure if I worked on that bit but I have a feeling that the original code might have accidentally(?) been waiting 2 vsyncs per frame.
[Update: as it was a long time ago (and pre-children) I might have worked on it. I don't really know]
There can be a cost with using double rather than float though sometimes some of it's hidden by the HW designers using more silicon.Thanks for the insight Simon F. It's quite curious because float and double seem to do more or less the same, although double allows for larger numbers.Which leads me to the question....when you mean C...do you mean that you literally used C or was it C++?
C.Which leads me to the question....when you mean C...do you mean that you literally used C or was it C++?
Whatever you feel comfortable with, but FWIW I never really got into C++. I used it a bit in Win95/MSVC days but when you needed to work on more esoteric HW, (e.g. DSPs) C++ wasn't always available. Further I just got tired of chasing through N-levels of software (classes built on classes) to find out why "X" wasn't working. Further, found some devs would use a ridiculously flexible class to implement things that could be done with, say, a simple array and then wonder why the code was a bit slow. <shrug>.But I wonder, do you really think it is beneficial to program in an object oriented manner or C was fine enough if you knew how to keep your code clean and readable?
I don't know anything about the Rage patch. I have a feeling we were given either (or both) the standard DOS and/or 3dfx port as a starting point. We certainly didn't have a Windows 95 version.Accidentally? Any chance this accident could be exploited to made this run at 60 fps then:
http://www.tombraiderforums.com/showthread.php?t=214779
:smile2:
So the Windows 95 compatible 3D dll that we can use to enjoy super high resolutions and stuff, wasn't meant to be? One always think that if a hardware company publishes a specific file for a game, it is legal, programmed by the creators of the game. Did you know at the time?There can be a cost with using double rather than float though sometimes some of it's hidden by the HW designers using more silicon.
For something like TR, float rep should be fine. After all you should be able to represent any location in, say, a 8x8x8km cube world with a precision of at least 0.5mm.
C.
Whatever you feel comfortable with, but FWIW I never really got into C++. I used it a bit in Win95/MSVC days but when you needed to work on more esoteric HW, (e.g. DSPs) C++ wasn't always available. Further I just got tired of chasing through N-levels of software (classes built on classes) to find out why "X" wasn't working. Further, found some devs would use a ridiculously flexible class to implement things that could be done with, say, a simple array and then wonder why the code was a bit slow. <shrug>.
I don't know anything about the Rage patch. I have a feeling we were given either (or both) the standard DOS and/or 3dfx port as a starting point. We certainly didn't have a Windows 95 version.
I'm not sure if reverse engineering is legal but I suppose someone could try looking for the vsync test, seeing if it tests twice in a row and, if so, replace the 2nd with NOPs.
ok, thanks for the clarificationThat is not an object oriented approach, that is just code separation for readability and/or removing code duplication. But this is OT.
I'm sorry but I don't know what you mean.So the Windows 95 compatible 3D dll that we can use to enjoy super high resolutions and stuff, wasn't meant to be? One always think that if a hardware company publishes a specific file for a game, it is legal, programmed by the creators of the game. Did you know at the time?
I'm sorry but I don't know what you mean.
so..., do you think your code was re-engineered? I wonder how difficult would it be to port the game from DOS to a Win95 compatible dll or so.AFAICR the code that Core supplied to us was for DOS and I suspect we thought it was simpler to create a DOS version of our graphics library than to move the game code to Windows 95. <shrug>
I think you might have misunderstood me. Core, the TR developers, sent Img Tech (nee Videologic) a version of their code to allow us to modify it to run on the PowerVR hardware. I assume this was done as a mutually beneficial exercise: IIRC the hardware came with a free demo version of the game which would make the card a more appealing purchase and, similarly, should boost sales of the full game for Core.so..., do you think your code was re-engineered? I wonder how difficult would it be to port the game from DOS to a Win95 compatible dll or so.