Implementing the Daggerfall Character Creation System in DaggerXL is coming along. I have enough done that I thought it would be a good time to talk about the progress made so far.
Posted by luciusDXL on Jun 5th, 2010
The Character Creation system has been taking a while and it's not done yet, so I thought I'd share some of the progress so far.
The first thing I noticed when setting up the character generation is that there are a lot of "popup" windows with text, and these windows sometimes have buttons on them with various options (Yes/No, Male/Female, etc.). The background is a sort of paper made up of a few tiles with text read from the Text.RSC file. So the first thing I had to do was make a system for creating a popup window that automatically sized itself based on text read from a "Text Record Database" file, while formatting that text and appending buttons in automatically generated positions - again based on the widest text line and the height of the text block. When an option is selected the window needs to disappear, return control to the parent window and optionally notify said window of which button was hit (if any - not all popups have buttons).
This system wasn't well formalized up to now, so I added a formal notion of layered windows which can either pass through updates (clicks, keystrokes) or absorb them. These layered windows are rendered from bottom to top and updated from top to bottom, stopping once a window absorbs the input. All the existing UI will be migrated to use the improved system, simplifying the code in the process.
Now all I have to do to create a popup is specify the text record index, some flags (which buttons if any) and add it as a new window layer. The system (the character creator in this case) doesn't need to manage it anymore after that - making it really easy to use. Here is are two examples of the popup windows, from the province selection part of the Character Creation:
All the text comes from the text record database files. The province select also reads a special "mask" image, which is not rendered as a texture but used to determine which province the user is clicking on. Unfortunately, the mask image doesn't exactly match the rendered image which is why selecting a province can be slightly finicky in Daggerfall - and also in DaggerXL. Fortunately it's close enough and works well enough so I'm going to leave it alone since it behaves just like vanilla Daggerfall.
There is a lot more elements finished, such as the class selection, but I'll describe other parts in more detail in a future post once the system is complete. For now I'll leave you with more images of completed elements: