Jump to content
  • Advertisement
Sign in to follow this  

Unity [.net] The value of .NET in game programming.

This topic is 4110 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

Over the past few years, I did a lot of research in an attempt to find out what the best technology would be to produce my game. I was looking for a 3D engine to use, and as a result I was also attempting to decide on the language I would use for my game's core code as well. I originally was using Auran Jet (which is now a dead project evidently)... because of the lack of support and updates for that engine, I moved to Ogre. Both of these engines are written in C++... and I was content, at first, to use C++ to develop my game. I was under this really strong impression (beaten in to my head by language fanboys) that "No self-respecting developer would EVER make a game in anything but C++." I think that at the time (circa 2003 I think?), this was fairly true... But here's the problem... I absolutely HATE C++. I hate its antiquated syntax, the long compile times, the hodge-podge method of linking god knows how many dependencies together, and having to update them from god knows how many websites, etc... (ie: stlport, among others), just to get things to compile. It was, to me, like having to learn how to build a car just to get to the point of being able to learn how to drive it. The language barrier, in short, was a real downer for me... but one I was resigned to deal with simply because that was the only real option... ... or so I thought. Sometime in 2005, I found .NET. I was doing a windows maintenance utility for a company I was working for... and after starting on it in VB6 (*shudder*), I found out about VB.NET! (This was about 8 months before VS2005 was released). In a MONTH I rewrote an entire VB6 app in VB.NET, learning the syntax as I went... with no compiler problems, or having to debug linker issues, or having to track down problems with invalid paths in my dependencies, etc... It was amazing! And what I found even more amazing... I learned that VB.NET was fully capable of doing damn near EVERYTHING that C++ is capable of doing... at least in the meaningful things. It truly was like driving a Cadillac! So, I started looking for other engines for my game... I did my research, asked a lot of questions about performance, etc... what I found was this: C++ programmers, in general, are fanboys that don't want to even LOOK at .NET because they simply can't allow their egos to risk having their "leet skillz" become obsolete. They will trash .NET (especially VB.NET) at every opportunity. (On that note... I found it hilarious when I would ask if they liked C#, and they would be like "Oh yeah, that language is fine... but VB.NET sucks!" Then I would point out to them that they're stupid, because C# and VB.NET compile down to the same intermediate language that is compiled by the JIT compiler... made them eat a little crow there...) I found that there ARE C++ programmers out there that are knowledgeable about .NET... amazing how they don't mind it at all, but the C++ programmers that haven't even LOOKED at it, and know nothing about it, make it out to be like it's worthless. I found that .NET is about 95% to 98% of the performance you'd get from a C++ application... and I determined that the minor performance hit was worth it for the reduced headaches and shorter production time. I found that .NET has a lot of premade stuff in it that, while available in C++, you'd have to find the right addon library for it, and add yet another dependency... it's all just THERE for .NET. IT was then that I realized that the .NET library is pretty much an UPGRADE of the old C++ "MFC". So anyway... I am now working with a .NET-based 3D engine (Truevision3D), which is basically a front end API for DirectX... it exposes all of the capabilities of DirectX to VB.NET (and C#, and Delphi, and ASP.NET, etc... even VB6!) SO here I am, with a client app written entirely in VB.NET... with an input system, a GUI system that I wrote FOR Truevision3D, a fully functional networking system (using TCP and UDP), that communicates with a server... again, which is written in VB.NET, using an ODBC connector to do the database work, a multi-socket network listener... even a Windows Form on top of it all to control the game server's settings while it's running! And the damn thing is SCREAMING fast! There is one thing missing from it all... AI. That is the ONLY thing I haven't even bothered to do anything with, because my brother (Dave, aka InnocuousFox) is going to be handling that. Here's the problem, though. Dave seems convinced of the same things those above-mentioned "fanboys" all chirped at me... maybe not specifically with game programming as a whole, but specifically with AI. He seems convinced that AI is best done in C++, and that we'd rather deal with the hassles of interop/CLI/COM, than for him to learn a new language and library. Now, he may very well be right here... maybe AI *SHOULD* be done in C++... But I'd like the opinion of some fellow .NET people here, as well as other AI programmers, or just other game developers in general. Am I being anti-C++ here? Is Dave being anti-.NET? Would Dave benefit in other ways from learning .NET? Should Dave ditch his "C++ only" mindset? Am I not realizing the limitations of .NET, or is Dave not realizing its potential and power? Is it really necessary for game developers to know C++ when they're not doing any low level hardware-layer stuff (like you would do in the actual 3D engine)? Hell... is C++ even NECESSARY for non-engine game programming? If given the choice, would YOU pick .NET over C++ for your game development, specifically for things like game LOGIC (not just AI, but game flow and message processing between systems like input to GUI, network to... anywhere?) Discuss please! [Edited by - EagleEye on March 9, 2007 3:33:00 AM]

Share this post

Link to post
Share on other sites
Am I being anti-C++ here?

No, you are doing the exact same that a C++ fan boy would do by saying, why should you write in another language when you are happy with VB.NET :) Its all personal preference and some people still maintain that C is still the best development language because its fast.

