370 likes | 382 Views
Help the Gunsmithing Major rescue her kidnapped kitten, Sparkles, by fighting enemies and building new weapons along the way. Use C# language, XNA graphics framework, JigLibX physics, and XWinForms inventory menus.
E N D
Story Overview • You find your kitten "Sparkles" has been catnapped! You discover a note left by his captor and vow to retrieve your precious Sparkles. Little did your newfound enemy know, you are actually a Gunsmithing Major at the local Community College. You will stop at nothing to save him, fighting your way through various environments, building new weapons as you go to take down increasingly tougher enemies. • Gunsmithing major gives an excuse as to why main character can create guns as well as she can.
Technical Overview Terence Lee Grant Johnson Kevin Hobson Jeff Patterson
Technologies Used • Language: C# • Graphics Framework: XNA • Physics: JigLibX • Inventory Menus: XWinForms • Installer: Inno Setup 5 • Tools: • Visual Studio 2008 • Paint.NET • Blender
Game Framework • Custom model renderer • Everything is a SceneNode • Combined with JigLibX physics • Handles collisions and movement
Game ScreenManager Menu Screen Game Screen Pause Screen LevelManager GameManager Console CollisionManager Debug Drawer Level Editor SceneManager SceneNodes Entities ModelNode SceneNode Entity Enemy Item Level PhysicalNode FPSCamera LevelNode WeaponPart Weapon
Physics System • JigLibX • Gravity • Friction • Collisions • Collision event handlers • In ModShooter: • Relative bounding boxes • OR triangle accuracy meshes (levels)
Control System • Common FPS controls • WASD movement and strafing • Spacebar: Jump • Control: Crouch • Shift: Run • Mouse: Look and fire • Crouching and jumping is context sensitive • Need to calculate distance from ground
Improvements • Different graphics framework • XNA too low level • Had to implement basics such as: • SceneNode framework • Camera system • Model rendering/transforming • Convenience of matrices vs Euler vectors • Additional calculations, no simple object transformations • Comparatively few resources • However, C# was good • Should have used more interfaces • Did not refactor code often; test code remains
Inventory Select your action, then select your barrel.
Previously • Could select parts and build weapons. • No information. • Could not un-equip weapons without disassembling them. All of this has been addressed!
// Inventory Screen TODO • Add data displays for parts and weapons. • Show stats of individual parts. • Preview resulting stats from valid combinations. • Show stats of weapon, parts it’s using. • “Unequip” button: save a weapon for later. • Prohibit selection of incompatible parts. • Or at least tell the user “NO!”
Let’s build! • Information boxes for each action and barrel • Information for weapons • “Dequip” button There’s more! • Can now discard unwanted items • Can NOT assemble incompatible parts • Given a few parts to start with
Weapon system If you build it, they will be shot
Last time • Infinite ammo • One click, one shot • Physical bullets • Invisible gun! • Code all over the place • Manual naming
//Weapon System TODO • Consolidate methods into Player class. • Connect weapon’s fire rate, ammo capacity into game play. • Implement other weapons. • Shotgun • Machine gun
This time • Ammo and Reloading • Semi/auto firing • Hitscan • Mauser • Code consolidated • Auto named
Enemies • Behaviors (AI-ish) • STAND (for level placement) • AIMPLAYER • PATROL (unused, left over from previous TB) • PATROL_AND_CHASE • Models • Wizard, Warlock (unused – Texture issue) • AIMPLAYER shooting • issues
Improvements • More advanced AI • Behaviors not just based on distance from player • Waypoints • Fixing Textures (Warlock texture) • More models • Bullets and Walls
DropBox • When an Enemy is killed, they drop one of the following: • (A)ction Box – randomized action and characteristics • Upon pick up, this action added to the inventory • (B)arrel Box – randomized barrel and characteristics • Upon pick up, this barrel added to the inventory • Health Box
Installer • Inno Setup 5 used • Open source program • Comes with helpful installer-creating wizard • Included script with program creates Inno Setup’s installer! • Installer checks whether .NET 2.0 and XNA 3.0 is present • Issues: • Lack of familiarity with Pascal • Installing XNA 3.0 Redist files if not present
Environments Blender used to create game environments exported in XBF format
Data Driven Loading/Saving • Each Entity type implements two functions • LoadFromXml(XmlNode): Reads info from XML, sets properties of Entity • WriteXml(TextWriter): Writes the Entity’s properties in XML format to the TextWriter • Each Entity reads/writes data common to all Entities (Name, Model, Position, etc.) and data specific to its type (Life, AmmoCapacity, BarrelLength, etc.)
Sample XML <?xml version="1.0" encoding="utf-8" ?> <level> <levelModel>Content/Models/office</levelModel> <entities> <player> <camera> <position>10,0,-10</position> <xRotation>-0.04199977</xRotation> <yRotation>-0.6885061</yRotation> </camera> <life>100</life> </player> </entities> </level>
Console • XNAConsole • IronPython for scripting • Python Interpreter • Can change variables during runtime • Works with C# Reflection system • Custom commands • Save • Load • Spawn
Level Editing • Purpose of custom console commands • Can create any entity with any parameters directly from in-game console
Heads Up Display • Crosshair • Health • Ammunition • Color flashes for events • Hit by bullet: Red • Pick up health pack: Green • Death Screen
Health Boxes • Specialized Item Entity • Collision fires event • Increases player health • Notifies HUD • Deletes health box
Event Boxes • Take specialized action upon collision • Invisible except in debug mode • Warp Boxes • Send player to another location (same or different level) • Used to switch levels • Damage Boxes • Harmful to any entity (player or enemy) that touches it • Used for “dangerous” areas