H.E.R.O. / 3D Engine Blog

Unleash 64bit power of your beloved cat with low level assembly or high level C programming skills.

Moderator: TXG-MNX

H.E.R.O. / 3D Engine Blog

Postby VladR » Mon Jun 02, 2014 3:24 am

I used to have a thread at JSII describing my progress on the 3D engine I have been working on for Jag, so this thread will serve as a replacement for that.

The engine is best suited for platformers/action games, which have 3D camera as in X360 version of PrinceOfPersia. Meaning, the camera strafes left/right and/or up/down to support the 3D feeling.

My primary technical challenge is to use only high-level language - C and avoid using Jag-specific HW (Blitter/GPU/DSP/OP) as long as possible. Since I am still getting a significant speed-up from optimizing the C code, I still have not reached the performance limit of C. Of course, the screen buffer has to be drawn by something - in our case by OP, but that's only because Jag does not know the concept of framebuffer (which I am using for all rendering).

The engine should serve well for the remake of H.E.R.O. (or e.g. Submission), but first I gotta finish the engine, of course :-)

This video is about half year old, but will have to suffice till I finish current optimizations and can upload a new one.
http://www.youtube.com/watch?v=Ty1QQ6elZnM

Current features:
    - HiRes textures - each screen pixel corresponds to texel in texture
    - Lightmapping
    - Bilinear filtering
    - Edge Antialiasing
    - Sprite-based Character Animation
Every single pixel is rendered using a C statement and I plan to keep it that way as long as possible. This way, the engine will be totally multiplatform and can run on any 68000-based machine. Just recompile the C code, replace the framebuffer with machine-specific implementation (e.g. the OP code in our case) and it's done.
VladR
 
Posts: 273
Joined: Tue May 27, 2014 8:58 pm

Re: H.E.R.O. / 3D Engine Blog

Postby VladR » Mon Jun 02, 2014 3:55 am

I spent a bit of time over the last two weekends and replaced the double-buffering with vblank. This meant I had to chop up the rendering into subcomponents that can finish within a single frame - which is much harder to do properly than merely render the scene into second framebuffer (and switch between them). That turned out to be pretty tricky to synchronize (it's like juggling with 7 pieces, 4 of which are invisible :-) ), but was a great way to force me into further optimizations / enhancements, namely:
    - Bresenham algorithm for line drawing (used for texturing) underwent an overhaul (both from performance and quality standpoint)
    - 3D transformations using less divisions/multiplications
    - smart clearing to reduce overdraw/flicker
    - added few pre-computed look-up tables
    - perspective texturing is now 300% faster
    - fixed the holes / cracks between some perspective walls
    - increased the precision of calculations to avoid the 'jumping' of walls as player moves. It was just one pixel, but at 320x200, it was pretty visible, that occasionally a wall was sticking out 1 pixel - now all the front and back walls are perfectly aligned
    - using vblank, I can do benchmarking in much higher precision than before, since I can measure - with a precision of ~half-frame, how long does certain feature take to render, when repeated, say, 100 times. Yes, it's benchmarking under VJ, but from my many tests on real HW - if a new feature was 50% faster under VJ, then it is 40-50% faster also on real Jag - e.g. the performance difference is totally comparable (just not the actual performance). But, that's more than enough at this moment.
In the old video (from November), you can see that camera gets updated once every block is passed. Now, it's actually smooth :-)

There are couple things I need to iron out, before I can post a new video, but it's close. I'm really happy how it's shaping up...
VladR
 
Posts: 273
Joined: Tue May 27, 2014 8:58 pm

Re: H.E.R.O. / 3D Engine Blog

Postby TXG-MNX » Sun Jun 29, 2014 3:22 pm

Nice progress can't wait to see new stuff or demo's :-)
TXG-MNX
 
Posts: 465
Joined: Fri Jun 27, 2014 7:46 pm

Re: H.E.R.O. / 3D Engine Blog

Postby VladR » Wed Nov 19, 2014 6:55 am

I just reused the Blitter function from the MidiMaze codebase (that I implemented half an hour ago) and the framerate jumped up between 25-40%. And that's only for the front walls. The number varies, as each room has obviously different render complexity.

There are some visual glitches right now, as I need to fix the phrase padding register (A1_STEP), but it's a great first step :-)