Is Dave being anti-.NET?

No, he may be onto something but it depends on what AI system your using. I think as a rule, if you need it to be really, really fast then you have to consider C/C++.

Would Dave benefit in other ways from learning .NET?

Probably, I love C++, but I would like to learn C# for Tool development and rapid application development

Should Dave ditch his "C++ only" mindset?

Thats up to Dave :)

Am I not realizing the limitations of .NET, or is Dave not realizing its potential and power?

No Dave has a good point about speed in an application and you have a good point about speed of development.

Is it really necessary for game developers to know C++ when they're not doing any low level hardware-layer stuff (like you would do in the actual 3D engine)?

Yes, because the majority of the time I dont do low level hardware work and it still needs to be blisteringly fast or i would be fired :)

Share this post

Link to post
Share on other sites
I've used a LOT of C++ and C# (and a bit of C++/CLI), and I've also coded some sections of high-level AI in C++ for two games so far. As far as AI goes, other than the low-level pathfinding and line probing stuff it's really not that math/processor/memory intensive, and is more about making sure you're just handling the bajillion state/animation transitions between different entities in the correct order.

For everything other than pathfinding, having the ease-of-development from .Net would win versus anything I can think of that C++ might do better (which isn't much).

C++ has some things that .Net languages don't... Macros, insane template tricks, multiple inheritance... But many of those things just completely confuse the hell out of you when something goes wrong. Can you debug some ridiculously gory expanded template mess? Sure. But do you WANT to?

.Net languages (C# in particular) have things that C++ needs ugly templates or hacks for. Delegates? Anonymous delegates? Reflection??! Fully automatic GRAPH deserialization (without more than one line of code tagging serializable classes)?! On the fly compilation (not interpreted!) of code? (the built in .Net Regular Expression system uses this, and trust me, that system is 'blisteringly fast') There are tons of totally different ways to do very very complex tasks using very simple methods in .Net that are still easy to understand and debug.

Perhaps the best part about .Net is that you can mix-and-match your languages. If Dave wants to use C++, he can use C++/CLI (although why bother learning the extra freaky keyword rules when he could (probably) learn C# faster?)

Share this post

Link to post
Share on other sites
Interesting analysis there Nypyren...

To be sure, Dave is VERY smart, and can learn new languages very easily... hell, he has a background in VB (for MS Access)...

I think one of his issues is that a lot of AI stuff out there (like code samples in books and such) are already done in C++, and he would want to just drop pre-done code in to start things out, and work up from there.

I think one of the major disconnects C++ programmers have when it comes to .NET is they think they'll have to rewrite all this old code they have built up over the years that allows them to do the stuff they want to do... when in fact, .NET removes the necessity of that cludged coded entirely... the library truly is cutting-edge.

Share this post

Link to post
Share on other sites
Original post by carllloyd
Am I being anti-C++ here?

No, you are doing the exact same that a C++ fan boy would do by saying, why should you write in another language when you are happy with VB.NET :) Its all personal preference and some people still maintain that C is still the best development language because its fast.

A true fanboy would say "C++ only because .NET sucks" without even knowing anything about .NET. [wink]

I've done C++ in the past for many years and I'll never use it again unless I'm forced to. There's just no good reason for me to use it.

Unless you're doing near-cutting edge stuff, .NET is perfectly capable of doing great games, especially with the advent of XNA. Take a look at the results of the Dream-Build-Play competition when it's over and see if that's not the case.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
I do like .net, but some computers I program for don't have the .net framework.

Share this post

Link to post
Share on other sites
The reason I don't like .NET isn't from a programming standpoint, but rather a user standpoint. On every computer I've seen, .NET applications take much more time to load and are less responsive than native applications. Now, I know there must be some .NET applications that don't fit this stereotype, but I have yet to find one.

I'm sure .NET is much easier and probably more fun than coding in C++, but I think the users are paying the price.

My recommendation would be to use .NET (or java) for in-house tools, and use native code for anything that will be sold or released to a user.

Share this post

Link to post
Share on other sites
I'm just really sad that there isn't a half-decent C# IDE for OS X, and the end-user problems (on Mac) are even more annoying.

Share this post

Link to post
Share on other sites
The reason you see that some .net apps are slower is becuase the people writing them didn't take the time to understand the costs of varies .net calls. It is no different then doing Win32 api calls and not understanding what is being called. There are many Api calls that will drag an app to a stop if you use them too much. If the call is going to take a lot of time then you need to either let the user know this by some method or call it in a non-blocking fasion so the application keeps running.

In my opinion it is not .NET that is at fault but the people using it without understanding what is going on under the surface.


Share this post

Link to post
Share on other sites
I must mention that I have been a little misrepresnted here. ("You can indict a ham sandwich.") I AM a VB guy... years worth of VBA while doing Access/SQL databases. I am only recently come to C++ in fact which I learned specifically for game development. The reason I did that, in fact, was that I found that 90% of the game development world was written in C++. Because of that, I found that if I wanted to use anyone else's code to plug into my own game projects (e.g. downloads or AI code from the "Gems" books or "AI Wisdom"), then my project needed to be in C++. I am not inherently biased against .NET or VB - the existing base of game code is. I am not convinced that AI is best done in C++... I'm convinced that all the stuff I want/need to use already IS in C++.

To specifically answer the questions he posed:

But I'd like the opinion of some fellow .NET people here, as well as other AI programmers, or just other game developers in general.

First note... you actually think you will get an unbiased answer in the .net forum? People who don't use .net for whatever reason don't even enter this forum. Try asking the question in the "Game Programming" forum if you want unbiased answers. (Note: if you misrepresent me again the way you did here, I'll simply drive over and kick your ass.)

Am I being anti-C++ here?
No more than Mac or Linux people believe in their products over the popular alternative.

Is Dave being anti-.NET?
The way you present it? Sure. But, as mentioned, I'm being pragmatic. I simply don't want to rewrite a ton of already written code that I like to use simply because of the preference of one developer that I may or may not work for - for free.

Would Dave benefit in other ways from learning .NET?
Sure. It would make me more employable outside the game world. Same thing for Java and a lot of other languages. Hell, in 1999, it would have been nice to know COBOL to help with the Y2K bullshit. I actually plan on getting into .NET at some point... but probably not for AI or game programming simply because it is not yet convenient.

Should Dave ditch his "C++ only" mindset?
...which I don't really have. However, I have a bookshelf full of articles and code that are... oddly enough... "C++ only".

Am I not realizing the limitations of .NET, or is Dave not realizing its potential and power?
I think you are not realizing the scarcity of .NET... and simply the fact that I don't want to burn calories on another language at the moment.

Is it really necessary for game developers to know C++ when they're not doing any low level hardware-layer stuff (like you would do in the actual 3D engine)?
If you want to get a job working for or with someone other than yourself, you damn well better know C++.

Hell... is C++ even NECESSARY for non-engine game programming?
Define "necessary"... you can actually write entire games in Python if you want. And with the pre-written engines and SDKs out there, you don't need to do a lot on your own to write an actual working game.

I can't believe that I actually had to deal with this...

edit: added other references from other forums on GameDev

One large one and others referenced in that one.

1) Professional Games Made In C#?
2) Java for game development?
3) Java----C/C++
4) c++ or c#
5) Question about Java Vs. C# Vs. C++
6) Java Games?
7) Java is fast?
8) Secondary Language:VB or Java?
9) What makes C++ so powerful?
10) C# games and cheating...
11) Is C# good enough for system utility programming
12) MC++ vs. C#
13) Which language is best for a 3d Games Engine?
14) C# vs C++ as a choice for development
15) Is Java the Future?
16) why C# and not Java?
17) What do you think of the D language?
18) my c++ d c# benchmark!
19) The Definitive Guide to Language Selection
20) Sharp Java
21) C++ or C#?

