A Sega Model 3 Arcade Emulator
Work on Supermodel has slowed to a trickle due to real world business. Nevertheless, we have managed to make small amounts of progress here and there. Now that some web sites and forum members are distributing unofficial (and unsupported) builds of SVN snapshots, the latest changes have become well known: specular lighting, a wide-screen mode, improved rendering performance (thanks to Nik), and fewer garbled textures for those capable of running Nik's multi-texture shader (the default). I also fixed the grainy SCSP audio. It turns out that I was forgetting to byte-swap the sample ROMs -- an easy mistake because the samples are all 8 bit.
The other day, I discovered why the moon of Endor isn't appearing on the final stage of Star Wars Trilogy: it's due to a Z-buffering problem. By scaling the coordinates and tweaking the near and far clipping planes, I can get it to show up. Unfortunately, this introduces severe Z-fighting problems in other games. It may be possible to linearize or otherwise improve the distribution of depth buffer values but I'm putting this on the back-burner for now.
Today, I spent some time investigating the "missing" AI vehicle textures in Daytona USA 2. Making them appear turned out to be a simple matter. The texture enable bit (or what we were assumed was the texture enable bit) can be ignored when the texture format is not 0 (i.e., T1RGB5, the most commonly used Model 3 format). Flat shaded polygons seem to always have that field set to 0. I also confirmed something I had long suspected: these are really four different 4-bit textures packed together in an interleaved format. I still have a lot to figure out. I don't know how the textures are supposed to be colored, although I already have some theories, and haven't figured out how the Real3D determines which one to draw. My suspicion is that the 3-bit texture format field is actually four bits wide. Hopefully today's results lead to answers for the rest of the unknown but related texture formats.
I've been getting a bit worn out from having to attend endless late night cocktail parties at lingerie models' condos. Being an emulator developer is a tough life! I decided to take a little break from mingling with the gliteratti and whipped up something shiny and sparkly for Supermodel. The diffuse and ambient lighting model has been tweaked resulting in improved colors. Shadows in Daytona USA 2 that were previously barely visible are now very prominent.
Taking inspiration from my friend Kim's shiny dress, I figured out how to implement very preliminary specular lighting, which makes vehicles and metallic background objects appear shinier (as on the real Model 3 hardware). Below are three Youtube videos demonstrating the new lighting effects. Specular highlights are particularly prominent in Scud Race and the Daytona USA 2 car selection screen. Also note that the 3D Sega Saturn logo on Scud Race's daytime beginner course now appears with a prominent specular highlight and glint as the sign rotates. The lighting is far from being correct but it's a positive start!
Our devoted fan nuexzz.. discovered the missing selection screen graphics in Daytona 2 by disabling the 3D graphics. I've partly re-worked the 2D rendering engine to support layer priorities. Not all possible settings are known yet but I was able to get it working for most of the games I've looked at so far. The code currently in SVN needs to be optimized and cleaned up.
Among other things, the HUD in Star Wars Trilogy no longer disappears behind 3D objects, the small Sega logo is now positioned correctly on Scud Race's attract mode sequence, and layers that are supposed to obscure the 3D graphics in Virtua Fighter 3 now correctly do so.
Just today, I discovered the source of the missing AI vehicle textures in Daytona 2. It turns out that those polygons disable texturing. By forcing them to render with textures enabled -- and breaking flat-shaded polygons in the process -- the textures become visible. They are encoded using interleaved formats that are not fully understood yet. Multiple patterns occupy the same texture and additional bits in the polygon header determine which is to be displayed. Unfortunately, Supermodel's rendering engine presently cannot support accurate emulation of these features but we can at least hope to figure out the proper way to interpret these texture formats. When the engine eventually gets its much-needed rewrite, it will be designed with them in mind.
Last but not least, Nik has managed to squeeze a little more performance out of the rendering engine (a 5-10% increase in the frame rate) when running in multi-threaded mode.
Happy New Year, fellow emulationistas! Here's to a great new year filled with emulation goodies!
Mac users will be pleased to hear that the SDL 1.2.15 pre-release fixes full screen mode (-fullscreen). R. Belmont has posted instructions at the Forum. Linux users running Ubuntu 11.10 who are still experiencing problems building v0.2a should re-download the source code from the Download page. A tiny fix to the Linux Makefile has been made. I didn't think it warranted a new release.
Over the holidays, Nik and I had a chance to do a little bit of work on Supermodel. I looked into the 3D graphics problems that plague many of the Step 2.x games (namely Harley Davidson, The Ocean Hunter, and Emergency Call Ambulance) but was unable to make any headway. I did manage to fix the missing geometry when playing mirrored tracks in Daytona 2 and Scud Race Plus. For those who were unaware of this neat Easter egg, holding down the Start button during the course select screen allows races to be run on horizontally-mirrored tracks. As it turns out, AM2's programmers cleverly reversed the X axis without needing to modify much else. Only a single transformation matrix is changed to flip the graphics. Because of the differences between how OpenGL and Model 3 perform back-face culling, flipping a single axis reverses the orientation of most polygons, causing them to be discarded by OpenGL. Now, Supermodel performs some extra calculations to determine which side of a polygon is the front side and the mirrored graphics seem to work fine.
This also fixes the wheels in Dirt Devils but is not related to any of the other problems that occur in Step 2.x games, which are caused by their unusual scene graph layout.
Nik optimized how model look-up tables are cleared in the 3D engine, which is one reason for the infamous slow-downs in Daytona 2. He also added the optional ability to run all rendering in a separate thread, further enhancing performance on multi-core systems and eliminating the slow-downs on fast systems. I have not yet tested the performance in Spikeout, which suffers from a related problem, but I would expect it to have an effect there as well. Nik committed these changes to SVN today. For those running their own up-to-date builds, multi-threaded graphics are enabled by default and can currently only be disabled by setting GPUMultiThreaded to 0 in Supermodel.ini (recommended on slower systems or for those with fewer cores).
A lot of people have been curious about what's going on with Supermodel. Neither Nik nor I have had much time to work on it since the last release. We both lead very busy lives. If there are any updates, they will appear here. Right now, I'm on vacation visiting my family for the holidays. Nik has been doing some profiling and experimenting with parallelizing the graphics renderer in the past couple of days. By putting the renderer in its own thread (in addition to some other small optimizations), he has been able to realize a modest speed improvement. He reports that Daytona USA 2 no longer stutters as severely on the advanced course.
In other news, a very clever user going by the name of DaytonaFan has figured out how to get Virtua Fighter 3 Team Battle to start up! You can read his post here or consult this FAQ item for a more detailed explanation.
The game runs much slower than the original Virtua Fighter 3 due to some sort of a timing problem. I'm guessing it is IRQ-related but have not confirmed it. Curiously, although it is plagued by the same geometry and texture problems as VF3, the player models do not come apart at the joints, meaning that this version looks noticeable better.
Some folks have expressed interest in donating to the Supermodel project. If you feel like helping a poor graduate student out, you can now do so by contributing to The Bart Fund. Proceeds will be used to upgrade my computer from a 2008 Toshiba laptop that runs Supermodel at 10-15 FPS to something less awkward to develop with. Thank you :)
A few input and sound bugs have been identified in v0.2a. We're hoping to have a minor update, v0.21a, within a week or two. Nik and I have been quite busy with our respective real lives lately.
Wow, Nik and I are honored by the positive response we've gotten to Version 0.2a! It's nice to hear that people are enjoying themselves despite the still preliminary condition of the project.
R. Belmont has posted an experimental Mac OS X binary at his blog. I've also put it up on the official Download page. It requires the SDL framework and should work on at least Snow Leopard and Lion (Intel only). There is no GUI, so familiarity with using the terminal is necessary.
Supermodel Version 0.2a is out! You can grab it from the Download page. The big new features are:
This is a substantial update. Be sure to read the bundled README.txt in its entirety. The Help pages also provide a basic overview of various features and functions. We encourage you to visit the new forum to discuss and receive support.
A hearty "thank you" is owed to Nik Henson, now an official co-author, for his incredible work developing the new input system and reverse engineering the drive board, and to world-famous emulation supermodels R. Belmont and ElSemi, for giving me access to their Digital Sound Board and SCSP code, respectively. Last but not least, I'd like to thank our new host, Jeremy Rhoten for generously donating this web space and helping me get settled in.
The next release is coming along. Presently, we're trying to debug a tricky (and unexpected) audio buffering problem that occasionally causes audio to crash when the frame rate hiccups. In the meantime, enjoy these videos taken by Mr. Thunderwing. There is some noticeable jitter in the music now and then, most likely caused by temporary drops in the frame rate.
Thanks to the efforts of the Dumping Union, Brian Troha has re-dumped Spikeout Final Edition! It's working in Supermodel.
Version 0.2a is nearing completion. My testers are reporting random sound glitches and crashes, which may delay the release. Hopefully, the source of most of the problems can be pinpointed soon.
Attention all Spikeout fanatics: Smittdog over at MAMEWorld has located a Spikeout Final Edition PCB for sale at a reasonable price. The current dump is bad and if it isn't re-dumped, emulation will be impossible. The Dumping Union is trying to raise $235 to acquire and dump the game. If you care about Model 3 emulation and can spare a few bucks, I urge you to go here, click the Paypal button, and donate as soon as possible before this opportunity disappears!
Update: Looks like they've reached their objective! Nice work!
The site is back up thanks to server space generously donated by Jeremy Rhoten. Check out his web site, EmuMovies.com, which also hosts a number of excellent emulator front ends! I'd also like to thank my former host, drx, for all his support throughout the past few years!
A lot of people have been asking me when the next version of Supermodel will be released. The answer is: when it's ready. I'd like to get it out before the end of the month so I can start working on dynamic recompiling CPU cores but I can't guarantee anything given my hectic schedule. There are still some sound bugs to resolve and lots of little loose ends to tie up here and there before a release can be made.
In other news, I got Ski Champ to boot today. Unfortunately, it suffers from the same issues that plague Harley Davidson and The Ocean Hunter, so it's not really playable and I haven't hooked up controls. Nevertheless, it's a small step forward for compatibility!
Spikeout is playable now. I haven't tested it extensively but it seems to be running quite well apart from some lock-ups in attract mode and nasty texture glitches (similar to Virtua Fighter 3 and Star Wars Trilogy) caused by Supermodel's imperfect texture caching.
Because Spikeout relies so heavily on texture offsets, I figured out a way to make them work with model caching. The problem was similar to that of hash table collisions. Each look-up table entry in the model cache, which corresponds to a unique model address, now contains a linked list of model vertices decoded with different texture offsets. This fixes a number of bad textures in different games. Pictured below is Fighting Vipers 2, which previously did not look quite correct.
Frequently, the best way to solve a frustrating problem is to step away from it for a long while. Then, you'll be able to look at it with a fresh pair of eyes. For a couple weeks, I was getting very frustrated with my inability to get the Model 3's sound board to produce audio, even when feeding it MIDI commands directly. Then, the other day, while searching for the code that instructs the sound processor to play a loaded sample, I stumbled across a bug in my old 68K emulator that I had never caught before. It turns out that logical shifts behave differently on the 68K and X86 architectures when the shift count exceeds the register width. On the 68K, the result will be 0, but on X86, it is undefined and can leave the register unmodified! This was causing an important code path in Scud Race's sound driver to fail.
Fast forward a few days, Nik and I have not only got the Model 3 sound board generating audio for many games, we've figured out how the PowerPC and 68K communicate. We've even got a build with sound output up and running, although it's still a bit jittery now and then due to the overhead introduced by the sound board emulation. We're also now using Karl Stenerud's excellent Musashi 68K emulator, which although slower than Turbo68K, works in both 64- and 32-bit builds. There are still some bugs and performance issues to work out, and the MPEG board is not yet emulated, but stay tuned! Slowly but surely, we're on it.
I finally found a few hours to play with Supermodel these past few days. [krom] submitted a patch adding a few ROM sets. Dirt Devils appears to be playable, albeit with encrypted 2D graphics and also some unusual 3D glitches, namely inverted polygon normals on the left wheels of the vehicles. Spikeout was also easy to get up and running but something is preventing it from entering the game.
I finally got around to hooking up a feature I had worked out months ago in my standalone prototype renderer: texture offsets. Virtual On: Oratorio Tangram makes extensive use of them, which is why the bots never looked quite right. They are also cleverly employed by Scud Race and Daytona USA 2 during the vehicle selection screens to apply different texture maps without updating polygon vertices.
Unfortunately, texture offsets are not yet ready for prime time and likely will remain disabled in the next release. They are not compatible with Supermodel's texture and model caching systems, and actually cause more problems than they solve. Eventually, I intend to rewrite the entire 3D engine but before embarking on such a time-consuming overhaul, I need to uncover more of the Real3D's secrets.
I haven't been working on Supermodel because I've been busy with research and other business. But that hasn't stopped Nik Henson from contributing some fantastic work! Below is a video of one of our play testers, Abelardo, coming in first place in Scud Race with his XBox 360 controller.
Nik has been working on reverse engineering the Z80-based drive board that controls the force feedback servo motors. He already has basic force feedback working but due to a lack of information on the servo boards, some details are still eluding him. If anyone has access to an actual Model 3 cabinet with the motor boards, please contact me and I will put you in touch with Nik, who could really use your help.
It's about time for a progress report. Nik Henson submitted a fantastic rewrite of Supermodel's input system for the next version. The new system is extremely robust -- just about anything (keyboard, mouse, gamepad, etc.) can be assigned to any Model 3 control. Yes, this means racing games are finally playable with steering wheels! Multiple mice are also supported, meaning Lost World can be played with dual lightguns.
Unfortunately, progress on sound has been slow. I've incorporated an earlier version of ElSemi's SCSP core (muchas gracias!) but haven't yet worked out the details of the PowerPC/68K serial link. Work on Supermodel has slowed down considerably due to real life matters but I still manage to put in a few hours each weekend.
In other news, the excellent Emu Loader frontend has added support for Supermodel.
For those who dislike using the command line, some industrious Supermodel fans have developed GUI front-ends that can launch the emulator for you.
Thanks to Nik Henson, a 64-bit Windows build is now available from the Download page! I haven't tried it myself (I don't have 64-bit Windows) but Nik says it is a little bit faster at points where the 32-bit build normally slows down. I've also made a very minor source update, adding GLEW headers that were missing. The annoying GLEW-related warnings on Microsoft Visual C++ are now suppressed.
Thanks, everyone, for all the positive feedback! It's nice to hear that people are enjoying themselves.
I've posted a small source code update. R. Belmont fixed the UNIX Makefile and added a Mac OS X Makefile. He also made some other minor changes to the source code. Thanks to Nik Henson, a bug that was causing crashes on some 64-bit builds has been squashed. The Render3D object pointer was not being initialized properly in the CReal3D class. None of these changes seem to affect the 32-bit Windows executable, so it has not been updated.
Some users have reported shader linkage errors and severely crippled 3D graphics (particularly on older ATI GPUs). There is a solution for this that ought to work in most cases.
Supermodel is here! Although very prelimary and far from where I ultimately want it to be, I feel that I've teased everyone for long enough. Version 0.1a can be grabbed from the Download page. Make sure to read through the Help section for installation and basic usage information. So what's new in Supermodel that hasn't made it to MAME yet? The graphics should look substantially better. Lighting and shading are generally more accurate, although still imperfect. Fog has been implemented and so has the spotlight effect. The 2D graphics emulation still has some issues, namely with regards to priorities, but is otherwise much more accurate. Layer masking and scrolling are mostly working. Several games are playable -- check out the About page for a compatibility list.
So where to from now? Besides boosting compatibility, the really big things left to do are sound, a dynamic recompiler for the PowerPC, and a proper user interface. I'm not yet sure how I'm going to prioritize these things, but I'm leaning toward tackling sound first. I anticipate having much less time to devote to Supermodel in the coming months but whatever progress is made will be reported here first. So keep your eyes on this spot. In the meantime...
Gentlemen, start your engines!
[ What's New ]