An Introduction to Programming, For beginners

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: An Introduction to Programming, For beginners

Post by eatcomics »

That's what I had thought I was wondering about that...
Image
User avatar
Aeolus
Chaos Rift Regular
Chaos Rift Regular
Posts: 179
Joined: Fri Jan 16, 2009 2:28 am

Re: An Introduction to Programming, For beginners

Post by Aeolus »

So when is 16 coming out?
Hyde from That 70's Show wrote:Woman are like muffins... Once you have a muffin you will do anything to have another muffin... And they know that.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: An Introduction to Programming, For beginners

Post by eatcomics »

Oh, my bad, remember I'm on two other chats as well lol :lol:
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: An Introduction to Programming, For beginners

Post by dandymcgee »

Ginto8 wrote::roll: You kinda missed my point. You'll have to wait until you get to operator overloading to understand. ;)
I knew what it meant.. I'm just saying we both said the same thing but you said it with actual code.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: An Introduction to Programming, For beginners

Post by Ginto8 »

dandymcgee wrote:
Ginto8 wrote::roll: You kinda missed my point. You'll have to wait until you get to operator overloading to understand. ;)
I knew what it meant.. I'm just saying we both said the same thing but you said it with actual code.
:lol: Oh, okay. ;)
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: An Introduction to Programming, For beginners

Post by MarauderIIC »

I split threads out from here.
User Input started by EvolutionXEngine
Outputting letters as numbers (a=0...) started by cplusplusnoob.
Please use those to continue any applicable discussion of those topics.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: An Introduction to Programming, For beginners

Post by MarauderIIC »

Split another post out.
Random questions don't go here, please make your own thread.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
EvolutionXEngine
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 12
Joined: Mon Feb 02, 2009 8:13 pm

Re: An Introduction to Programming, For beginners

Post by EvolutionXEngine »

Sooo now I'm trying to learn C++ with the Dummies version... dam... anyways my complier is to executing this..
I copy and paste ..but it says their is an error and i can't figure it out...

Code: Select all

// BoolTest - compare variables input from the
// keyboard and store the results off
// into a logical variable
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// set output format for bool variables
// to true and false instead
// of 1 and 0
cout.setf(cout.boolalpha);
// initialize two arguments
int nArg1;
cout << “Input value 1: “;  <------------------------------------------------  I get the Error right here!
cin >> nArg1;
int nArg2;
cout << “Input value 2: “;
cin >> nArg2;
bool b;
b = nArg1 == nArg2;
cout << “The statement, “ << nArg1
<< “ equals “ << nArg2
<< “ is “ << b
<< endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system(“PAUSE”);
return 0;
}
please help , explain... Thank You!
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: An Introduction to Programming, For beginners

Post by Ginto8 »

EvolutionXEngine: please use

Code: Select all

 brackets!
As for the error, can you tell us exactly what the compiler says? Going "OMG I HAS AN ERROR ON THIS LINE WHAT'S WRONG WITH IT????" doesn't help the people trying to help you. If you post the error, it gives your helpers clues as to what they have to look for. :)  ;) 

I haven't seen you around here before, so welcome to the forum! :mrgreen:
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
EvolutionXEngine
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 12
Joined: Mon Feb 02, 2009 8:13 pm

Re: An Introduction to Programming, For beginners

Post by EvolutionXEngine »

Still im reading the C++ book but i want to get an idea of a game structure.
Can anyone help. Such as a 2d or 3d structure... some sort of chart!

Thanks!
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: An Introduction to Programming, For beginners

Post by MarauderIIC »

...feel free to make new threads for your issues. Please.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
zeid
Chaos Rift Junior
Chaos Rift Junior
Posts: 201
Joined: Fri Apr 24, 2009 11:58 pm

Re: An Introduction to Programming, For beginners

Post by zeid »

Here's a very, simple representation of perhaps the most basic game setup you could have;
Image

