Jump to content
  • Advertisement
Sign in to follow this  
Ralph Trickey

Should I convert this project to dotNet

This topic is 4202 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This has probably been rehashed several time, so feel free to point me to a thread instead. I couldn't find a recent one. Are there any advantages/disadvantages to .Net that I'm missing? I've got a large Native C program (Operational Art of War) that compiles under C, and I'm converting to good Object Oriented code. Operational Art of war is a turn-based 2D wargame. It does memory allocation within the audio and video library only. It uses only two third party libraries that I'd have to convert to DLLs. The port to a nominal C++/CLI program looks like it is pretty trivial. Converting to .Net has some advantages that I can see. 1) potentially better optimizations for the processor the person is running on 2) the .Net library adds better support for XML, Graphics, etc. 3) the potential to port more easily to other platforms like the XBOX 360 once XNA professional comes out. 4) XAML, or the equivalent, instead of MFC. 5) Marketability of my skills 6) International Localization is easier. The disadvantages are 1) C++/CLI stability - I'm not sure how stable this is, MS already tried and dropped managed C++. 2) .Net stability - It's aready up to 3.5, and there were major changes between 1.1 and 2.0 Right now, I'm leaning towards .Net at a future date, but I'd like to hear other opinions. Thanks, Ralph

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Ralph TrickeyConverting to .Net has some advantages that I can see.
1) potentially better optimizations for the processor the person is running on
2) the .Net library adds better support for XML, Graphics, etc.
3) the potential to port more easily to other platforms like the XBOX 360 once XNA professional comes out.
4) XAML, or the equivalent, instead of MFC.
5) Marketability of my skills
6) International Localization is easier.


These are all technical issues, but they don't address the #1 concern.

Why?

If you're doing this just for fun, then do what you want.

But other than that:
- Do you intend to sell/distribute/publish this game and your target market cannot use existing version?
- Do you have a client that is willing to pay for the conversion since .Net is their requirement
- Is there a problem with existing version

The "potential" is wasted effort without a plan. Too many frameworks, designs and solutions were designed to address potential problems. In the end, they ended up as solutions looking for a problem.

As a side note, converting from C into OO code might as well be starting from scratch. In order to gain any benefits of OO, you need to use it to full extent from bottom up. Something that C code could never be ready for. While there are partial conversions, they almost always end up as such due to development budget constraints since full conversion isn't possible.

But if you merely take C code and compile it with C++ compiler, then you didn't really gain much, especially nothing of value (how code is compiled has 0 value to users).

The questions you need to answer is, what is the motivation for doing it in the first place? Why is that required of you? Is it even required?

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus

These are all technical issues, but they don't address the #1 concern.

Why?

I plan to maintain this program over the next several years. At least 3, and probably a lot more than that. I'm doing it part-time for 'fun', I have a 'regular' full-time job.
Quote:

If you're doing this just for fun, then do what you want.

But other than that:
- Do you intend to sell/distribute/publish this game and your target market cannot use existing version?
- Do you have a client that is willing to pay for the conversion since .Net is their requirement
- Is there a problem with existing version
This is a commercial game. Nobody is having problems with it at the moment, I'm looking towards the future. Depending of what I find out about XNA professional, XBOX 360 is a possibility, although, to be honest, a bit unlikely.

No client, the conversion is strictly for me. I plan to maintain it for a while.

Some minor issues. I'm using a freeware XML parser that is good, but doesn't support schemas, and doesn't support encoding other than utf-8. It only exports bmps, not jpeg or other compressed video. Things like that. I just 'feel' that by converting to .Net, I may be able to utilize a richer toolset, and that may speed development down the road. I definitely don't want to convert to something, just to reconvert to .Net.
Quote:

The "potential" is wasted effort without a plan. Too many frameworks, designs and solutions were designed to address potential problems. In the end, they ended up as solutions looking for a problem.

Agreed.
Quote:

As a side note, converting from C into OO code might as well be starting from scratch. In order to gain any benefits of OO, you need to use it to full extent from bottom up. Something that C code could never be ready for. While there are partial conversions, they almost always end up as such due to development budget constraints since full conversion isn't possible.

Actually, the C code is modular, and well-written. I can leverage a lot of it. The budget constraints are more that there are a large number of features that I can add, and a limited budget in time. I plan to convert modules one at a time, as I get down time while the current build is being tested.
Quote:

But if you merely take C code and compile it with C++ compiler, then you didn't really gain much, especially nothing of value (how code is compiled has 0 value to users).

Actually, compiling it as C++ was a huge benefit to the users<g>. The VS 2005 compiler detected a number of errors like uninitialized variables that the earlier V6 compiler hadn't caught.

The first step that I'm taking is wrapping the calls in static objects in order to make sure that the various calls are in the right modules, and that I don't have any accidental cohesion. The second step will be to rewrite the functions and their calls to do things like Unit[the_unit].isValid() instead of Unit.valid(the_unit.) I should be able to do this in C++ by overriding the [] operator, while leaving the existing code intact.

