Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sinshu

Managed Doom - A Doom port written in C#

Recommended Posts

How difficult was it to convert the C code to C#?  I don't know anything about C# but given the name I assume you get at least a bit of compatibility with C (like curly brace syntax), but I imagine the semantic differences would be signficant.

Share this post


Link to post

@andrewj

In general, if the target C code does not contain tricky pointer arithmetics or macros, it should not be so hard to convert to C#.
Regarding the Doom source code, although such tricky parts are not so much, there are lots of array index out of bounds errors especially in the rendering module. These errors are not fatal in C, but the program immediately crashes in C#. It was not easy to consider how these errors can be avoided without performance degradation.

Share this post


Link to post

Interesting! Is it compilable in say VS 2010 Express?

Share this post


Link to post

@Lobo

This port requires .NET Core 3.0 or higher.
Since VS 2010 only supports .NET Framework, it's not possible to compile without modification.

Share this post


Link to post

Interesting project. Any plans for it beyond re-implementing the vanilla game?

 

Andy Stewart (eschdoom) at one point was working on a C# port of Doom. I don't think it ever got an actual release, even though he recorded a few demos with it (notably Sunder MAP11). He's gone MIA and his website no longer exists, here's about the only info I could find on it: https://web.archive.org/web/20131208054504/http://whatisblueandfurry.com/eschdoom/tech1dotnet/t1dn.html

 

Share this post


Link to post

Seems interesting! I used to have a very few C# lessons during high school, and gotta say it's sorta more complicated than C/C++.

Calling @Redneckerz here...

Share this post


Link to post
56 minutes ago, plums said:

Interesting project. Any plans for it beyond re-implementing the vanilla game?

Although there is no long-range plan now, I think DeHackEd support is essential to catch up with other ports.

Share this post


Link to post

I have an immense amount of respect for people with the technical knowledge and determination to do something like this.

Congratulations! It is always satisfactory to see new ports being released, specially using different programming languages!

Share this post


Link to post
On 8/1/2020 at 1:37 PM, plums said:

Interesting project. Any plans for it beyond re-implementing the vanilla game?

 

Andy Stewart (eschdoom) at one point was working on a C# port of Doom. I don't think it ever got an actual release, even though he recorded a few demos with it (notably Sunder MAP11). He's gone MIA and his website no longer exists, here's about the only info I could find on it: https://web.archive.org/web/20131208054504/http://whatisblueandfurry.com/eschdoom/tech1dotnet/t1dn.html

 

Oh i remember that one. Was Eschdoom not known for his weird levels, which were Escher-like (Hence the user name)?

On 8/1/2020 at 1:41 PM, InDOOMnesia said:

Seems interesting! I used to have a very few C# lessons during high school, and gotta say it's sorta more complicated than C/C++.

Calling @Redneckerz here...

I was aware of this port for some time already but, being the clueless idiot that i am, when i saw it was a port to C#, i didn''t immediately think much of it. But in reality, it obviously is. Very impressive stuff and i am glad the author is here in this very thread :) Thanks for the tag!

Share this post


Link to post
16 minutes ago, Redneckerz said:

Was Eschdoom not known for his weird levels, which were Escher-like (Hence the user name)?

No, the only mapset he released was Doom 2 Reloaded.

Share this post


Link to post
2 hours ago, plums said:

No, the only mapset he released was Doom 2 Reloaded.

Thanks.

I recalled the one thing i was trying to come up with my question, but it was not weird levels perse. Eschdoom used to work on a PrBoom based source port that would render Doom levels in isometric/orthographic projection in real time. Never was released.

Sources:

And the original source:

 

Share this post


Link to post

@Sinshu

Do you plan to implement better mouse controls? I would like to disable vertical movement if possible. I use keyboard exclusively for running and strifing.

Share this post


Link to post
On 8/1/2020 at 10:39 PM, Mr.Rocket said:

All in all, how long did it take you to do this?

 

According to the oldest backup files, it seems that I started this work on Sep. 3, 2019.

It therefore took about 11 months to reach the playable state.

Share this post


Link to post

Wow, this was pretty easy to compile and run!

I've been checking it out lately and added Hacx.wad to the iwads list via Wad.cs, GameMode switch.

Also added Freedm.wad there, even though there's no multiplayer. However, I saw that there's a branch that might be adding it.

 

I didn't place any changes on the git about it, just doing this locally.

I'm aware that Managed-Doom supports drag n drop, but I ended up making a simple launcher for it also, just to make it easier to load iwads, pwads, and .deh from various locations. ~ as well as a fullscreen/window resolution selection, among other things. ;)

Question: do you plan on adding a sizable window where it can be scaled by using the mouse? ~ since obscure resolutions can already be changed without effort and the engine's ok with it. ~ Or would SFML not like it?

 

I like this source engine!

 

Thanks

Edited by Mr.Rocket : cause I wanted to..

Share this post


Link to post

Thank you for the reply!

 

10 hours ago, Mr.Rocket said:

Wow, this was pretty easy to compile and run!

 

That's nice to hear, since one of the main goals of this project was to make an easy-to-compile port.

 

Regarding the window size, I have added the variable window size support as well as some options to choose a preferable aspect ratio in the past. You can see these changes in the aspectratio_correction branch.

 

