If you’ve been around in the MonoGame discord lately, you may have seen me discussing recently porting the original Infiniminer game by Zachtronics from XNA 3.1 to (current) MonoGame 184.108.40.2063. Thought I’d created a forum post here to track the status and log of the port development as I continue on
One of the reasons I took up doing this port was out of sheer curiosity. I had never done a XNA-to-MonoGame port before, let alone one from XNA 3.1. I also thought it would nice to have a more complex game such as this as an example repository for other to look at and see. This was also a large educational experience for myself.
The repository for the port can be found at https://github.com/AristurtleDev/Infiniminer There are two branches in the repository
main: This branch is where all the MonoGame 220.127.116.113 port and future updates are added
original: This branch contains the original source code for reference.
Current Port Status
Infiniminer has been successfully ported from XNA 3.1 to MonoGame 18.104.22.1683 as a direct port. In it’s current state it is playable with no crashes or major known bugs. However, the port was done as direct and brute forced as possible, there are many things that need to be optimized or adjusted to get full performance out of the game.
The following is a list of know things that are either need optimizations or are broken
- DirectX version runs significantly worse than the OpenGL version. Current suggestions are in how the
DynamicVertexBuffer instances are created so often. Need to look into optimizing this
- Server/Client networking code is using the initial Lidgren version 1.0 to make the porting simple. The network code needs to be updated to either Lidgren Gen 3 or something more actively maintained like LiteNetLib.
Some users have reported that while playing there are occasional lag spikes that hit for ~1 second then go away. This is most likely caused by the issue mentioned above in number 1, however this could be related to the network code as well, so it is currently under investigation. fixed by @nkast in PR 14
The following are features and improvements I plan to add to the game once the issues listed above are all or mostly solved.
- Controller Support
- Rebindable Keybindings
- Fullscreen support and/or Independent Screen Resolution support
- Sprinting key for movement
As more features are thought of or suggested and approved they’ll be added to this list.
Pull Request #3: Created seperate DesktopGL and WindowsDX platform
- The project has now been reorganized so that there are separate clients for a DesktopGL build and a WindowsDX build. This is so it would be eaiser to test between the two for optimizations since the WindowsDX build seems to perform significantly worse than the DesktopGL version.
New project structure now looks like this
| | +---BloomEffect
| | +---Content
| | | +---04b_03b
| | | +---04b_08
| | | +---blocks
| | | +---icons
| | | +---menus
| | | +---sounds
| | | +---sprites
| | | +---tools
| | | \---ui
| | +---Engines
| | +---StateMasher
| | \---States
Common Client code, include the Content files were moved to
WindowDX projects both reference the content from there as linked content.
Pull Request #4: Restored original title screen
- Restored the original title screen. Nothing against wideshanks new title artwork that was added, just prefered the original artwork. Will look into making this a client setting choice on which artwork to use
Lots of recent updates, all thanks to @nkast
Below are the most recent changes in the port that he has contributed too.
Pull Request #8: Fix Threading
Thread.Sleep(1) was changed to
If the value of the timeout argument is Zero, the thread relinquishes the remainder of its time slice to any thread of equal priority that is ready to run. If there are no other threads of equal priority that are ready to run, execution of the current thread is not suspended.
Pull Request #9: Fix FPS Counter
This updates the FPS counter to accuratly display the FPS. The original method used was just counting the number of elapsed frames and dividing it with the total seconds passed in the game which gave inaccurate results.
Pull Request #12 Remove:
Since each platform has it’s own entry point, the unused
Program.cs was removed
Pull Request #13: Move shared content into shared folder
Previously each project type (DesktopGL and WindowsDX) had a seperate
Content.mgcb that both referenced the same assets. I was under the assumption that the
/platform flag in the
Content.mgcb is what the mgcb used when building content. However the
MonoGame.Content.Builder.Tasks.targets actually overrites that value based on the project type being built, so separate
Content.mgcb files are not needed
Pull Request #14: Create SamplerStates during initialization
Creates a cached
SamplerState during initilization instead of a new one each draw frame. This improves performance and GC pressure. Thanks again to @nkast for all of this work
Version 1.6 Released
This version adds initial controller support to the game. Right now, controller support is only when playing the game itself. The next update will overhaul the title, sever select, team select, and class select screens to add controller support to them as well. For now, they still have to be navigated with keyboard/mouse.
THANK YOU SO MUCH
This is really going to help out for my video game i’m working on.
I am working on a 3D voxel game I have a LWGJL but I need a voxel game engine in C# for Xbox support
Hey i’ve been trying to compile this for weeks but every time it fails. The server builds fine but the game.
/home/ksportalcraft/.nuget/packages/monogame.content.builder.task/22.214.171.1243/build/MonoGame.Content.Builder.Task.targets(142,5): error MSB3073: The command “dotnet mgcb /@:”/home/ksportalcraft/Documents/Infiniminer/source/Infiniminer/Infiniminer.Client.Shared/Content/Content.Shared.mgcb" /platform:DesktopGL /outputDir:"/home/ksportalcraft/Documents/Infiniminer/source/Infiniminer/Infiniminer.Client.Shared/Content/bin/DesktopGL/Content.Shared" /intermediateDir:"/home/ksportalcraft/Documents/Infiniminer/source/Infiniminer/Infiniminer.Client.Shared/Content/obj/DesktopGL/net6.0/Content.Shared" /workingDir:"/home/ksportalcraft/Documents/Infiniminer/source/Infiniminer/Infiniminer.Client.Shared/Content/"" exited with code 8. [/home/ksportalcraft/Documents/Infiniminer/source/Infiniminer/Infiniminer.Client.DesktopGL/Infiniminer.Client.DesktopGL.csproj]