If this was a one-off, I agree that it doesn't add anything of direct value to the user. Since I plan to continue enhancing this code for the next several years, there is a definite downstream benefit in refactoring the code. I'm not as sure about .Net, although working with the same basic libraries at home and at work has it's advantages.
Quote:

The questions you need to answer is, what is the motivation for doing it in the first place? Why is that required of you? Is it even required?

The refactoring part, definitely. I plan to use this code for several years. The .Net part is what I'm not sure of. We're using dotNet at my day job, and there are some benefits to using it here as well.


Share this post


Link to post
Share on other sites
Antheus had pointed out many imported issues, about why NOT to convert, but if you really plan to convert and to learn how to program computer/console games then the choice is obvious - C++.
.NET framework, despite what Microsoft says, was never meant to be a game programming platform. It's just too slow! However if your game is turn based ( no 3d real time graphics ) then this issue is of an less importance.

Share this post


Link to post
Share on other sites
Actually, Antheus didn't post any reasons not to convert, he just asked me to question to myself why I wanted to convert, to make sure it wasn't just because it was the latest whiz-bang neato thing. It isn't the entire reason.

Actually, performance is very important. I'm not currently doing any memory allocation/deallocation inn the critical path or doing any heavy 3D though, so I'm less worried about it being a problem. I also understand 'boxing' and the performance hit that it can take. I'd hope that the .net runtime could compile the code into code that was as fast as the native win32 code.

Thanks Hacy,
Ralph

Share this post


Link to post
Share on other sites
Quote:
Original post by Ralph Trickey
1) potentially better optimizations for the processor the person is running on

In theory, yes. In practice, don't count on it. So far, "traditional" native code generated by C/C++ compilers is still generally (slightly) more efficient than managed code. So if you're looking for performance, you should probably stick with what you have. (Even if the difference is usually small)

Quote:

2) the .Net library adds better support for XML, Graphics, etc.

XML? Well, do you need better support for that?
Graphics? How is that better supported under .NET?

Quote:

3) the potential to port more easily to other platforms like the XBOX 360 once XNA professional comes out.

XBox 360, yes. All other platforms, no. If you go with .NET, you're pretty much limiting your target platforms to PC (primarily Windows, although if you're careful it might end up working with Mono too), and 360. Nothing else.

Quote:
4) XAML, or the equivalent, instead of MFC.

There are plenty of alternatives to MFC in C/C++ as well.

Quote:

5) Marketability of my skills

Huh?

Quote:

6) International Localization is easier.

That might be true. Haven't really looked into that.

Quote:

1) C++/CLI stability - I'm not sure how stable this is, MS already tried and dropped managed C++.
2) .Net stability - It's aready up to 3.5, and there were major changes between 1.1 and 2.0

It's stable. Not sure what makes you think otherwise.

Anyway, given the reasons you listed, I'd say don't bother. If you start a new project, it may be worth considering going .NET, but I'm not sure I see the big advantage in converting your existing one.

Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonbender
Anyway, given the reasons you listed, I'd say don't bother. If you start a new project, it may be worth considering going .NET, but I'm not sure I see the big advantage in converting your existing one.

Thanks a lot for your feedback.


I'll take your word on the optimization. It's not a major driving force anyway.

By graphics, I meant exporting graphics images is a bit easier. .Net has jpeg built into it, I believe. Integrating a library in Win32 adds another third party library. The same is true of XML.

It's a wargame, the potential market is pretty limited. I will never be able to afford the 50K++ entry fee for the other consoles. The only possibilites are XNA Express and XNA Professional if it comes in at a reanable price. Even then, it's pretty unlikely from what I've read about consoles. Either way, it's going to be a major redesign of the UI to work without a keyboard/mouse.

What good libraries for C++ UI work can you recommend? I don't care about/don't want a multi-platform tool. The ones I've tried have been universally horrible. If I'm following their paradigm, they work fine, once I move away, they get in the way. By being multi-platform, the become generic, and lose all the special features of the OS they're being compiled for, and look horrible. I used MFC years ago, and it wasn't that bad. Right now the UI code is all basically roll your own, based upon an older DOS game, I believe.

My day job is a regular programmer. C#/.Net or even c++/.Net are more marketable than C++ from everything I've seen in the US.

Sorry, by stability, I meant that this is a long-term project for me. It seems like the .Net languages, the .Net libraries, and integrating C++ into .Net are all in a state of change. In 5 years, MS may drop support of C++/.Net, or they may change the rules again<g>.

Share this post


Link to post
Share on other sites
I would do it simply because I like to code in C# much more than C. It might also be a good opportunity to improve the design, if perhaps extensibility/maintainability is a concern. Other than that I don't see much reason :).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!