Is there hope for web developer to learn game programming?

Started by
8 comments, last by slynk 13 years, 2 months ago
Hello GameDev, nice to meet you.

I am a web developer with 7 years of experience in PHP. Along with that I also learned a lot of stuff that every web developer stumbles upon sooner or later: MySQL, JavaScript (including various frameworks like Mootools and jQuery), CSS, HTML, etc.

I never considered myself a hardcore programmer material as I never went to programming school or anything similar. Everything I know I picked up from various resources around the internet. Still, somehow I got really deep into it and successfully run a web company for 6 years now.

Lately, game programming is coming to my mind more and more. I read tons of articles about it but got mostly scared by them. Still, I want to give it a shot since I remember PHP scared the hell out of me at first, too.

I picked up that the most used language in game programming is C++, correct me if I'm wrong.

Is there any hope for me in this area? Do I start with C++? Where? Any other recommendations?

Thank you.
Advertisement

Is there any hope for me in this area?



Ofcourse there is, as long as your are motivated and passionate about game programming. Since you already know Javascript, I suggest you start with create simple HTML5 Canvas based games first. This will reduce your barrier of entry and will give you a better idea of how games are done (the main loop, managing objects etc)

Then you can explore C++


An example here
http://www.felinesof...ml5-and-canvas/
Do I start with C++?


No no no. Stick with your strengths. You say you already know javascript right? Program a game in that. You can do it with the new HTML5 stuff. Or try learning flash/actionscript.

http://www.html5rocks.com/tutorials/

The hardest part about game programming is learning the structure of a game. No sense in bogging your self down with a new language when you already know one you can use. ^^
Thanks for both replies.

Ok, I admit that I didn't take html/js games seriously before so I never really thought this was a good option to start. I'm going to skip flash as I have zero experience in it.

So if I actually get to like game programming in html/js and decide to continue in a more serious direction, is the main structure/princible comparable to C++ games? Or do I have to start all over again in this case?
Honestly, even going from one C++ game to the next, you're going to find huge structural differences... But as you gain experience with these structures then transitioning between them will become easier.

