# Beginner programmer looking for advice/introduction

This topic is 2161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey, I've been aspiring to be a game developer probably since I was around 10. I'm currently 17, though I'll be 18 in under a month. Around the age of 12, I began delving into Game Maker, initially with the drag and drop block system, but later turning to the GML language. After a few years of using it, I got to a point where I could do practically whatever I wanted with the language (with the exception of networking and 3D, mostly because I never really bothered).

However, when I decided it was time to move on to a more serious language, I was baffled by the amount of choices, but eventually decided on C++. (This was probably around the age of 14, thought I'm hazy with timing). I've since played with a few different languages, but only just scratched the surface. The only one I've gotten anywhere with has been C++, first with SDL and more recently with SFML, which I find much easier to use.

Anyway, I've been slacking, and I've barely touched any code for the past year or so, and I'm now trying to hop back into it, as I hope to persue game development as a career. (Or at least a hobby if worst comes to worst). And so I've been working with C++ again, I'm not sure if it's age, or just looking at it more seriously, but things are making a lot more sense to me. But there's one thing that's been troubling me, and I'd like to get some input. When looking into anything on this topic, the majority of people put C# above C++ in terms of game development, because it's simpler, and compiles faster, and is worth the slight performance reduction, for the development speed increase.

Now here's the thing, I want to write my apps to be cross-platform, and C# with XDA doesn't allow me to do that, besides, I'm a Linux (Debian) user, and cannot use the .NET framework. I've played a little with Mono, however there is very little in the way of tutorials on libraries like SFML or SDL with Mono. According to more recent benchmarks, Mono is up to par with .NET in terms of performance in most situations, and even beats it in some, however beginner tutorials are not really available. And I'm not sure just how compatible it is with .NET C# code, I don't really want to follow a C# tutorial and find out I'm doing everything wrong. (I very well could be screwing everything up in this paragraph, because I really don't know much about C# and Mono at this point).

So anyway, my question is, is it worth using C# with Mono over C++? And if so, what is a comparable library to SFML that I can use with C#?

Thanks for the help guys!

##### Share on other sites
Axiom3D is an open-source, cross-platform 3D API for C#, so that might be one solution for you. It's based on the OGRE rendering engine (actually I think it's quite direct port), so there should be lots of tutorials available.

##### Share on other sites
A 2D API would be nice. I'm not ready to jump right into the third dimension at this point, but thanks!

##### Share on other sites

A 2D API would be nice. I'm not ready to jump right into the third dimension at this point, but thanks!

Don't worry, you can do 2D stuff with it as well. Actually, it's usually much more efficient to make 2D stuff with 3D engine by using orthographic projections.

##### Share on other sites
Do you really need to use Linux? Game development is mostly done on Windows.

Wouldn't it be easier to set up a Windows box (it could even run on a VM or dual boot) just for your game development needs?

##### Share on other sites
alnite, if one intends to write fully cross platform applications, wouldn't one want to use the platforms in which they wish to develop for? I don't *need* to use Linux. I use Linux by choice, because it's my preferred system. Your comment is really irrelevant to my question.

And thankyou Manabreak, I appreciate the tip. I'll check out Axiom3D.

Another question I have; is .NET C# code fully compatible with Mono C# code. If I did a C# tutorial, would it work for Mono C#? (With the exception of most libraries, which I assume don't work under Mono.)

##### Share on other sites
Most of .NET works in mono (see http://www.mono-proj...m/Compatibility).

The main issue is when stuff outside of .NET is used:
-Sometimes code will call some of the Windows stuff (plain C functions or COM objects, usually if .NET doesnt expose the specfic OS functionality). Naturally Linux doesnt have these, so the code will fail. However Linux is likly to have equivlant API's, so I guess you can detect OS at runtime to use the correct code.
-Projects which are partially made up from native code (e.g. graphics). Some of these may have Linux builds, which you may be able to use esaily. If the .NET wrapper used C++/CLI to provide the native<->.NET transitions however I believe you are out of luck (http://www.mono-project.com/CPlusPlus)

Of course this can be avoided with projects written with .NET and Mono in mind.

##### Share on other sites
Howbout using Java? I know the word Java seems like unholy to most people, especially when it comes to game programming, but with modern computers and opengl being upgraded a lot since 2.0 (another unholy word), etc.... I think Java could be one possible solution for crossplatform game programming. There is even pretty good free game engine, that holds very little restrictions to my knowledge in the terms of usage, called jME3: http://jmonkeyengine.org/ .

##### Share on other sites
Thanks for all the advice guys. I think I'm going to keep going ahead with C++ and SFML for the time being, and likely do some Java in the future (to get a head start, because my computer science course begins with Java). If things don't go well with C++, maybe I'll fall back to Mono/C#, and come back when I've got a better feel of the fundamentals, but for right now, C++ feels good.

So I suppose my final question would be, where could I go to get advice on small code problems? Some things just seem too trivial to make a dedicated thread about them here. Is there a section here for simple code troubles?

 #include <SFML/Graphics.hpp> #include <iostream> sf::RenderWindow App; using namespace std; // Define Classes class player{ private: bool visible; int x; int y; int height; int width; public: player(){ x = 30; y = 70; width = 30; height = 30; } void Draw(){ App.Draw( sf::Shape::Rectangle( x, y, x+width, y+height, sf::Color(180, 180, 180) ) ); } void SetPosition(int newx, int newy) { x = newx; y = newy; } }; int main() { // Create Objects player obj_player; // Create the game window. sf::RenderWindow App( sf::VideoMode(640, 480, 32), "dropBlox" ); // Start game loop. while ( App.IsOpened() ) { // Process Events. sf::Event Event; while (App.GetEvent(Event)) { // Close the game when exit button pressed, if (Event.Type == sf::Event::Closed) { App.Close(); } } // Clear Screen App.Clear(); // Draw Objects obj_player.Draw(); App.Draw( sf::Shape::Rectangle( 90, 90, 120, 120, sf::Color( 200, 200, 200 ) ) ); // Update Screen App.Display(); } } 

My issue right now, is that envoking obj_player's Draw function, doesn't draw anything on the screen, whereas writing the same thing directly does.

##### Share on other sites

alnite, if one intends to write fully cross platform applications.... (snip)

Stop right now.

Writing a fully cross-platform app is difficult; incredibly difficult. This should be the least of your concerns at the level you're at now. You'll have a much easier time of it if you focus on a single platform and get the best you can done with that. Get that under your belt 3 or 4 times and you'll be ready to start looking at fully cross-platform; you have enough to be getting on with learning without throwing extra complexities into the mix.

##### Share on other sites
I want to write applications for Linux, Windows, Mac, Android, and iOS. For the time being, I'm writing applications for my platform of choice, Linux, because that's what I run, and that's what I'm testing on. What I'm saying is that I'm not going to install Windows, just so that I can write applications for a platform I'm not going to use, using tools I'm not going to use.

##### Share on other sites
cplusplus.com has the best forums for c++ code issues. They are usually pretty quick to answer you too. Correct me if I am wrong, but I think that they are trying to say that there is no easy way to make things cross-platform for a beginner. There is no perfect solution which is why people either just create for one platform or code each one separately. You will still need a mac and windows os to test run your stuff though (as painful as it may be). There are some engines that will do all the work for you, but you need to have some big  to get them.

##### Share on other sites
This post isn't exactly related to the questions asked, but for the OP, I highly recommend that you find yourself some sort of naming convention for the C++ and you should do it as fast as possible. The non-capital class-name makes the code a lot harder to read, and so on. It saves some possible errors in the future aswell, if you name the class variables with some naming convention. So you wont have the problem of having; this->height = height + 2, and later on you use the wrong variable on your calculations. Lot of people use underscore in front of variable names, when its inside a class.

##### Share on other sites
Thanks for the tip Randi. I am however, willing to put in the extra effort to create cross-platform games. At this point, it's as easy as recompiling for the other system, though in the future I'm sure it will require os checks, and running specific code for each platform, when os-dependant code is required.

And I appreciate the advice Hiiri, I'm working on a naming convention, but it's difficult to do so when I don't fully understand the language. In Game Maker I used obj_* for objects, and spr_* for sprites. I should probably do something similar in C++, cl_* for classes maybe.

And I found the issue with my code in post #9, thanks to Tank on the SFML IRC. As it turns out the class player is outside of the main scope, so when it looks for "App", it finds the variable that was initialized in line 3, but never used.

##### Share on other sites
Awesome! Make sure to keep us up-to-date on anything that you build!

##### Share on other sites
I'm loving C++ so far in that it's complex, but logical. With other languages I memorized functions, but with C++, it's not just memory, each time I practice writing code in it, I get a better understanding of what I'm doing.

Last night I spent the entire night playing with classes, trying to figure out inheritance of subclasses, and such. I wanted to make it so that every object was a subclass to a superclass, and is given an id upon creation. (So that multiple objects of a single class could be distinguished.) I'm sure there are several ways to do this. I'm bound to figure something out sooner or later