what is a good program language for game programing

For beginners, flames not allowed...(just by the staff :P)
shamir
Computer Manager
Computer Manager
Posts: 853
Joined: 01 Mar 2007, 17:00
17
Location: NY
Contact:

what is a good program language for game programing

Post by shamir »

what is a good program language for game programing
c++ or java or other foks 8)

User avatar
Macross
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 152
Joined: 01 May 2007, 16:00
16
Contact:

Post by Macross »

c++ :)

shamir
Computer Manager
Computer Manager
Posts: 853
Joined: 01 Mar 2007, 17:00
17
Location: NY
Contact:

Post by shamir »

is it so can show me a example of it hm dude a code :o

User avatar
Big-E
Administrator
Administrator
Posts: 1332
Joined: 16 May 2007, 16:00
16
Location: IN UR ____ , ____ING UR _____ .
Contact:

Post by Big-E »

Shamir, where the hell are you from? I hope that english is not your native language, and it is indeed a second language. If not, take your time at typing and make some sense...I cannot read half your posts without making assumptions as to what words are supposed to mean, and then derive the whole purpose of your post.

mrmike
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 503
Joined: 22 Feb 2007, 17:00
17
Location: switzerland
Contact:

Post by mrmike »

Big-E wrote:Shamir, where the hell are you from? I hope that english is not your native language, and it is indeed a second language. If not, take your time at typing and make some sense...I cannot read half your posts without making assumptions as to what words are supposed to mean, and then derive the whole purpose of your post.
xD rofl that was hard..
[img]http://img.photobucket.com/albums/v247/Vlady/48265b8wj96xhce.gif[/img]

bubzuru
.net coder
.net coder
Posts: 700
Joined: 17 Apr 2007, 16:00
17
Contact:

Post by bubzuru »

Shamir, where the hell are you from? I hope that english is not your native language, and it is indeed a second language. If not, take your time at typing and make some sense...I cannot read half your posts without making assumptions as to what words are supposed to mean, and then derive the whole purpose of your post.
harsh man

and i think hes asking for a code example

shamir
Computer Manager
Computer Manager
Posts: 853
Joined: 01 Mar 2007, 17:00
17
Location: NY
Contact:

Post by shamir »

you know hes right I mean buz is right 8)

bubzuru
.net coder
.net coder
Posts: 700
Joined: 17 Apr 2007, 16:00
17
Contact:

Post by bubzuru »

a c++ game code is useless unless you no c++

if you dont know c++ thers a good book in the tuts section start there

shamir
Computer Manager
Computer Manager
Posts: 853
Joined: 01 Mar 2007, 17:00
17
Location: NY
Contact:

Post by shamir »

why can't you program games with java

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Post by ayu »

shamir wrote:why can't you program games with java
you can...
"The best place to hide a tree, is in a forest"

bubzuru
.net coder
.net coder
Posts: 700
Joined: 17 Apr 2007, 16:00
17
Contact:

Post by bubzuru »

c++ is just better

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Post by ayu »

bubzuru wrote:c++ is just better
Not really.... =/
"The best place to hide a tree, is in a forest"

bubzuru
.net coder
.net coder
Posts: 700
Joined: 17 Apr 2007, 16:00
17
Contact:

Post by bubzuru »

thats just my opinion
c++ graphics
Image

User avatar
visser
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 472
Joined: 03 Apr 2007, 16:00
17
Location: online
Contact:

Post by visser »

im gonna go with shamir and ask for an example of a code. i may not really know c++. but it may help just to see the code.

like teaching yourself math. if you know the start and the end. its easier to learn the middle. thats at least for me :roll:

ebrizzlez
Kage
Kage
Posts: 732
Joined: 31 Mar 2007, 16:00
17
Location: Hidden in a Buffer Protection.
Contact:

Post by ebrizzlez »

Ok. Since you wanted to know. I found this source code of the game pong at .http://www.cppgameprogramming.com/

Code: Select all

#include <allegro.h>
#include <cstdlib>
#include <time.h>


int ball_x = 320;
int ball_y = 240;

int ball_tempX = 320;
int ball_tempY = 240;

int p1_x = 20;
int p1_y = 210;

int p1_tempX = 20;
int p1_tempY = 210;

int p2_x = 620;
int p2_y = 210;

int p2_tempX = 620;
int p2_tempY = 210;

time_t secs;    //The seconds on the system clock will be stored here
                //this will be used as the seed for srand()

int dir;     //This will keep track of the circles direction
            //1= up and left, 2 = down and left, 3 = up and right, 4 = down and right

BITMAP *buffer; //This will be our temporary bitmap for double buffering

