|
|
2 月之前 | |
|---|---|---|
| .. | ||
| .config | 2 月之前 | |
| .vscode | 2 月之前 | |
| Core | 2 月之前 | |
| Platforms | 2 月之前 | |
| NetRumble.sln | 2 月之前 | |
| README.md | 2 月之前 | |
Net Rumble is a two-dimensional shooter, pitting up to sixteen players against one another in an arena filled with asteroids and power-ups.
Net Rumble is a complete XNA Game Studio sample game. The project comes ready to compile and run, and it's easy to customize with a little bit of C# programming. You are free to use the source code as the basis for your own XNA Game Studio game projects, and to share your work with others.
Net Rumble is a two-dimensional shooter, pitting up to sixteen players against one another in an arena filled with asteroids and power-ups.
This is a modernized version of the NetRumble sample from the XNA Game Studio era, updated to use:
The following improvements have been made in the XNA Game Studio 4.0-compatible version of Net Rumble:
NetRumble.Windows.csprojNetRumble.DesktopGL.csprojNetRumble.Android.csprojNetRumble.iOS.csprojThis game demonstrates the following features:
The Windows version of this sample requires a minimum desktop resolution of 1280×720 pixels.
System Link and Games for Windows - LIVE multiplayer require that each Windows computer participating in the game be connected to a common network. In addition, each player using Games for Windows - LIVE must have a Gamertag associated with a valid App Hub membership.
Note: In order for two instances of Net Rumble to connect to one another, the Guid property in AssemblyInfo.cs in all projects must match. If you create a Windows project and an Xbox 360 project by using the New Project dialog box, you will need to copy the Guid from one project to the other in order to connect.
Follow these procedures to get started.
Tasks: Run Task → build-windows to build for WindowsTasks: Run Task → build-desktopgl to build for DesktopGLTasks: Run Task → run-windows to run the Windows versionTasks: Run Task → run-desktopgl to run the DesktopGL versiondotnet build NetRumble.Windows.csproj
dotnet run --project NetRumble.Windows.csproj
dotnet build NetRumble.DesktopGL.csproj
dotnet run --project NetRumble.DesktopGL.csproj
dotnet build NetRumble.Android.csproj
# For deployment to device/emulator, use your preferred Android deployment method
NetRumble.sln in Visual Studio 2022The project is organized as follows:
Core/
Platforms/
NetRumble.Windows.csproj (DirectX)NetRumble.DesktopGL.csproj (OpenGL)NetRumble.Android.csproj (Android)NetRumble.iOS.csproj (iOS)NetRumble.sln: Solution file for Visual Studio
README.md: Project documentation
Net Rumble uses the following keyboard and gamepad controls.
| Action | Keyboard Control | Gamepad Control |
|---|---|---|
| Select a menu entry | UP ARROW, DOWN ARROW | Left thumb stick, D-Pad up/down |
| Accept the menu selection | SPACEBAR, ENTER | A, START |
| Cancel the menu | ESC | B, BACK |
| Move the ship | None (gamepad required) | Left thumb stick |
| Fire the current weapon | None (gamepad required) | Right thumb stick |
| Fire a mine behind the ship | None (gamepad required) | Right Trigger |
| Pause the game | ESC | START, BACK |
Note the following areas when implementing the sample.
The flow of a networked game, from creation/join to lobby to game and back again, is implemented with screens derived from the Game State Management sample code. Packets are sent between the players, each starting with a 32-bit integer value containing the packet type, defined in an enumeration in the World class. Each game represents a new World object, and the initial state of the game is generated by the host.
The entity management and collision systems in Net Rumble are simple, given the small number of objects in any game. The systems use polymorphism to ensure a consistent set of interactions between all in-game objects, all of which derive from the GameplayObject class.
The CollectCollection class allows the game loop to target GameplayObject objects for removal from the game without actually removing them from the list. Removing an item from a list invalidates all iterators, which would disrupt the update loop. Objects to be removed are added to the Garbage list, and when the CollectCollection.Collect method is called, the items in the Garbage list are removed from the main list (and the Garbage list is cleared).
Net Rumble uses the game screen management architecture from the Game State Management sample. The BackgroundScreen class animates a Starfield object while it overlays various menus, and the GameplayScreen owns the World object object that drives gameplay.
This game also uses the bloom post-processing component from the Bloom Postprocess sample. It is not added to the Game object's component list, as doing so would add bloom to all elements rendered by the screen management system, including the user interface elements. The GameplayScreen object creates and manages the component, such that the game elements are processed by the component but not the user interface.
You can alter gameplay in many important ways by adjusting the constant variables, which you can find in the relevant classes.
There are many possible ways to improve on or extend Net Rumble.
World.GenerateWorld function to create any number of possible level configurations. Other possibilities include adding a randomly generated maze, assuming you can guarantee that the players are never sealed away from one another.There are also many possible optimizations that you could make. Many of these were not made because the current code is simpler, and the design of the game as it is today did not require them.
ParticleSystem objects and Projectile class-derived objects. One possible solution would be to add factories for these objects—factories that could recycle these objects when they are no longer needed.This project is based on the original Microsoft XNA Community Game Platform sample and is provided for educational and demonstration purposes.