recently ive seen video of a man which showed on how A* works, that is some algorhythm for pathfinding in 2d in games, to show this he made a game in c# (visual studio only), where he could explore the "maze" board in 3d and could see the red square being points to find, and green squares being, unfortunately when i try to google on how to make 3d game without externalities, tutorials are shown which require unity, gamemaker or other. i know unity and worked with it intensively lately, but if i make own game in C# this will be like my own thing instead of just using premade tools. does any of you maybe know how to utilize 3d graphics, texturing and physics in c#, without external engines (opengl maybe?).

Recommended Answers

All 12 Replies

I don't think anyone really does 3d graphics in C#, or at least, I don't think anyone should. As far as I know, Unity is written in C and C++. It's only the high-level bindings that are in C#.

C# being a Microsoft-only language (in practice), I would imagine that the only way to write 3D graphics in C# would be by using Direct3D. Here are some tutorials on that. But again, I think it's a waste of time, i.e., coding at that "low" level with a very "high" level language like C# is assinine.

But again, I think it's a waste of time, i.e., coding at that "low" level with a very "high" level language like C# is assinine.

okay, and ouch. is there any other way to do it myself but without pointlessly wasting time?

ive heard that my next school is going to teach me basics of such, but its over 0.5y, and im already too excited.

If you want to do 3D graphics on your own (without pre-made higher-level libraries), then your starting point should be to learn to use C++ and OpenGL. The NeHe gamedev tutorials are a classic starting point for novices, although it is a bit out-dated now, but still very good for learning the basics, just look for the "Legacy Tutorials", like Lessons 1-5. NeHe tutorials are notorious for being so well written and easy to follow. Here you can also find more up-to-date tutorials (OpenGL 3.3) that are a bit more advanced (but still start from the basics).

When writing 3D graphics code, C++ is inevitable and totally dominant. It is only at the higher-level (game logic) that languages like C#, Java, and Python start to appear or become relevant. Custom scripting languages or interpreted languages like Python tend to appear more in game logic code. And managed languages like C# and Java tend to appear more in in-house support tools development (e.g., GUI applications to help game designers make game levels, models, etc..). But nearly all of the code that really matters in actual 3D games is written in C/C++.

If you really really want to go ahead with C# as your single language, you should look up TAO GL

Without making the COM calls to the Windows API yourself, this is about as good as it gets.

If I were you, pick up an existing game engine (Unity/Unreal) and start there.

If you really really want to go ahead with C# as your single language

Not just C#, I'm willing to learn languages, as long as they're not, how do you say it, overly excessively big.

Member Avatar for iamthwee

A lot of people suggest writing games from scratch, using OpenGL and rendering lines, or detecting collisons.

Total waste of time IMO. Why, because mainly you want to do something practical in 3D, it will takes months and months, especially if you want to write an RPG style game.

Best advice is to learn a 3D program like blender or maya and write your game within this tool. That way texturing is easy, controls are easy, and you will have something useful at the end and (good looking)

I wrote a simple RPG in blender it took me 3 days.

Of course this doesn't include the learning curve to understand the program (blender which took about 5 years)

But that far outweighs the cons of writing something from scratch in opengl. Easily, no doubt about it.

@iamthwee
It all depends on what you want to do. If your interests are in the design of the game, its look and feel, its user experience, and gameplay or storyline, then you should definitely be spending most of your time with the tools of those trades (like Maya / Blender, and off-the-shelf game engines).

But if your interests are in the programming of the various core algorithms in games, like 3D graphics, physics, and A.I., then you need to spend your time doing that. And RikTelner's question seemed to specifically ask about doing the 3D graphics himself.

I've gone through this. I got really into doing 3D graphics for quite some time (when I was much younger). And it's true, as you said, I could spend months and months on projects that never really came close to looking like an actual game. But I learn a lot about that domain, about coding, and about myself and what I loved to do. And you ask "Why" do this? Because you enjoy it. If you don't enjoy that, don't do it. It's that simple.