void moveBall(){

    ball_tempX = ball_x;
    ball_tempY = ball_y;

    if (dir == 1 && ball_x > 5 && ball_y > 5){
     
         if( ball_x == p1_x + 15 && ball_y >= p1_y && ball_y <= p1_y + 60){
                  dir = rand()% 2 + 3;
         }else{    
                 --ball_x;
                 --ball_y;
         }    
              
    } else if (dir == 2 && ball_x > 5 && ball_y < 475){

         if( ball_x == p1_x + 15 && ball_y >= p1_y && ball_y <= p1_y + 60){
                  dir = rand()% 2 + 3;
         }else{    
                 --ball_x;
                 ++ball_y;
         }

    } else if (dir == 3 && ball_x < 635 && ball_y > 5){

         if( ball_x + 5 == p2_x && ball_y >= p2_y && ball_y <= p2_y + 60){
                  dir = rand()% 2 + 1;
         }else{    
                 ++ball_x;
                 --ball_y;
         }

    } else if (dir == 4 && ball_x < 635 && ball_y < 475){

         if( ball_x + 5 == p2_x && ball_y >= p2_y && ball_y <= p2_y + 60){
                  dir = rand()% 2 + 1;
         }else{    
                 ++ball_x;
                 ++ball_y;
         }

    } else { 

        if (dir == 1 || dir == 3)    ++dir;
        else if (dir == 2 || dir == 4)    --dir;

    }    
    
    acquire_screen();
    circlefill ( buffer, ball_tempX, ball_tempY, 5, makecol( 0, 0, 0));
    circlefill ( buffer, ball_x, ball_y, 5, makecol( 128, 255, 0));
    draw_sprite( screen, buffer, 0, 0);
    release_screen();
    
    rest(5);

}    

void p1Move(){
 
    p1_tempY = p1_y;
 
    if( key[KEY_W] && p1_y > 0){
     
        --p1_y;
              
    } else if( key[KEY_S] && p1_y < 420){
     
        ++p1_y;
              
    }     
    
    acquire_screen();
    rectfill( buffer, p1_tempX, p1_tempY, p1_tempX + 10, p1_tempY + 60, makecol ( 0, 0, 0));
    rectfill( buffer, p1_x, p1_y, p1_x + 10, p1_y + 60, makecol ( 0, 0, 255));
    release_screen();
          
}  

void p2Move(){
 
    p2_tempY = p2_y;
 
    if( key[KEY_UP] && p2_y > 0){
     
        --p2_y;
              
    } else if( key[KEY_DOWN] && p2_y < 420){
     
        ++p2_y;
              
    }     
    
    acquire_screen();
    rectfill( buffer, p2_tempX, p2_tempY, p2_tempX + 10, p2_tempY + 60, makecol ( 0, 0, 0));
    rectfill( buffer, p2_x, p2_y, p2_x + 10, p2_y + 60, makecol ( 0, 0, 255));
    release_screen();
          
}    

void startNew(){

    clear_keybuf();
    readkey();
    clear_to_color( buffer, makecol( 0, 0, 0));
    ball_x = 320;
    ball_y = 240;

    p1_x = 20;
    p1_y = 210;

    p2_x = 620;
    p2_y = 210;

}    

void checkWin(){

    if ( ball_x < p1_x){
        textout_ex( screen, font, "Player 2 Wins!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); 
        startNew();
    } else if ( ball_x > p2_x){
        textout_ex( screen, font, "Player 1 Wins!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); 
        startNew();
    }    
   
}    

void setupGame(){
 
    acquire_screen();
    rectfill( buffer, p1_x, p1_y, p1_x + 10, p1_y + 60, makecol ( 0, 0, 255));
    rectfill( buffer, p2_x, p2_y, p2_x + 10, p2_y + 60, makecol ( 0, 0, 255));  
    circlefill ( buffer, ball_x, ball_y, 5, makecol( 128, 255, 0));
    draw_sprite( screen, buffer, 0, 0);
    release_screen();
    
    time(&secs);
    srand( (unsigned int)secs);
    dir = rand() % 4 + 1;
            
}    

int main(){

    allegro_init();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
    
    buffer = create_bitmap( 640, 480); 
    
    setupGame();
    
    while( !key[KEY_ESC]){

        p1Move();
        p2Move();
        moveBall();
        checkWin();
   
    }    
    
    return 0;

}
END_OF_MAIN();
Not to beautiful right? Well... C++ gives you the intergration of using some pretty neat stuff in game programming. Such features are Direct X Controls, of OpenGL libaires. These factors alone make C++ great for programming. It just takes some time to define all the functions, classes, and varibles. Many companies program in either C or C++ and this knownledge is great for game programmers.

You look at Java and see the C syntax in it. So right from the bat Java and C are alike. And you look at a big succession of Java game programming would be RuneScape. But, Java isnt as powerful, but quite useful.

If you want to start game programming, I still recommend BASIC. To start, its simple. And pretty easy to get the hang of it. And you get a basic idea of game programming and programming in general. But if you plan on selling your game, BASIC isnt much use. Dont get me wrong here, BASIC is a great language, but well... its a bit... "basic". :wink:
[img]http://i81.photobucket.com/albums/j205/ebrizzlez/4lsint1.jpg[/img]

Post Reply