Quantcast

Jump to content

» «
Photo

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

9 replies to this topic
Lee Everett
  • Lee Everett

    We need to keep you safe Clementine...

  • Members
  • Joined: 21 Jun 2009
  • None

#1

Posted 23 February 2016 - 04:45 AM

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?


K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#2

Posted 23 February 2016 - 11:37 PM

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.

  • Lee Everett likes this

Lee Everett
  • Lee Everett

    We need to keep you safe Clementine...

  • Members
  • Joined: 21 Jun 2009
  • None

#3

Posted 24 February 2016 - 06:50 PM

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.


K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#4

Posted 27 February 2016 - 05:02 AM

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

  • Lee Everett likes this

trip
  • trip

    ~

  • Andolini Mafia Family
  • Joined: 10 Oct 2007
  • United-States
  • Contribution Award [GTAF]
    Contribution Award [Gen Chat]
    Contribution Award [GTAF Census]
    Doggo-Chop Winner 2016

#5

Posted 28 February 2016 - 11:37 PM

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.microso...ror=-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.
  • Lee Everett likes this

bartoc
  • bartoc

    Player Hater

  • Members
  • Joined: 15 Jun 2016
  • United-States

#6

Posted 17 June 2016 - 06:44 PM

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.


Indi
  • Indi

    Don't cross the streams.

  • Andolini Mafia Family
  • Joined: 22 Nov 2008
  • None

#7

Posted 31 August 2016 - 07:13 PM Edited by Indi, 31 August 2016 - 07:37 PM.

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.


K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#8

Posted 01 September 2016 - 04:21 AM

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.

Aftab
  • Aftab

    Da Paki Guy

  • Members
  • Joined: 08 Jul 2016
  • Pakistan

#9

Posted 01 September 2016 - 05:02 AM

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

Indi
  • Indi

    Don't cross the streams.

  • Andolini Mafia Family
  • Joined: 22 Nov 2008
  • None

#10

Posted 01 September 2016 - 03:35 PM Edited by Indi, 01 September 2016 - 03:44 PM.

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.c...t/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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users