We have created our initial game engine which supports a player, location, game world, and moving around within it. Then we created the UI elements/components to display those in our game screen. We now have a game that we can move around in and investigate the images and descriptions of each location in our limited … Continue reading Lesson 2.11: The Wrap
Author: DarthPedro
Lesson 2.10: Moving in the Game World
Showing the player's location is the first step, but we also need to provide the ability to move around our game world. We're going to build some controls and event handlers that move the player between adjacent locations in the world. To begin we're going to create a new view model class to assist with … Continue reading Lesson 2.10: Moving in the Game World
Lesson 2.9: Creating The Game World
The location was a single spot in a larger game world. We want to represent the game world as a grid of places that the player can move to. We will manage that by creating a new World model class that encapsulates the structure of the world and exposes some methods for retrieving location data. … Continue reading Lesson 2.9: Creating The Game World
Lesson 2.8: Game Location
Now that we have our core design components in place (MVVM, Dependency Injection, Blazor components, and unit test coverage), we are going to focus on building out more game functionality. We will start with the game location. This lesson will add a Model class, update the view model, create a Blazor component to show the … Continue reading Lesson 2.8: Game Location
Lesson 2.7: Adding a Test Mocking Framework
With our current test project, we have several classes that we created to "mock" some simple behavior for our tests: MockGameSession, MockJSRuntime, and MockIconProvider. As we build out our game, we will need to mock more classes to help simplify our testing. Creating mock objects manually is repetitive and time consuming, so to increase our … Continue reading Lesson 2.7: Adding a Test Mocking Framework
Lesson 2.6: Refactoring to PlayerComponent
One of the Blazor's strengths is being able to componentize UIs into smaller pieces that can be composed into a page. We haven't taken advantage of that yet in our game screen. So let's start to do that by refactoring our MainScreen page to pull out the Player Data table into its own component. This … Continue reading Lesson 2.6: Refactoring to PlayerComponent
Lesson 2.5: Using Blazor Dependency Injection
Dependency injection (DI) is a software design pattern that removes hard-coded dependencies from an object and makes it possible to change those dependencies, whether at run-time or compile-time. This pattern can be used as a simple way to load plugins dynamically or to choose stubs/mock objects in test environments vs. real objects in production environments. … Continue reading Lesson 2.5: Using Blazor Dependency Injection
Lesson 2.4: Testing the MVVM Components
Now that we've put together all of the MVVM components, we're going to take a quick look at the testing across these components. View Model Tests We have already looked at the Player unit test in Lesson 2.1. Now, let's create some tests for the GameSession view model. In the SimpleRPG.Game.Engine.Tests project, create the GameSessionTests … Continue reading Lesson 2.4: Testing the MVVM Components
Lesson 2.3: Connecting Player – GameSession – Game Screen
We are going to complete the MVVM cycle by defining the view for our game - the Game Screen - to display and interact with the GameSession view model and the Player class. As a reminder of the MVVM design pattern: Fig 1 - MVVM pattern diagram To enable the View portion of this pattern, … Continue reading Lesson 2.3: Connecting Player – GameSession – Game Screen
Lesson 2.2: Initial GameSession View Model
When building client applications, there are different design patterns for separating the user interface, operations, and data models. For our game project, we will be using the Model-View-ViewModel (MVVM) pattern. Model–view–viewmodel (MVVM) is a software design pattern that helps with the separation of the development of the graphical user interface (the view) from the development … Continue reading Lesson 2.2: Initial GameSession View Model