Sign in to follow this  

How to code a basic game ..

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

now, id like not to learn texted based things, because i want to understand graphic games. not texted based i possible .. i was wondering how i could learn/create an asteroid type SHIP, not game, but ship, as in movement, and shooting, so i could learn from that, and not try to understand everything else .. i need to know how to import graphics, and all this kind of stuff. i hope some one can help. thanks :D

Share this post


Link to post
Share on other sites
I don't know what tools you are using, but I'm new also and I found that using windows forms in visual studio is a pretty easy way to get started. When you create a Windows Forms project most of the code is generated for you and you can add controls/objects to the default form like buttons and piture boxes. After that you can add events to the differnt controls/objects to make them do things. For instance you could make a piturebox move across the form by pressing a button or key no the keyboard. It's pretty simple as you just have to change the x y coordinates for the control/object. If you look at the pre generated code in the middle of the form you can get an idea of how to do it.

Share this post


Link to post
Share on other sites
Quote:
Original post by NIAB
im using DevC++. but could you help me with some commands and stuff?
You may find it's not quite as easy as 'some commands and stuff'. Developing a game (even a very simple one) can be quite a complicated endeavour :)

Also, based on your other recent post it looks like you're still learning the basics of C++, in which case you might not be quite ready to dive into graphics programming.

You might also take a look at this thread. There's some info and links there which could be useful to you.

Share this post


Link to post
Share on other sites
Well see, the thing is that C++ alone cannot do graphics, you need to use something like SDL, Allegro, OpenGL, or DirectX. Until you know C++, however, you aren't going to be able to understand these. You seem like a good candidate for trying out Game Maker....google it.

Share this post


Link to post
Share on other sites
Most objects like windows have been precoded and exist in a library like windows.h or other libraries made by micrsoft. You could probably make your own window, but I don't think many people do that. You have to learn the libraries functions, what they do, and how to use them. To do that you probably need a book that explains windows programming. It's probably best to learn the basics of coding, creating functions, and creating classes first though. If you want to program in windows it's probably easier to download the free visual studio.

Share this post


Link to post
Share on other sites
hahaha, ive used gamemaker, i know how to use it. i knew C++ had to use
something to do graphics, i just never understood how. is there anywhere
i can learn just how to use these functions or other things to a basic
extent?

thanks ^^

Share this post


Link to post
Share on other sites
Quote:
Original post by NIAB
hahaha, ive used gamemaker, i know how to use it. i knew C++ had to use
something to do graphics, i just never understood how. is there anywhere
i can learn just how to use these functions or other things to a basic
extent?
That's the problem: hardly anything in C++ is 'basic'.

Any reason you're set on C++? There are other languages with which you could probably get going a lot quicker (I think this is discussed a bit in the thread I linked to).

If it has to be C++, then you need to pick a platform and graphics API or APIs and get to work :) Several options were mentioned above (SDL, Allegro, etc.). Tutorials can be found online for many of these.

For more specific advice, you may have to ask more specific questions.

Share this post


Link to post
Share on other sites
Quote:
Original post by NIAB
well, isnt C++ used in major games coded today?
Yeah, but that's not the point. The point is that graphics programming in C++ can be quite difficult if you're new to the language or (more particularly) programming in general.

Anyway, as I mentioned before, you just need to pick a platform and API and get started. Factors in this decision would be what type of games you're interested in (2D? 3D?), and whether you're interested in cross-platform development.

For your original example of an asteroids game, OpenGL might be a good bet (perhaps along with GLUT or SDL).

Share this post


Link to post
Share on other sites
I still think you would be better off downloading something like the free visual studio and playing around with a Windows Forms Application. You don't need to know much a lot about functions and classes to use it and most of it is visual other then the events. Jumping into something like Directx is very difficult as I'm trying to learn how to use it right now. I'm certain you could make a simple game just using the basics that come with visual studio. You just need to know some basic coding to mapulate your objects with events. For example you could do something like this

this->picturebox1 = this->picturebox1->location(this->picturebox1->location.X +3, this->picturebox1-location.Y) This would move the picturebox1 +3 on the form if you put it under a click event.

Share this post


Link to post
Share on other sites
Since you seem to not understand how complicated programming is and how it is connected to the word of game development I suggest you try out the FAQ of the site.

You first need to decide on which language you will learn (have to do that first) how to program.A nice language for a beginner is Java.You can find many nice books on it or even ebooks or tutorials.

