Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (92,951 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

Lee Everett

C# or C++ for 2D Game Environment?

Recommended Posts

Lee Everett

Would it be more convenient to use C# or C++ for a 2D game that has MYSQL implemented?

 

Is it better to use something such as Visual Studios/Eclipse or something like Unity? What are the advantages and disadvantages of both?

Share this post


Link to post
Share on other sites
K^2

Ok, you are mixing a whole bunch of questions together.

 

Unity is a game engine. If you want to make a game, 2D or 3D, and you don't have experience with writing your own engine, yes, go with Unity. In that case, you are locked into C#.

 

VS and Eclipse are IDEs. Visual Studio also comes with its own compilers for C++ and C#. If you want to make a game with Visual Studio from scratch, you'll have to write your own game engine. See above.

 

 

If you are planning to write your own game engine, you really shouldn't have a question in your mind about C++ vs C#. They are completely different languages with very different strengths and weaknesses. In general, you loose too much performance writing in pure C# to be worth it. But it's very easy to write a hybrid engine using C# with either C or C++ in performance-critical parts of your code. This is particularly useful for a simple game produced by a small team, as it can save a ton of time on debugging if done right. And so long as only top level code runs in C#, the performance impact is negligible.

 

There are games out there written in pure C# simply because they don't need exceptional performance. Usually, however, they run through something like XNA that takes on some of the heavy lifting with graphics.

 

 

But again, based on the fact that you're asking this question, you should probably just go with Unity and C#. You'll save yourself a lot of tears.

Share this post


Link to post
Share on other sites
Lee Everett

Can you recommend any good books in C# for game development?

 

 

Ok, you are mixing a whole bunch of questions together.

 

Unity is a game engine. If you want to make a game, 2D or 3D, and you don't have experience with writing your own engine, yes, go with Unity. In that case, you are locked into C#.

 

VS and Eclipse are IDEs. Visual Studio also comes with its own compilers for C++ and C#. If you want to make a game with Visual Studio from scratch, you'll have to write your own game engine. See above.

 

 

If you are planning to write your own game engine, you really shouldn't have a question in your mind about C++ vs C#. They are completely different languages with very different strengths and weaknesses. In general, you loose too much performance writing in pure C# to be worth it. But it's very easy to write a hybrid engine using C# with either C or C++ in performance-critical parts of your code. This is particularly useful for a simple game produced by a small team, as it can save a ton of time on debugging if done right. And so long as only top level code runs in C#, the performance impact is negligible.

 

There are games out there written in pure C# simply because they don't need exceptional performance. Usually, however, they run through something like XNA that takes on some of the heavy lifting with graphics.

 

 

But again, based on the fact that you're asking this question, you should probably just go with Unity and C#. You'll save yourself a lot of tears.

Share this post


Link to post
Share on other sites
K^2

No, sorry. I would ask around on Unity forums.

Share this post


Link to post
Share on other sites
trip

Would it be more convenient to use C# or C++ for a 2D game that has MYSQL implemented?

 

Is it better to use something such as Visual Studios/Eclipse or something like Unity? What are the advantages and disadvantages of both?

https://msdn.microsoft.com/en-us/library/bb203894.aspx?f=255&MSPPError=-2147217396

 

Getting started in XNA development. XNA is the set of libraries MS put out to be used to make Xbox games(as well as phone and other win/MS based apps). It is best to use C# when doing XNA projects.

 

The site even has easy to follow tutorials for doing your first 2D/3D game.

Share this post


Link to post
Share on other sites
bartoc

c#, or even something like Lua (love2D is quite good). C++ is difficult to learn, and tends to sidetrack people into thinking more about the language than the actual game. What's this about MYSQL? pretty much all languages can communicate with any database. If you are looking for a database for storing userdata and stuff I'd encourage you to start simpler, and program a few simple single player or hotseat multiplayer games first. If you are looking to use it to store data locally (like save files or whatever) I'd encourage you to checkout sqlite.

Share this post


Link to post
Share on other sites
Indi

I will also add another point to K^2's post. If you want to make your own engine you should go with C++ if you want to efficiently optimise your memory allocation. Pointers and memory addresses are a big thing in C++ and your applications run directly on the machine and not a virtual machine -- that's why game companies still use it because if you really want to optimise your engine so that it allocates a certain amount of memory and deallocates a certain amount of memory, then you should go with C++.

 

These days though, C++ is not that needed -- you have a lot of memory now and it isn't needed to dive deep into low-level memory allocation (though for massive games, I'm talking really big games it would be needed). A language like Java has a garbage collector that allocates and deallocates memory for you. Same as C#.

 

The way I've always liked to think about it (and this is an opinion) is that C# is object orientated with garbage collection, C++ is object orientated with manual memory allocation and if anyone says I'm wrong please correct me.

 

@trip: XNA is now outdated (though I still use it sometimes for kicks). MonoGame is now XNA's new framework.

 

NOTE: I've never made my own engine because it is a tirelessly fruitful task -- especially on your own. Graphics programming has got to be one of the most challenging aspects of programming. Though this is not to put you off, I'm just saying that you really need to push through to make complete a game engine.

 

If you want to make a game OP, just get a game engine like Unreal or Unity -- has everything you need to make a game (of course, you can't do everything because it isn't your own engine, but you can do most things). I find that's where the games industry is going now anyway, no need to start engines from scratch anymore, only the big companies do that because they have the time, money and man-power. Visual Studio and Eclipse are IDEs; they are programs that have everything that a programmer needs (a text editor, a compiler, a debugger and other sh*t).

 

Also Lee, don't bother with books. Just use your best friends: Google, the debugger and YouTube.

Edited by Indi

Share this post


Link to post
Share on other sites
K^2

Memory isn't the only problem with C# and Java. If you're writing anything that requires heavy CPU use, you'll run into performance issues. Both of these are byte-interpreted languages running on a VM. (CRT and JVM respectively.) Both rely heavily on JIT to try and make up some of that performance difference, but Java is designed to be very portable, so there is only so much JIT can do. C# is much better in that regard, but you still aren't going to write a good, modern physics or rendering engine in C#. You'll just bottleneck on CPU really hard.

 

So pure C# or Java are only good for relatively light games. Keeping in mind that on the heavy side of "light" in this case we have games like Minecraft running on Java and Space Engineers running on C#. So it's entirely possible it's all you'll ever need. But it's important to understand why sometimes C/C++ are the only options.

Share this post


Link to post
Share on other sites
Aftab

I don't know how to do programming in any language. Can you tell me where can I learn it.

Share this post


Link to post
Share on other sites
Indi

I don't know how to do programming in any language. Can you tell me where can I learn it.

YouTube videos and website articles. That's how I started -- I also bought this book starting out:

https://www.amazon.co.uk/Beginning-Programming-Premier-Press-Development/dp/1592002056

 

I still have it. I also have had many mentors and teachers along the way... I like to surround myself around people that know more about me so I can learn from their experiences.

 

Check out a dude called "The New Boston" on YouTube also.

Edited by Indi

Share this post


Link to post
Share on other sites

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

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.