18. December 2008 08:06
I spent the evening studying the modexlib and tracing code execution paths. I need to understand how WinROTT is addressing video memory so that I can begin the translation to Direct3D 9. The learning curve is steep. I haven't looked at video memory layouts in 15 years and I have no recollection of ModeX VGA modes.
I am working on the idea that WinROTT will render to a texture which can then be bit blitted to video memory. I've got a rendering framework put together from several examples in the Direct3D 9 SDK, but the physical format WinROTT is using for video buffers is very different from the format needed for a texture.
At the moment, the task is well defined:
- Learn Direct3D 9
- Understand how WinROTT is addressing video memory (i.e. how is it drawing graphics?)
- Translate the existing WinROTT video routines to something Direct3D 9 can understand
I'm also still in the process of performing code cleanup and modernization. I'm working on some aspects of the code that can utilize threading to improve performance.
17. December 2008 06:44
I started on a project to move WinROTT to Direct 3D from DirectDraw. I soon realized I had very little idea how WinROTT was drawing it's images. (WinROTT uses DirectDraw, modexlib and rt_vid to handle update of the video buffers and image rendering.) I managed a simple upgrade to DirectDraw 7 interfaces, but I'll have to learn how WinROTT is assembling its video images. I think WinROTT is using ModeX, which will mean a fair amount of work rearranging the video buffer to work with Direct 3D.
I also started a review of WinROTT data structures, with the intention of consolidating the use of byte, short, int and long data types. I'll be limited on the types of data structures I can use for disk storage in order to be able to read old ROT game files. ROTT was written to compile with C, not C++ compilers. I doubt the authors realized how much data was being exchanged between 32 bit and 16 bit numbers and the performance hit you take when converting.
Anyway, it's an interesting problem and I am probably going to learn a lot more about Direct 3D that I wanted to know. I'll try to have a release for this weekend with the updated direct draw code.
15. December 2008 22:49
Another update, with more code clean up and a couple of bug fixes. I've removed most of the byte ordering code. It wasn't necessary. I've also removed some "null" functions that performed no useful function. Progress is incremental, but significant in this release.
13. December 2008 22:04
There is a new release of WinROTT. Lots of changes with data declarations. Files are fairly well lined up with a header and implementation file. I've managed to remove all extern declarations from all .cpp files. Performance is enhanced in some sections of the code.
This release will allow me to move forward with code modernization and expanded network play.
30. November 2008 16:56
Update: Check out my wiki page for the latest download of WinROTT.
I'm making progress moving all extern declarations to header files and removing externs from any cpp files. I have been able to process about 50% of the CPP files. By getting all of the declarations worked out, it will allow me to have modules consisting of a standalone header file (.h) and implementation file (.cpp). I'm also able to see declarations that belong in different modules. For instance, several variables are declared in WinROTT, but are only used in one other module and not used in WinROTT. It's generally better to move the declarations and get rid of any global declarations.
Why do all of this? Once I get the modules properly divided up, I can begin to move code into class declarations. It will also make it easier to isolate OS and hardware specific code into separate dlls, rather than a monolithic program. It also helps me to become familiar with the code. I've already noticed several places where I can improve network code.
I'm also thinking it might be better to implement the game using a peer-to-peer protocol. Even though I am not a Microsoft fan, it might make sense to use their peer-to-peer protocol for WinROTT. I'd appreciate any comments on this. I'm interested in the MS P2P as a chance to become familiar with the protocol.