AFTER you do that you could go check this space invaders tutorials which pretty much explains everything you have to do step by step to program a space invaders-like game in Java.

As someone in the forum already said you gotta learn to walk first before you learn how to run , and that is what we are here to help you with :)

P.S.:Anyone seeing this know of a similar tutorial for C++ space invaders-like game coding? Would like to have at least one in my bookmarks.

Share this post


Link to post
Share on other sites
javascript huh? oh, and i do understand how hard coding is,
im not saying its easy, basic dose not mean like, simple 4
lines, just as simple as C++ can get.

as of java, ill look into that, thanks :D

Share this post


Link to post
Share on other sites
my friend, I think you need to do a little more research before tackling this objective of yours. First, you need to know how to program. you can't get anywhere without it, you have to start at the pure basics and understand it otherwise you'll get 90 errors and have no clue how to resolve and worse, why and where it's occuring. I personally learned how to code in VB. I like the language I suggest you start there, it can do Direct X so you have room for improvement but for soemthing like astroids, you can just use the windows picture classes and such. Easy language to learn. it'll protect you a lot. My suggestion for a first program to code is a calculator, it's pretty easy but it seems to be a handful for beginners.

Share this post


Link to post
Share on other sites
Hello, the only advice I can personally give you is don't start with C++ you will end up going in circles trying to understand it then end up quitting. The only reason I say this is because you don't fully understand how hard programming in general is. C++ is a hard programming language to learn if you have no programming experience, for how hard C++ is in general using Direct X or openGL deals with C++ code and Direct X or openGL code to deal with drawing, setting up graphics and input, ect... which would be impossible to jump into without basic experience in C++

I would suggest you try BASIC, either Visual Basic.NET or DarkBASIC/PRO and maybe BlizBASIC.

http://darkbasicpro.thegamecreators.com/
http://www.blizbasic.com/ (site might be offline for now)

You can try their demos to get a feel if this is right for you. Don't take this as something to discourage you in programming especially game programming. If you lack Math skills you will have a very hard time programming games in general. However that’s not a problem if you really want to learn to program you can always go that extra mile to learn what you need to achieve your dream.

I also suggest C# as my personal favorite language which contains the best of C and C++ making it easier to learn programming. I second Visual Basic (Classic is what I used aka 6.0) since I used this language for 4 years which was a great learning experince.

Best wishes.

Share this post


Link to post
Share on other sites
Very intresting. Ok I am also beginner and I program simple codes in c/c++. I also wanted to display some object and if possible move it.

I will see SDL tutorial after my exams. Can some one guide me how do graphics appear and their movements. I mean,like pac-man. Can I make game like that.

I am thinking of, to have a maze and some object that needs to find a way out of it. Like those games.

Share this post


Link to post
Share on other sites
I don't think you (well...now...y'all as the other guy posting) know how hard game development is. By judging from the way you have posted, it dosen't seem like you know the language very well. Please tell us what you know in C++ right now, and we will tell you if you are most likely yet to enter the world of graphics programming.


I will also suggest taking a look at C#. It's a pretty easy language to learn and it will hide some low level stuff from you.

We will just need more information on what you know...so yeah. Do you know how to do Hello World in C++, variables, input, if-else statements, loops, pointers, and a lot more?


Chad.

Share this post


Link to post
Share on other sites
Like everyone else has mentioned, you sound a bit lost. Before you do ANYTHING you should read some of the articles in the FAQ, like this one. Second, you should consider an alternative language, C++/C or even Java for that matter are, in my opinion, languages you learn when you already understand a lot of programming concepts, which you can only understand by learning an actual language.

By choosing C++ as your first language, you are only making it harder on yourself. If you don't believe me, there are many more talented individuals on these forums that can explain to you why C++ is complicated for beginners better than I could.

Assuming you believe me, a great language to check out, and one that seems to be gaining popularity as a first language, is Python. Read the "Getting Started" section on their website if you are interested. If not, refer to the FAQ link I gave you to help you choose a language. Finally, lose the whole, "C++ is what the experts use!" mentality, it may be true, but those experts didn't all start out with C++.

Share this post


Link to post
Share on other sites
Ok thanks for reply. Yes I have been knowing and doing C/C++ program for 3 years atleast. I mean three years in still beginners level [sad].

I know a bit of data structures and OS but what I am trying to say is that sadly my pratical knowledge is not much.




Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this