none
is it possible to to create a 2d game engine RRS feed

  • Question

  • hi

    is there a way to build a 2d graphic engine library in c# that can be used in any c# windows application like winforms/wpf,

    and is openGL compatible or we should use Directx instead,

    Thanks in advance. 

    Monday, February 24, 2020 7:45 PM

Answers

  • Fast and good is C++ and DirectX. 

    Cheap and good is C and OpenGL. 

    hi Andrew,

    i have two questions;

    1) why it's not cpp and OpenGL?

    2) <the main question> what if i go with Cpp and DirectX (or c and OpenGL), would it be work with my winForms/wpf  app somehow, (as a engine.dll for example).


    1)  No reason.  It was just an example.  You can program in C/++ (meaning C or C++) to gain access to DirectX and OpenGL libraries.  You'll get fast performance and good graphics.  C is cheaper because it's easier to work with and doesn't have nearly so many compile-time dependencies (which results in smaller compiled files).

    2)  You get all the slowness and tendency to crash unrecoverably if you pump too many FPS of DotNET backended by all the fastness and tendency to push high FPS of low level languages and real GPU-APIs. This would be roughly equivalent to putting a Ferrari engine and drivetrain into a buckboard wagon.


    • Edited by Andrew B. Painter Wednesday, February 26, 2020 10:11 PM
    • Marked as answer by essamce Wednesday, February 26, 2020 10:21 PM
    Wednesday, February 26, 2020 10:10 PM

All replies

  • Yes, there have been a lot of games written in several languages pure DotNET.

    If you're going DotNET then you should forget about OpenGL and DirectX altogether.  Just go with lightweight animation logic and 2D sprite sheets.

    Monday, February 24, 2020 7:54 PM
  • Direct2D works very well in .NET

    I had posted a sample with a simple animation in this thread by using this sprite sheet

    or VB samples like VB Pixel Perfect Collision

    Monday, February 24, 2020 8:09 PM
  • hi Andrew, thanks for reply,

    could you please give some details, without directx and opengl what gpu api can be used, and i want my engine to be fast as any directx/opengl engines. 

    Tuesday, February 25, 2020 7:59 AM
  • Hi essamce,

    Thank you for posting here.

    I suggest you take a look at MonoGame, it is like a framework that can help you develop your own engine, and it is open source and cross-platform.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 25, 2020 8:27 AM
  • could you please give some details, without directx and opengl what gpu api can be used, and i want my engine to be fast as any directx/opengl engines. 

    Test the Direct2D samples posted above : animations are very smooth,  although they are not in C++
    Tuesday, February 25, 2020 8:41 AM
  • hi Andrew, thanks for reply,

    could you please give some details, without directx and opengl what gpu api can be used, and i want my engine to be fast as any directx/opengl engines. 

    Hey look, dude:  You can pick 2 (TWO) of "Fast, Cheap, and Good."  You can't have 3.  You can have 2.  Fast and good is C++ and DirectX.  Cheap and good is C and OpenGL.  Fast and cheap is DotNET and System.Drawing.Drawing2D.  There is no legit CPU or APU or even OS-level graphics engine accessible by DotNET.
    Tuesday, February 25, 2020 3:02 PM
  • Fast and good is C++ and DirectX. 

    Cheap and good is C and OpenGL. 

    hi Andrew,

    i have two questions;

    1) why it's not cpp and OpenGL?

    2) <the main question> what if i go with Cpp and DirectX (or c and OpenGL), would it be work with my winForms/wpf  app somehow, (as a engine.dll for example).


    • Edited by essamce Wednesday, February 26, 2020 8:27 PM
    Wednesday, February 26, 2020 8:26 PM
  • Fast and good is C++ and DirectX. 

    Cheap and good is C and OpenGL. 

    hi Andrew,

    i have two questions;

    1) why it's not cpp and OpenGL?

    2) <the main question> what if i go with Cpp and DirectX (or c and OpenGL), would it be work with my winForms/wpf  app somehow, (as a engine.dll for example).


    1)  No reason.  It was just an example.  You can program in C/++ (meaning C or C++) to gain access to DirectX and OpenGL libraries.  You'll get fast performance and good graphics.  C is cheaper because it's easier to work with and doesn't have nearly so many compile-time dependencies (which results in smaller compiled files).

    2)  You get all the slowness and tendency to crash unrecoverably if you pump too many FPS of DotNET backended by all the fastness and tendency to push high FPS of low level languages and real GPU-APIs. This would be roughly equivalent to putting a Ferrari engine and drivetrain into a buckboard wagon.


    • Edited by Andrew B. Painter Wednesday, February 26, 2020 10:11 PM
    • Marked as answer by essamce Wednesday, February 26, 2020 10:21 PM
    Wednesday, February 26, 2020 10:10 PM