However, I didn't merge them to the main branch for several reasons. The biggest reason was that I wanted to keep the codebase simple. Another reason was that the implementation above was not good in terms of graphic quality, since it simply scales the software rendered backbuffer to the window size. The best way is to modify the software renderer to make it support arbitrary resolutions, but that requires a lot of study and work...

Share this post


Link to post

It has been a long time since I last posted about v1.1a here.
I've improved various parts of Managed Doom, and would like to inform you about them.

  • Fixed crashes caused by various factors.
  • Added full DeHackEd support.
  • The SoundFont MIDI synthesizer has been re-implemented from scratch, with improved quality and support for reverb and chorus.
  • Added drag & drop support for loading WADs.
  • Improved demo playback compatibility. I've tried a number of D2ALL speedrun demos, and none of them went desync so far.
  • Fixed issue where zoom keys do not work on some keyboards (thanks to Mr.Rocket).
  • Refactored the platform dependent code for better portability.

The newest Windows binary (v1.2e) is here:
https://github.com/sinshu/managed-doom/releases

 

By the way, a friend of mine reported that this port runs on Mac without any difficulty.
I didn't notice this because I only have a Windows machine, but Microsoft has done a great job of making .NET cross-platform.

Edited by Sinshu

Share this post


Link to post

Since it's the New Year, let me announce an update to Managed Doom.

 

The latest version is now v2.0b and the biggest change is the move from SFML.Net to Silk.NET. I still like SFML and its API design is the best for me, but since SFML.Net has not been updated for a long time, I decided to use Silk.NET which is better maintained.

 

The following is a list of changes from v1.2e:

  • Migrated from SFML.Net to Silk.NET.
  • Fixed issue where cheat codes that should work in nightmare mode do not work.
  • Improved DeHackEd compatibility.
  • Added -solo-net option.
  • Reduced CPU load of the SoundFont synthesizer.
  • Fixed wrong calculation in spatial audio.
  • Fixed crash in some PWADs (now KDiKDiZD should work).
  • Updated .NET to 7 and introduced the officially supported native AOT compiler.

The latest win-x64 binary is here:
https://github.com/sinshu/managed-doom/releases

 

By the way, in developing Managed Doom, I created several libraries on my own, and I would like to introduce them to you in case they may be of some use.

 

MeltySynth
https://github.com/sinshu/meltysynth/

MeltySynth is a SoundFont MIDI synthesizer written in pure C#. It was originally started as a built-in synth for Managed Doom, but later released as a separate library. This library is primarily intended for gaming applications and is tuned to have a low CPU load during playback.

 

DrippyAL
https://github.com/sinshu/DrippyAL

Managed Doom uses OpenAL to handle sound. While it is easy to play sound effects in OpenAL, streaming music is tricky. This library is an SFML-like OpenAL wrapper that makes playing sound effects and streaming music easier.

Share this post


Link to post

Congrats on the new Managed Doom release! Oh, and those libraries could be game-changers for any C#-based ports. @hobomaster22 might love them.

Share this post


Link to post

Well, I somehow missed that. I guess you went through similar pains that I went through with Mocha Doom some 10 years earlier. Maybe with a few more niceties -Java didn't even have unsigned types, when I tackled this...

Share this post


Link to post
14 hours ago, Maes said:

Well, I somehow missed that. I guess you went through similar pains that I went through with Mocha Doom some 10 years earlier. Maybe with a few more niceties -Java didn't even have unsigned types, when I tackled this...

 

The biggest pain for me was demo compatibility. I was surprised that Mocha Doom maintains demo compatibility in a managed language, so I tried to do the same, but it required a lot of work...

Share this post


Link to post
6 hours ago, Sinshu said:

 

The biggest pain for me was demo compatibility. I was surprised that Mocha Doom maintains demo compatibility in a managed language, so I tried to do the same, but it required a lot of work...

 

Well, basic/non-overflow/non-bug demo compatibility should come "naturally", if you otherwise translate the base mechanics of everything correctly (assuming that you keep working with the equivalent of fixed_t and BAM angles internally and don't screw up the signedness of certain operations). For more exotic stuff you need to add special handling/bug emulation, as that, indeed, won't come "naturally" in a managed port. That being said, if you have a way to compare memory/variable values at key points where desyncs occur, using a regular source port as a reference, you can actually go a long way towards emulating pretty much whatever you want. It's just that it's a long and tedious process (I didn't forget about you, @kb1, thank you for all the time we put in this together).

Share this post


Link to post

Sinshu, I really liked Doom Managed. It's clean, light and tastes vanilla. I gonna follow the project. My question is: in the managed-doom.cfg file, I changed mouse_disableyaxis from "False" to "True", but the system remains "True" during gameplay. How should I proceed? Thank you for creating this beautiful sweetness!

Share this post


Link to post
34 minutes ago, dmnwizard said:

Sinshu, I really liked Doom Managed. It's clean, light and tastes vanilla. I gonna follow the project. My question is: in the managed-doom.cfg file, I changed mouse_disableyaxis from "False" to "True", but the system remains "True" during gameplay. How should I proceed? Thank you for creating this beautiful sweetness!

 

Oh, that is a bug I made when the mouse-related code was moved to Silk.NET. I'll fix it later.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×