Also, C++ is very popular in console games (and it's my personal choice), but it's wideley regarded as not being very good for "gameplay programming" -- that is, the bits of the programming that actually have to do with the game usually turn out to be easier to write in other languages.
Almost every commercial project that I've worked on has used C++ for the technology layer (game engine), and some other language for the gameplay programming, such as Lua, Python, Squirrel, AngelScript, JavaScript, etc...

Thanks for both replies.

Ok, I admit that I didn't take html/js games seriously before so I never really thought this was a good option to start. I'm going to skip flash as I have zero experience in it.

So if I actually get to like game programming in html/js and decide to continue in a more serious direction, is the main structure/princible comparable to C++ games? Or do I have to start all over again in this case?


Eh... sort of. The ... conceptual structure should be the same. But from what I've heard, everything in javascript is a function even "objects". When you move out of javascipt, you'll need to focus on Object oriented programming.It's a very important concept to know especially for games since everything in a game pretty much IS an object.


Take pong for instance. The objects would be the paddles and the ball. You define them in a Class description and then you make an instance of them to use them. Then you edit the instance:

PongBall ball; //Make an instance of PongBall

ball.X++; //Moves Right 1 pixel
ball.Y++; //Moves Up/Down 1 pixel depending on the language you use

Sorry for the long explanation. But yeah, you can take most of the knowledge you learn and apply it to another language.

Eh... sort of. The ... conceptual structure should be the same. But from what I've heard, everything in javascript is a function even "objects". When you move out of javascipt, you'll need to focus on Object oriented programming.It's a very important concept to know especially for games since everything in a game pretty much IS an object.


Actually I think that HTML + JavaScript is somehow "object oriented" even if there is no formal definiton of objects in JavaScript. Generally each HTML item is a type of object, that can be modified by applying some functions to it, like OnClick etc. Such functions can be seen as methods of that particular object, so it is no such a big conceptual difference between HTML / JavaScript and Object Oriented Programming.

Yeah, differences are huge, as in C++ you have to declare each class, and you are not allowed to modify its instance behaviour by adding additional methods, but the idea is somewhat similar.

Regarding your question, I have no idea about HTML5 possibilities, as I am pure C++ programmer, I can't judge this approach, but if you want to move to "core" game programming languages, I would recommend not to jump into C++. As an experienced web developer you could find it difficult to figure out all pointers, window messages handling and other low level stuff.
Instead why won't you try C# and XNA? It could give you all C++ possibilities, but is easier to learn as it is something between C++ and Java. What is more, the XNA framework is designed for writing games and would help you a lot in your development.

Honestly, even going from one C++ game to the next, you're going to find huge structural differences... But as you gain experience with these structures then transitioning between them will become easier.

Also, C++ is very popular in console games (and it's my personal choice), but it's wideley regarded as not being very good for "gameplay programming" -- that is, the bits of the programming that actually have to do with the game usually turn out to be easier to write in other languages.
Almost every commercial project that I've worked on has used C++ for the technology layer (game engine), and some other language for the gameplay programming, such as Lua, Python, Squirrel, AngelScript, JavaScript, etc...


Ok, I don't expect to 'port' everything from JS to C++ and I understand that not all games use the same pattern.

I just wanted to be sure that I can gain some knowledge in html/js games that I can actually use later in C++ if I ever decide to go in that direction, even if it's just really basic stuff.


Eh... sort of. The ... conceptual structure should be the same. But from what I've heard, everything in javascript is a function even "objects". When you move out of javascipt, you'll need to focus on Object oriented programming.It's a very important concept to know especially for games since everything in a game pretty much IS an object.


Take pong for instance. The objects would be the paddles and the ball. You define them in a Class description and then you make an instance of them to use them. Then you edit the instance:

PongBall ball; //Make an instance of PongBall

ball.X++; //Moves Right 1 pixel
ball.Y++; //Moves Up/Down 1 pixel depending on the language you use

Sorry for the long explanation. But yeah, you can take most of the knowledge you learn and apply it to another language.


This is good since I'm very familiar with PHP OOP. I am fully aware that PHP's implementation of OOP is not an example for the books but it gives me enough knowledge to understand the provided pong example (i hope so).

I have a class 'ball' and every one of the balls is a new instance (for each ball) of this class. Then, based on user input I change properties of those instances. X and Y in this example are two properties that set offset of the ball from their 'wrapper'.

[size="1"]So, if I try to think about a very simple tetris, it should go something like this:

I have a main grid object with for example 5x15 cells and information if these cells are already filled. Then I have a class for bricks. Shape of the brick is the property of this class (set to random one from all shapes upon making new instance of this class). Then I have an interval of two seconds that moves a brick one cell down. When this is done, I need to calculate the position of the brick (again x and y properties) and check if two cells collide. If they do, I set new coordinates, if they don't, brick stays there.

Am I thinking in the right direction?

So, to make it short: html/js games will not teach me everything but will give me the basic idea and cannot hurt


Regarding your question, I have no idea about HTML5 possibilities, as I am pure C++ programmer, I can't judge this approach, but if you want to move to "core" game programming languages, I would recommend not to jump into C++. As an experienced web developer you could find it difficult to figure out all pointers, window messages handling and other low level stuff.
Instead why won't you try C# and XNA? It could give you all C++ possibilities, but is easier to learn as it is something between C++ and Java. What is more, the XNA framework is designed for writing games and would help you a lot in your development.


Fair enough, will consider this when time comes. Thank you.
I have no doubt you could learn c++ if you wanted, but the real question is if you want to. What kind of games do you want to make and what kind of audience are you after? The great thing about browser games is their accessibility- everyone has a browser. And there are all kinds of browser games too, not just the obvious flash/html5 action types, but also PBBG/text based games which have proven to also be popular.

Don't let any thoughts or naysayers scare you, if you want to pursue c++, go for it. I just want to mention that you already have the knowledge to make a kickass browser game (php, mysql, javascript, and so on). Maybe you should try and play some of the ones out there to get a feel for them.
[size="1"]So, if I try to think about a very simple tetris, it should go something like this:

I have a main grid object with for example 5x15 cells and information if these cells are already filled. Then I have a class for bricks. Shape of the brick is the property of this class (set to random one from all shapes upon making new instance of this class). Then I have an interval of two seconds that moves a brick one cell down. When this is done, I need to calculate the position of the brick (again x and y properties) and check if two cells collide. If they do, I set new coordinates, if they don't, brick stays there.

Am I thinking in the right direction?


Yes, actually. That's a great way to do it. Your first guess is spot on. ^^

This topic is closed to new replies.

Advertisement