Rocks'n'Diamonds Wii - A project that I'm trying to finish

Discussion around programming R'n'D, its source code and its tools.

Moderators: Zomis, Flumminator

Post Reply
asiekierka
Posts: 143
Joined: Fri Aug 19, 2005 6:18 am
Location: Poland
Contact:

Rocks'n'Diamonds Wii - A project that I'm trying to finish

Post by asiekierka » Mon Feb 23, 2009 5:03 pm

Hey. I'm porting Rocks'n'Diamonds to the Wii. I made some progress (it loads WAVs and PCXs), but I got stuck in 2 places.

1) strncmp fails in LoadCustomMusic_NoConf (nah, commented music out for now)
2) strerror fails in DrawMainMenuExt (*sigh*. I can't fix that one)

Progress and thoughts so far:
- Boots
- Detects GFX
- Loads GFX
- Loads audio
- ...I have to admit it. The RnD code is sort of a mess. Holger, could you split the largest files one day?
- The RnDWii code is an even larger mess though. Sorry for that.
I'm just tired right now, after all this work I made yesterday and today.

Maybe someone will help?

-- asiekierka
GraphicsPack project: 90%
IconXT project: 100% (version final is ready)

HerzAusGold
Posts: 326
Joined: Sun Sep 25, 2005 4:41 pm
Location: Germany

Post by HerzAusGold » Sat Feb 28, 2009 7:43 pm

Please describe how this project work.
Do you have an emulation for Wii?
What compiler you use and tools?
How to setup the Wii?
And the SDL it is available for Wii?
And the answer is ... 42 !

asiekierka
Posts: 143
Joined: Fri Aug 19, 2005 6:18 am
Location: Poland
Contact:

Post by asiekierka » Mon Jun 15, 2009 7:52 pm

DID IT!
I rewrote the port and now it's working!
Except for some small issues:
1) Why the hell did holger use 672x560 and not normal 640x480 which SDL-Wii needs to run!? I PM'd him about the issue, too.
2) The sound is high-pitched

Runs with an USB keyboard. Works. Loads slow as hell though. But works.
When I fix issue 1), I may upload it here.
GraphicsPack project: 90%
IconXT project: 100% (version final is ready)

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger » Mon Jun 15, 2009 9:33 pm

> Why the hell did holger use 672x560 and not normal 640x480 which
> SDL-Wii needs to run!?

Good question indeed! The short answer is, as always with a "historical" project like R'n'D: for historical reasons! ;-)

The (a bit) longer answer: I started this project in 1995 on a Unix/X11 workstation, which did not have any fullscreen screen modes available, but usually started with screen resolutions with 800x600 or higher. Therefore, any program just used a window on a desktop, so it was sufficient to take care that the window wasn't bigger than a reasonable desktop screen, but a certain aspect ratio (as it would be important for fullscreen modes) wasn't a criteria.

As early R'n'D versions did not try to emulate existing BD/EM/SP games as close as possible (but just was "yet another EM clone"), I just chose a playfield size that I liked (17 x 17 tiles) and added some surroundings like game panel and screen borders, without trying to match a well-known fullscreen size like 640x400 or 640x480. (Mirror Magic, R'n'D's predecessor, still used 640x400, as it was ported from the Amiga, where I used 320x200 as a resolution to be viewed in fullscreen mode.)

From your PM (hope you don't mind that I publicly quote it here):
> Do you know how to set RnD to exactly 640x480?

This would be quite a bit difficult, although probably not totally impossible.

The main problem are levelsets with existing artwork (using R'n'D's native window size), while it would be a bit easier with sets without custom artwork (although it would require adjusting the "classic" artwork to the new screen resolution.) Squeezing the R'n'D screen to 640x480 without the need of creating new artwork could be done by changing the playfield size and cutting some areas of the screen (top and bottom, and some from the middle). While the in-game screen would be relatively easy, the menu system could be a bit more tricky (as some parts of the menu options would be cropped and therefore unreadable, or at least harder to read/guess).

In fact, I already thought of such a "cropped" mode by myself, to make it easier to match certain TFT fullscreen resolutions, and to be able to create pixel-accurate, fullscreen emulations of EM and SP (for example), without having unused black area around the game area.

For your WII port, I think that a "hacked" solution as described above would be the best first step. If I ever add such a "cropped screen mode" by myself, you could then use this instead.

BTW: I also would be interested in the answers to HerzAusGold's questions! :-)

User avatar
Sigma
Posts: 27
Joined: Fri Jan 30, 2009 1:46 am
Location: Australia

Post by Sigma » Mon Jun 15, 2009 11:47 pm

Holger wrote:> The main problem are levelsets with existing artwork (using R'n'D's native window size), while it would be a bit easier with sets without custom artwork (although it would require adjusting the "classic" artwork to the new screen resolution.) Squeezing the R'n'D screen to 640x480 without the need of creating new artwork could be done by changing the playfield size and cutting some areas of the screen (top and bottom, and some from the middle).
Would it perhaps be possible to "stretch" the images? I.e. have the images dynamically resize to fit and keep their aspect ratio?
This should not be a problem for small size changes.

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Post by Holger » Tue Jun 16, 2009 12:04 am

> Would it perhaps be possible to "stretch" the images?

Theoretically yes, practically no.

As R'n'D uses bitmapped pixel graphics, and a fixed tile size, you cannot totally dynamically scale them, but only inside a limited range, like "double size" or "half size". For the suggested screen size of 640x480, this simply would not work well without using sub-pixel rendering (which itself would prevent doing the resizing once and then using the scaled graphics, but would require on-the-fly scaling during the whole program run).

To have things like this work well, we would need a transparent scaling layer between R'n'D screen drawing routines and the effective screen output. This *could* be achieved by using an OpenGL or DirectX rendering buffer (which would resize the output dynamically, with sub-pixel rendering), but would be slow on any but hardware-accelerated systems.

This looks to me like not being totally impossible, but being a future or spin-off project, as I'm currently neither familiar with OpenGL nor DirectX nor the implications for a platform-independent project like R'n'D.

asiekierka
Posts: 143
Joined: Fri Aug 19, 2005 6:18 am
Location: Poland
Contact:

Post by asiekierka » Tue Jun 16, 2009 5:03 am

Well, I could hack the SDL-Wii source code to do that maybe...

...and if yes, it will be good.

What about the sample rate problems? SDL-Wii supports only 32k and 48k, and you use... 8k and 22k? O_O

And another problem, though I must fix this one myself (in the SDL-Wii source code): UpdateRect does not work! I needed to use Flip instead which means it lags as hell!

Oh, and I think I will leave Rocks'n'Diamonds alone starting from when I fix UpdateRect, and work on Mirror Magic, which seems to have quite a better resolution for the Wii, and it's also a fun game!
Also, when I'm done with porting 3.2.4, I will try to make a diff of the changes so you can integrate them to RnD!

-- asiekierka
GraphicsPack project: 90%
IconXT project: 100% (version final is ready)

Post Reply