[Edited by - InnocuousFox on March 9, 2007 10:24:15 AM]

Share this post

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

  • Advertisement
  • Advertisement
  • Popular Tags

  • Similar Content

    • By Alexander_Vovk
      Hello Guys!
      Please share your experience, where is it better to find sales manager  specialists for indie team of 6 + people(remotely)?
      Maybe someone has a good experience of cooperation with finding projects through sale managers(USA and Canada)?
      Thank you
      Best Regards
      Alex Vovk
      Co-Founder of Sixteen Squares
    • By RoKabium Games
      Been a bit quiet recently, but we've been busy bug fixing and tweaking things... Now we have lots more 'Particle effects' in the game, specifically here the Flamethrower and Enemy attacks!
    • By JoshuaFraser
      Hi and thanks for reading, I have an issue with this reactive crosshair script, everything works fine until I start changing the offset. Give the script a go and you will see what I mean, when I do SetOffset(0f); it doesnt always set back to the origional state, if anyone can spot a fix I'd be super appreciative!
      using System.Collections; using System.Collections.Generic; using UnityEngine; public class ReactiveCrosshair : MonoBehaviour { [SerializeField] GameObject c_limb_prefab; private float center_offset = 0f; private float current_offset = 0f; private float max_offset = .5f; private int number_of_limbs = 4; private float limb_length = .05f; private float limb_width = .005f; private List<GameObject> c_limbs = new List<GameObject>(); public void SetupCrosshair(){ for (int i = 0; i < number_of_limbs; i++) { GameObject line_go = (GameObject)Instantiate (c_limb_prefab); line_go.transform.SetParent (this.transform); Vector3 limb_pos = new Vector3 (0f,0f,0f); //line_go.transform.position = limb_pos; line_go.transform.localPosition = limb_pos; LineRenderer line = line_go.GetComponent<LineRenderer>(); line.startWidth = limb_width; line.positionCount = 2; line.SetPosition (0, line_go.transform.localPosition + new Vector3(center_offset, 0f, 0f)); line.SetPosition (1, line_go.transform.localPosition + new Vector3(center_offset + limb_length, 0f, 0f)); line.useWorldSpace = false; c_limbs.Add(line_go.gameObject); } if (c_limbs != null) { OrientLimbs (); SetOffset (0f); } } public void OrientLimbs(){ for (int i = 0; i < c_limbs.Count; i++) { float rotation_step = 360f / (float)c_limbs.Count; c_limbs [i].transform.RotateAround (c_limbs[i].transform.position, c_limbs[i].transform.forward, 90f + (rotation_step * (float)i)); } } public void SetOffset(float _current_spread){ float offset = Mathf.Lerp (0f, max_offset, _current_spread); for (int i = 0; i < number_of_limbs; i++) { if (offset > current_offset) { Vector3 pos = c_limbs [i].transform.position + (c_limbs [i].transform.TransformDirection (Vector3.right) * offset); c_limbs [i].transform.position = pos; } if (offset < current_offset) { Vector3 pos = c_limbs [i].transform.position - (c_limbs [i].transform.TransformDirection (Vector3.right) * offset); c_limbs [i].transform.position = pos; } } Debug.Log ("SetOffset() offset: " + offset.ToString () + " _current_spread: " + _current_spread.ToString() + " localPos: " + c_limbs[1].transform.localPosition); current_offset = offset; } }  
    • By Erik Nivala
      So, as the title says i am trying to figure out a good way sync all that information with other players in Unity. My problem is that i can't come up with a good solution since i am used to creating classes for everything e.g. attachments are its own class and then the weapon would save a reference to that attachment. But since you can't send custom classes over [Command] & [ClientRPC] i am a little stuck. A solution for this would be giving each attachment for a slot a unique ID and then passing the ID to other player but i feel like that is very error prone if other ppl add a new attachment or the IDs get mixed up.
      Is there a "standard" way that this is usually done that i am missing?
      I am fairly new to programming so any help is appreciated!
    • By MintyLyton
      I'm looking for any team / people that need a programmer for their project. I'm looking to expand my portfolio which you can see Here. I'm more experienced with Unity but I can spend the time to learn new Engines if that's your preference. I have worked on Unreal Engine 4 before but I might take some time to re-learn it, if the project requires it. Feel free to DM here or use the contact info on my website. 
    • By ethancodes
      I'm working on a system for my game that will allow the player to stack pick ups in a queue. As one pick up expires, the next automatically activates. I'm having an issue though where if I pick up the first one, it activates fine, but if i pick up a second directly after it, it overrides the first one, activates the second one, and then once it has run it's course, everything goes back to normal gameplay, no first pick up. I'm not sure why this is happening. Hopefully someone can spot what I'm doing wrong in my code.
      Here is the code for the pick up manager:
      // Update is called once per frame void Update () { if (pickUpQueue.Count != 0 && !pickUpActive) { pickUpActive = true; pickUpQueue[0].ActivatePickUp(); } DeactivatePickUp(); } void DeactivatePickUp () { if (pickUpQueue.Count != 0 && pickUpActive) { Destroy (pickUpQueue [0]); pickUpQueue.RemoveAt (0); pickUpActive = false; } } And here is the PickUp:
      public override void ActivatePickUp () { ball.GetComponent<Ball>().Speed = 2.0f; //increase ball speed... ball.GetComponent<Ball>().StartCoroutine(timer); //...set time that power up is active }  
      There is also a Base Pick Up:
      public void OnCollisionEnter2D (Collision2D collision) { Vector2 tweak = new Vector2 (Random.Range(0f, 0.2f),Random.Range(0f, 0.2f)); this.gameObject.GetComponent<Rigidbody2D>().velocity += tweak; //if the pickup makes contact with the paddle or ball.... if (collision.gameObject.tag == "Paddle" || collision.gameObject.tag == "Ball") { GameObject.FindObjectOfType<GameManager>().GetComponent<PickUpManager>().pickUpQueue.Add(this); Destroy(gameObject); //...and finally destroy power up object } } As a side note, I am trying to find a solution to this that will work for all of my pickups. Some pickups are ammo based, some are timed. 
    • By D34DPOOL
      Edit Your Profile D34DPOOL 0 Threads 0 Updates 0 Messages Network Mod DB GameFront Sign Out Add jobEdit jobDeleteC# Programmer for a Unity FPS at Anywhere   Programmers located Anywhere.
      Posted by D34DPOOL on May 20th, 2018
      Hello, my name is Mason, and I've been working on a Quake style arena shooter about destroying boxes on and off for about a year now. I have a proof of concept with all of the basic features, but as an artist with little programming skill I've reached the end of my abilities as a programmer haha. I need someone to help fix bugs, optomize code, and to implent new features into the game. As a programmer you will have creative freedom to suggest new features and modes to add into the game if you choose to, I'm usually very open to suggestions :).
      What is required:
      Skill using C#
      Experience with Unity
      Experience using UNET (since it is a multiplayer game), or the effort and ability to learn it
      Since the game currently has no funding, we can split whatever revenue the game makes in the future. However if you would perfer I can create 2D and/or 3D assets for whatever you need in return for your time and work.
      It's a very open and chill enviornment, where you'll have relative creative freedom. I hope you are interested in joining the team, and have a good day!
      To apply email me at mangemason@yahoo.com
    • By davejones
      Is there a way to automatically change the start position of an animation? I have a bunch of animations set up on 3D models in unity. The issue is that I need to move the 3D models, however when I do so the animation start positions are not updated and I have to do it manually.

      Changing the transform of key frames is time consuming with the amount of animations I have, so I was wondering if there was a way to do it automatically?
    • By MoreLion
      hey all! We are looking for members for our Unity horror game! 
      Here’s the story:
      After a deadly virus plunges the world into chaos killing 85% of the human population there are now what they call “zones” these zones are watched very closely by the surviving government, people are checked every day for the virus, even if you touch the spit or any human waste or fluids of the victim who is infected, you will die. But one day, people in the west zone start to go missing, 1 woman goes outside the walls to uncover the mystery, is there more to the virus than meets the eye?, That is where your story starts.
      This game is not a long development game, I have loads other game ideas,
      I will also allow you to have a bit of creative freedom if you wish to add or share a idea!
      And no, it’s not a zombie game lol I feel like zombie games are too generic, in this game you will encounter terrifying beasts!
      There is some concept art one of our concept artists have made
      If interested email liondude12@gmail.com
    • By Canadian Map Makers
      GOVERNOR is a modernized version of the highly popular series of “Caesar” games. Our small team has already developed maps, written specifications, acquired music and performed the historical research needed to create a good base for the programming part of the project.

      Our ultimate goal is to create a world class multi-level strategic city building game, but to start with we would like to create some of the simpler modules to demonstrate proof of concept and graphical elegance.


      We would like programmers and graphical artists to come onboard to (initially) create:

      A module where Province wide infrastructure can be built on an interactive 3D map of one of the ancient Roman Provinces.
      A module where city infrastructure can be built on a real 3D interactive landscape.
      For both parts, geographically and historically accurate base maps will be prepared by our team cartographer. Graphics development will be using Blender. The game engine will be Unity.


      More information, and examples of the work carried out so far can be found at http://playgovernor.com/ (most of the interesting content is under the Encyclopedia tab).


      This project represents a good opportunity for upcoming programmers and 3D modeling artists to develop something for their portfolios in a relatively short time span, working closely with one of Canada’s leading cartographers. There is also the possibility of being involved in this project to the point of a finished game and commercial success! Above all, this is a fun project to work on.


      Best regards,

      Steve Chapman (Canadian Map Makers)

  • Advertisement
  • Popular Now

  • Forum Statistics

    • Total Topics
    • Total Posts

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!