When I get this working for the back walls, there should be a similar jump, albeit a bit smaller (I'd guess about 15-25%) :-)
VladR
 
Posts: 273
Joined: Tue May 27, 2014 8:58 pm

Re: H.E.R.O. / 3D Engine Blog

Postby VladR » Wed Nov 19, 2014 6:09 pm

I replaced back walls rendering with the blitter method, and boy is it fast :-)

I have a benchmark routine that renders 100 frames of each of the 9 screens and draws the results.

3 of the screens are done in less than 1 vblank. That's 60 fps :-)
3 of the screens are done under 1.1 vblank. That's like 50 fps :-)
3 of the screens are done under ~1.9 vblank. That's like 30 fps :-)

Yes, it's VJ, but still ;-)


Once I figure out how to do the DDA offseting via Blitter, I will render also left/right and top/down faces via Blitter.

Then, it will be 60 fps on real HW. Using slow C ;-)
VladR
 
Posts: 273
Joined: Tue May 27, 2014 8:58 pm

Re: H.E.R.O. / 3D Engine Blog

Postby A31Chris » Wed Nov 19, 2014 9:57 pm

VladR wrote:I replaced back walls rendering with the blitter method, and boy is it fast :-)

I have a benchmark routine that renders 100 frames of each of the 9 screens and draws the results.

Then, it will be 60 fps on real HW. Using slow C ;-)


Hey maybe you should check this out on real hardware first.

1.) Actual speed may vary since you went beyond the 68k. It's a different ballgame now.

2.) What you just did may not work at all as-is on actual hardware.
What came after the Jaguar was the PS1 which for all it's greatness, ushered in corporate development and with it the bleached, repetitive, bland titles which for the most part we're still playing today. - David Wightman
A31Chris
 
Posts: 285
Joined: Tue Sep 16, 2014 6:25 pm

Re: H.E.R.O. / 3D Engine Blog

Postby VladR » Wed Nov 19, 2014 10:39 pm

I absolutely agree that the real HW test is needed. Too bad that after I moved in July, I don't have the space for the Jaguar set-up by my dev couch. I gotta figure something out - the fact I assembled some bookcases recently should help - but some serious furniture rearrangement is in order for that to happen.

I actually think the VJ is pretty realistic about the speed-up. It's not insane, like 10times faster or something. The speed-up looks pretty realistic to me, considering Blitter transfers 64 bit of data, compared to 68000. Does 35% speed-up look insane to you, considering we're talking Blitter vs CPU ?

It does worry me, of course, that it might not reliably work on real HW, but at this point, this is best I can do.

I'll try to rearrange some furniture to make room for Jag, now that I started on Blitter stuff...
VladR
 
Posts: 273
Joined: Tue May 27, 2014 8:58 pm

Re: H.E.R.O. / 3D Engine Blog

Postby TXG-MNX » Wed Nov 19, 2014 10:47 pm

Maybe release some test binairies we can test on real hw for you so you wouldn't end in code that only runs on vj and not on a real jag. That is an issue I got now its very frustrating...
TXG-MNX
 
Posts: 465
Joined: Fri Jun 27, 2014 7:46 pm

Re: H.E.R.O. / 3D Engine Blog

Postby VladR » Wed Nov 19, 2014 11:08 pm

It's kinda absurd I would ask for external testing, given that I even got 2 skunks (!!!), but it does look like an easiest option :-(

You guys willing and have the time to upload few builds every now and then ? I'd reaaaaally love to get at least the H.E.R.O. running better for the SillyVenture (if time permits - which is totally in the air, even an VRBasic update).

TXG - you going for SillyVenture ?
VladR
 
Posts: 273
Joined: Tue May 27, 2014 8:58 pm

Re: H.E.R.O. / 3D Engine Blog

Postby A31Chris » Wed Nov 19, 2014 11:47 pm

VladR wrote:It's kinda absurd I would ask for external testing, given that I even got 2 skunks (!!!), but it does look like an easiest option :-(

You guys willing and have the time to upload few builds every now and then ? I'd reaaaaally love to get at least the H.E.R.O. running better for the SillyVenture (if time permits - which is totally in the air, even an VRBasic update).

TXG - you going for SillyVenture ?


Oh come on now. Hook up the Skunkboard/Jag combo. You can do it. ;)
What came after the Jaguar was the PS1 which for all it's greatness, ushered in corporate development and with it the bleached, repetitive, bland titles which for the most part we're still playing today. - David Wightman
A31Chris
 
Posts: 285
Joined: Tue Sep 16, 2014 6:25 pm

Next

Return to Jag Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron