In this update, I want to talk about the creation of the Dataset within the application. I will be creating a separate post to pick up where we left off with the Theme Settings from the last update.
Working with the Dataset control within Visual Studio is something that I’ve learned in school, and have worked with a lot since then. I chose to use Microsoft Access to house my data because I didn’t want the user to have to have Microsoft SQL Server installed and running on their machine, and I wanted the game to be playable offline. Most Windows users already have Microsoft Access on their machines.
Nothing can happen in the game without the Dataset. The reason why zRPG 1.0 was so disconnected from the Database was because I didn’t introduce the Dataset until after I had already created a Character and started working on the game. This would reluctantly allow me to create the objects I needed to move forward, but I had no way to save/load any data. This time around, I’m spending a lot of time working on the Dataset before I get moving on any sort of gameplay.
I started working on all of the things that need to happen before the game can start. This includes creating Items, Locations, Quests, etc.
This is kind of how everything is unfolding so far:
- User Clicks the “Create Character” button
- SessionFactory (New Factory) kicks off CreateNewSession() method
- Character is created
- World is created
- Session is created
- CreateNewSession() method will now call all the factories’ Run() methods
- ItemFactory runs
- LocationFactory runs
- MonsterFactory runs
- NPCFactory runs
- QuestFactory runs
- All Locations are added to the World and saved as WorldLocation objects
- Each time a WorldLocation is created the following objects are created (if applicable)
Everything in the list above went smoothly until I got to the point where I needed to create the LocationNPC records. I realized there was no way for me to know which NPCs should be at a given location. My solution to this problem was to add an X and Y Coordinate to the NPC table. (as well as the Monster and Quest tables) The coordinates can be used to lookup NPCs, Monsters and/or Quests while creating Locations. Let’s say I had an NPC named “Dad”, and I wanted him to be in the “House” location at the start of the game. I would simply give that NPC the same coordinates as the “House” location.
Unfortunately, there were no UI changes during this update, so I don’t have any screenshots to show at this time. There will be a “Theme Update” post coming soon that will certainly be more involved with UI and UX elements.
Thanks for reading! Hang tight for a more visual post, coming soon!