One time, I said to myself that I should for once make a complete game. So, I did as you describe. I used off-the-shelf stuff and aimed for a simple game concept (2D shooter game). It was so insanely boring to me, just a lot of very trivial work and nothing that presented an interesting challenge. I know that some people love to design games and enjoy that process very much. It's not for me. And I assume that if someone says he doesn't want to use an off-the-shelf game engine, then it means he might be, like me, more interested in the stuff that game engines do under-the-hood.

Engines like Unity give you a relatively easy language to work with, C#, and they put you at a fair distance from the underlying mechanics of the engine so that you can more easily work on designing your game and tweaking the gameplay and user experience and all that. People who enjoy those aspects of making games generally don't want to do too much coding and just want it to be easy and stay out of their way.

The point is, those are two completely different sets of interests, skills, and eventually, professions.

My understanding is that RikTelner is still very much juggling with different things and trying to figure out what he will end up enjoying doing the most. If he wants to try out doing the kinds of things that game engines do under-the-hood, like 3D graphics rendering, then he will have to learn the tools of that trade, such as using C++ and OpenGL, as I recommended.

It all depends on what you want to do. If your interests are in the design of the game, its look and feel, its user experience, and gameplay or storyline, then you should definitely be spending most of your time with the tools of those trades (like Maya / Blender, and off-the-shelf game engines).

Whoa! Don't get me wrong. I want to create a game myself. But I'll eagerly use programs like Blender and ZBrush, if you got mislead by "how to utilize 3d graphics, texturing and physics in c#", by utilizing I meant to tell to place, scale and such, model on this direction, in such manner etc., not just drag it. That's what I meant by "personal utilization of 3D graphics", not drag-n-drop, but just code. And yes Unity provides this, but still Unity is still a pre-made tool.

And I assume that if someone says he doesn't want to use an off-the-shelf game engine, then it means he might be, like me, more interested in the stuff that game engines do under-the-hood.

Exactly! I was to learn and try to create my own mechanisms and triggers, my own personally calculated physics by numbers (I'm not great physicist but I can manage advanced formula's).

If he wants to try out doing the kinds of things that game engines do under-the-hood, like 3D graphics rendering, then he will have to learn the tools of that trade, such as using C++ and OpenGL, as I recommended.

=), going.

Okay, so it became a Python written game on Linux, with PyOpenGL, has anybody experience with it? I'm not about to ask tons of questions, but is there a reason to stay away from it, or it's worth a try? It says: "PyOpenGL is the most common cross platform Python binding to OpenGL and related APIs. The binding is created using the standard ctypes library, and is provided under an extremely liberal BSD-style Open-Source license.", so, as I understand it, it does nothing, but if you include it into your project, it allows you to communicate with all the hardware and drivers you have. By [put here name that is equiv. to classes].
http://pyopengl.sourceforge.net/

!bump

This is still question of wonder to me. After some more Googling I'm ready to go down to Python/C++ with graphics of OpenGL. It seems it would cover majority of computers.

I went back to this topic, and I re-read all the answers. I'm still seeking for a good start. It seems I've miswritten many things or they have been misinterpreted. I'm not eager to fully create models by calling on DirectX/OpenGL API. What I... it's so hard to explain. I want to use external models from Blender, Maya, any-other-3D-program. But I want game work only by what I program, not by any other addition. Calculations, triggers, collisions, physics and everything by myself. To compare it, jQuery is a library written in JavaScript that has many functions included within it, you can just call it, give it parameters and it does it for you as someone else programmed. This is what I DON'T want to do. I want to create my own functions and own parameters, triggers and effects. Still hard to explain.

I'm not dreaming of creating Game of The Year 2015, something really basic, like moving model, or ball (moon) orbitting ball (earth) that orbits ball (sun), that's an example, something that would require 3 external models, and then everything as physics, math, triggers and such all by myself.

I hope you can understand me now.

I think that what you are looking for is a "high-level 3D graphics library". These are generally just taking care of the 3D rendering, and they are not complete game engines (usually don't include game logic, physics, etc.., at least, not in their minimal form). For example, Ogre3D is a nice, open-source 3D rendering library that will take care of most things like loading models, rendering them, and working out some basic visual effects like shaddows and stuff. And you can pretty much insert your own code for anything you want inside or outside of Ogre.

Thank you Mike, Ogre3D is definitely something that would be great for 3D rendering. I'd have look into it REAL soon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.