Is C# fast enough for games
Will a game written in C# 开发者_如何学JAVAhave any speed issues after long periods of play, like for 24 hours at a time? I'm specifically talking about a 2D RPG similar to old Final Fantasy or Dragon Quest games. I know that languages like Python will slow down too much, curious how C# would stand.
edit: programs I write are a lot like a termite-infested tree :)
@jimmy - thats the entire point of this. I'm working on a small FF clone to improve my coding
Yes, it is. Take a look at XNA. There are already some games written in C#.
I'd take a look at this Channel 9 video posted years ago from Eric Lippert
Eric Lippert - Have you noticed a performance hit in .NET?
It's a great watch if you're wondering about comparative performance. Computer hardware has advanced a great deal more since then, but the concept hasn't changed, C#/.Net can have excellent performance if you're using it correctly.
If code slows over the course of its execution -- and by that I mean doing the same thing takes longer -- it's a sign that memory is not being managed correctly. I don't know what you mean about Python slowing down, but I don't have much experience with it. It's possible that some game or graphics libraries don't handle memory correctly, which could cause performance to suffer (and eventually crash). But closing the app and restarting would fix any issue like that -- and surely you'd have a save feature if a user was to play for 24 hours?
To answer your question, correctly written C# will not slow down if you play the same game for too long. (But neither would correctly written Python code, or any other language).
The high-level game logic could definitely be written in Python. In fact it's quite common to use a "slow" scripting language to allow more freedom to the game designer. In practice the lowest levels of the game (like the hardware interface / drivers) are written in C. Everything else in between is open for debate depending on what type of performance you require and what type of hardware it will be running on.
The XNA Game kit for XBox 360 uses C#...
The .NET rewrite of Quake:
http://www.codeproject.com/KB/mcpp/quake2.aspx
精彩评论