My friend and I have decided to build a title for the Playstation Vita. Knowing C# and XNA, I thought it would be a good experience to dig deep into the PSM SDK and the Game2D framework. There have been some struggles and frustrations getting up and running. We’re not certain that we’ll ever finish but we figured it would be fun to document the process. The dated sections here are going to be in reverse-chronological order (newest first). Enjoy!
I fixed up some issues with collision detection and set up a fun scenario where tons of birds are attacking the hero.
It’s been a couple months since an update but there is a lot of new logic in place. The game now has it’s first enemies. Each enemy is written as a separate class that implements it’s own specific behavior. For example, an armored guard will run directly at you if he sees you. If you change direction then he follows closely behind, changing direction as well. If a bird sees you he delays for a moment, chooses a flight path, and dives at you very quickly. Each of these enemies are spawned from a spawn zone that is defined in a file that parallels the World Map XML. Any enemy listed in the spawn file references a global Enemy Repository XML which defines the parameters necessary for enemy creation. The second half of the video is shown with the Debug_DrawAll directive active. Specific logic was added to check for this directive and draw additional boxes that show where the Collision and Vision areas live. You can see that when the hero enters the vision of an enemy, their attack behavior is activated. When an enemy’s collision box runs into another collision box, it is not allowed to pass through.
Things may not look much different, but behind the scenes a World Map framework was implemented along with the ability for a character to walk from one area to the next. The PSM SDK Game2D Director is utilized to replace the current scene with a new instance of the same scene with different parameters. Map textures, NPCs, and various other map-specific parameters are loaded dynamically from a global World Map XML file. Updates were also made to the camera so that it will not longer scroll past the edge of the map, making for a much cleaner viewport into the virtual world.
In order to get NPCs to speak, we needed to figure out a proper object model that could be queried at runtime. The NPC dialog scripts are loaded along with the map and associated with the corresponding on screen characters. It’s starting to look like a real town!
We are using the Tiled format for building maps and the this video shows a Tiled map with a freely roaming NPC loaded from XML and a main character with full animation sprite running at 60 fps. It took a considerable amount of time to understand how to load this map without negatively affecting performance.
The first task is understanding the development environment and getting some animated sprites on the screen. This is a boring video that shows progress after only a couple days of development.