You begin the program, and everything is initialised. Things like images that need to be loaded, models, level files. Anything that is too taxing to do in realtime and should be in memory from the games beginning should be done here.

After this you go into the Game Loop. This is basically a giant while(!exit) loop exit is a boolean that will equal true when it's ready to shutdown the game. Otherwise the loop cycles through infinitely.

A timer is used in almost all modern games to make each iteration of the loop sleepfor a short period. If this wasn't in place the game would run as fast as the computer allows it at all times, background processes would affect game speed and the game would run at different speeds on different supported hardware.

I mention the input logic inside the game loop, but this isn't neccassarily the case. It isn't uncommon for the input logic to be place in a seperate thread so that delays caused by the game running logic don't stop input from being registered. Although in most basic game circumstances you can just put the input in the game loop (Even if it's sloppy).

Here is the most important part of the game, the game logic. Technically speaking you can break this up into all kinds of things like physics, sound, etc. This is the core of the game, it is where all your collision detection updating object positions, creating new objects, etc. is handled. It is your games rules!

Rendering is done after all the game logic has been updated. As it's name suggests this is where you tell your game to get all the locations and states of your objects and render them accordingly. You clear the screen and redraw everything everytime you render.

After rendering has finished you check the state of exit if it changed to true during sometime in the game logic then you exit the game loop, otherwise you start it over again.

Clean-up, we don't want memory leaking, maybe we created a bunch of temp files that are only needed while the game is open for some reason. So after all is done it is important to clean-up allowing the player to close the game in piece without any negative repurcussions.

Thats a very broad and general outline of how a game is structured. People try and keep everything modular (e.g. the renderer, the physics, etc.) so that it can be easily read and that you can re-use parts easily. This is why there are physics engines, graphics engines, etc.
Axolotl Pop!
Image
Or, try it for free.

For many more free games online visit www.sam-zeid.com
EdEown
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Dec 19, 2009 5:00 pm
Favorite Gaming Platforms: PS3
Programming Language of Choice: C#
Location: Bosnia and Herzegovina

Re: An Introduction to Programming, For beginners

Post by EdEown »

What about C# ?
Eaven if it is not popular so much...it has great potential for the future I think, at least it is made to improve C++.
Guild wars 2 team is using it for some specific stuf :P
"There is nothing either good or bad, but our thinking makes it so"
User avatar
OmegaGDS
Chaos Rift Regular
Chaos Rift Regular
Posts: 123
Joined: Mon Jan 18, 2010 3:20 am
Current Project: GMN (C++)
Favorite Gaming Platforms: PC, PSP / Psp Emulation, GameCube, SNES, NES
Programming Language of Choice: C++
Location: Kentucky
Contact:

Re: An Introduction to Programming, For beginners

Post by OmegaGDS »

EdEown wrote:What about C# ?
Eaven if it is not popular so much...it has great potential for the future I think, at least it is made to improve C++.
Guild wars 2 team is using it for some specific stuf :P
Have you heard of F#? Apparently it is being made by the same guy who made C#, and it will be better. I'm not even sure if the F# thing is true though, can someone confirm? For now, I thing Java and C++ will be the big ones in the future. well... scratch java.
Image
Image
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: An Introduction to Programming, For beginners

Post by MrDeathNote »

OmegaGDS wrote:
EdEown wrote:What about C# ?
Eaven if it is not popular so much...it has great potential for the future I think, at least it is made to improve C++.
Guild wars 2 team is using it for some specific stuf :P
Have you heard of F#? Apparently it is being made by the same guy who made C#, and it will be better. I'm not even sure if the F# thing is true though, can someone confirm? For now, I thing Java and C++ will be the big ones in the future. well... scratch java.
Yes there is a language called F#. It's a .Net language and it's not even close to new, it first appeared around 2002 although it isn't distributed yet it will be shipped with Visual Studio 2010 or so we're told...........
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
Post Reply