• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Jun_The_Gamer

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

151 Neutral

About Jun_The_Gamer

  • Rank
    Newbie
  1. WE ALL LIVE IN A YELLOW SUBMARINE, A YELLOW SUBMARINE, A YELLOW SUBMARINE.
  2. Interesting.. although I'm trying to avoid using classes right now, need to learn more about them.
  3. y u do dis, semicolon.
  4. Read up on state machines, they'll help out here. What you want to do in this case is to use a state machine and transition to and from states. Implementations can be simple or complex, but you should only use one game loop. Here's a small example:  set state to 'title screen' while game is still running: handle input update according to state: when state is 'title screen': update timer update fade animation if timer expired or user pressed skip button: set state to menu when state is 'menu': navigate menu according to user input if user pressed 'start game' GUI button: set state to 'game' when state is 'game': if user pressed menu button: set state to 'menu' update game render according to state: when state is 'title screen': draw splash screen draw fade transition when state is 'menu': draw menu draw selected item when state is 'game': draw game present image Amazing, thanks alot! Although, essentially it's the same thing I thought of,just cleaner. The functions would be still loops till the user prompts(example, selects "Play game"). But thanks for clearing it up.
  5. How do I make , for example a Title screen and when an option is selected, for example "Play game", the screen switches to the gameplay screen? Do I have to clear the screen and then enter the game loop? Do I need to make Individual loops inside the main gameoop for different screens, if yes, can you provide a quick example? I still don't understand the screen states.    
  6.  Hey! I never actually plan things out, Improv all the way, anyways so I defined them first just for fun and when I reached to timer, I initialized FPS, you see, when I finished the project I was like "You know what it needs?, a difficulty" so I just create integers at random places and hope it doesn't mess up.   You see, I just wanted this game to "Work" , the collision is also messed up sometimes, but works. And, Now i'll take it more seriously and will plan and break the project into modules. Thanks for the tips! Have a good day.
  7. Hey guys, this is my first game made with purely coding, I have made some games in the past with Blender G.E. It is a Pong spin-off. Anyways, I just wanted to show it off and get some tips to make it "Better" and "Efficient" , because I know that this program is horribly coded    [source='C++'] #include<allegro5\allegro.h> #include<allegro5\allegro_native_dialog.h> #include<allegro5\allegro_ttf.h> #include<allegro5\allegro_font.h> #include<allegro5\allegro_primitives.h> #include<allegro5\allegro_audio.h> #include<allegro5\allegro_acodec.h> #include<iostream> #include <iomanip> #include <cstdio> #include <cstdlib> #include <ctime> #include <fstream> #include<stdlib.h> #include<time.h> #define D_WIDTH 800 #define D_HEIGHT 600 int InitGame(){ std::cout<<"INITIALIZING GAME\n"; if(!al_init()){ return -1; } std::cout<<"COMPLETE\n"; std::cout<<"INITIALIZING ADDONS\n"; al_init_primitives_addon(); al_init_font_addon(); al_init_ttf_addon(); al_install_keyboard(); al_install_audio(); al_init_acodec_addon(); al_reserve_samples(1); std::cout<<"COMPLETE\n"; } enum KEYS{UP,DOWN}; ALLEGRO_DISPLAY *display; bool gamerunning = true; bool keys[2] ={false,false}; void DrawMap(){ al_draw_line(D_WIDTH-1,0,D_WIDTH-1,600,al_map_rgb(200,200,200),10.0); al_draw_line(D_WIDTH/2,0,D_WIDTH/2,600,al_map_rgb(35,35,35),5.0); al_draw_circle(D_WIDTH/2,D_HEIGHT/2,125,al_map_rgb(35,35,35),5.0); } const float FPS = 60.0; int randomnum(){ return rand()%3 + 1; } int dif = 1;int velX =randomnum(),velY=randomnum();; int main(void){ InitGame(); int pscore=0; int ball_x = 400,ball_y = 300; srand(time(NULL)); //display// ALLEGRO_TIMER *timer = nullptr; timer = al_create_timer(1.0/FPS); al_set_new_display_flags(ALLEGRO_NOFRAME); display = al_create_display(D_WIDTH,D_HEIGHT); if(!display){ return -1;} al_set_window_title(display,"Pong! by Junaid"); //buffer = al_create_bitmap(D_WIDTH,D_HEIGHT); al_set_target_bitmap(al_get_backbuffer(display)); al_flip_display(); //display// std::cout<<"Start screen loaded!\n"; //FONTS// ALLEGRO_FONT *pongtitle = al_load_font("resources/font/ZIG.TTF",50,NULL); ALLEGRO_FONT *smalltitle = al_load_font("resources/font/ZIG.ttf",25,NULL); ALLEGRO_FONT *score = al_load_font("resources/font/HISCORE.ttf",20,NULL); //FONTS_end// //bgSOUND// ALLEGRO_SAMPLE *sidecol = al_load_sample("resources/sound/sidecollision.wav"); ALLEGRO_SAMPLE *sound_bg_loop = al_load_sample("resources/sound/bg.wav"); al_play_sample(sound_bg_loop,1.0,0.0,1.0,ALLEGRO_PLAYMODE_LOOP,NULL); //ENDBGSOUND// //drawSTARTUPscreen// al_clear_to_color(al_map_rgb(256,256,256)); al_draw_line(-1,500,801,500,al_map_rgb(55,55,55),4.0); al_draw_line(-1,100,801,100,al_map_rgb(55,55,55),4.0); al_draw_text(pongtitle,al_map_rgb(200,200,200),D_WIDTH/2,((D_HEIGHT/2)-100),ALLEGRO_ALIGN_CENTER,"PONG! beta_v1"); al_draw_text(pongtitle,al_map_rgb(150,150,150),D_WIDTH/2,((D_HEIGHT/2)-45),ALLEGRO_ALIGN_CENTER,"By Junaid"); al_draw_text(smalltitle,al_map_rgb(100,100,100),D_WIDTH/2+10,D_HEIGHT/2+55,ALLEGRO_ALIGN_CENTER,"Press any key to play..."); al_flip_display(); //startCONTROLS// bool startgame = false; ALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue(); ALLEGRO_EVENT startevent; al_register_event_source(event_queue,al_get_keyboard_event_source()); while(!startgame){ al_wait_for_event(event_queue,&startevent); startgame=true; } //endSTARTCONTROLS// std::cout<<"Game started!\n"; std::cout<<"Loading the game...\n"; al_rest(0.5); std::cout<<"Loading complete!\n"; //drawSTARTUPscreen-end// al_set_target_bitmap(al_get_backbuffer(display)); al_clear_to_color(al_map_rgb(256,256,256)); al_flip_display(); std::cout<<"\n\n\nDebug mode started.\n\n-------------------------------\n"; //gameloop// int y1 = 300,y2 = 400; al_destroy_sample(sound_bg_loop); al_register_event_source(event_queue, al_get_timer_event_source(timer)); al_start_timer(timer); while(gamerunning) { ALLEGRO_EVENT ev; al_wait_for_event(event_queue,&ev); if(ev.type == ALLEGRO_EVENT_KEY_DOWN) { switch(ev.keyboard.keycode) { case ALLEGRO_KEY_UP: std::cout<<"UP"; keys[UP] = true; break; case ALLEGRO_KEY_DOWN: std::cout<<"DOWN"; keys[DOWN] = true; break; } } else if(ev.type == ALLEGRO_EVENT_KEY_UP){ switch(ev.keyboard.keycode){ case ALLEGRO_KEY_UP: keys[UP] = false; break; case ALLEGRO_KEY_DOWN: keys[DOWN] = false; break; case ALLEGRO_KEY_ESCAPE: if(al_show_native_message_box(display,"Quit game","Are you sure you want to exit the game?","",NULL,ALLEGRO_MESSAGEBOX_YES_NO) == true){ gamerunning = false; } break; } } y1 -= keys[UP]*10;y1 += keys[DOWN]*10; y2 -= keys[UP]*10;y2 += keys[DOWN]*10; if(y1 == 0 || y1 <= 0){ y1 = 1; y2 = y1+100; } if(y2 == 600 || y2 >= 600){ y2 = 599; y1 = y2 - 100; } //ball// char scor[10]; itoa(pscore, scor, 10); /// ball_x+=velX; ball_y+=velY; if(ball_y-7 < 1 || ball_y+7 > 599){ al_play_sample(sidecol,1.0,0.0,5.0,ALLEGRO_PLAYMODE_ONCE,NULL); velY = -velY; } if(ball_x+7 > 799){ al_play_sample(sidecol,1.0,0.0,5.0,ALLEGRO_PLAYMODE_ONCE,NULL); velX = -velX;//pscore+=1; if(rand()%100+1 < 50 && dif <= 10){dif++;velX = velX-=1; velY+=1;} } bool collisionpaddle = false; if( ball_x >= 20 && ball_y >= y1 && ball_x <= 30 && ball_y <= y2){ collisionpaddle = true; pscore+=1; velX = -velX; std::cout<<"\ncollison "< } collisionpaddle = false; if(ball_x <= 0){ //al_play_sample(lost,1.0,0.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL); //al_rest(2.0); al_show_native_message_box(display,"GAME OVER!","Your total score was ",scor,NULL,NULL); gamerunning = false; } //endball// //increase difficulty// //incdif(); char diflevel[10]; itoa(dif, diflevel, 10); // al_draw_text(smalltitle,al_map_rgb(50,50,50),600,400,ALLEGRO_ALIGN_CENTER,"Score"); al_draw_text(score,al_map_rgb(50,50,50),600,450,ALLEGRO_ALIGN_CENTER,scor); al_draw_text(smalltitle,al_map_rgb(50,50,50),600,150,ALLEGRO_ALIGN_CENTER,"Difficulty"); al_draw_text(score,al_map_rgb(50,50,50),600,200,ALLEGRO_ALIGN_CENTER,diflevel); al_draw_line(D_WIDTH,0,D_WIDTH,D_HEIGHT,al_map_rgb(150,150,150),5.0); al_draw_line(0,0,D_WIDTH,0,al_map_rgb(150,150,150),5.0); al_draw_line(0,D_HEIGHT,D_WIDTH,D_HEIGHT,al_map_rgb(150,150,150),5.0); al_draw_filled_rectangle(20,y1,30,y2,al_map_rgb(100,100,100)); al_draw_filled_circle(ball_x,ball_y,7,al_map_rgb(175,175,175)); al_flip_display(); al_clear_to_color(al_map_rgb(0,0,0)); } //ENDdrawmaingame// //destruction// al_destroy_sample(sidecol); al_destroy_timer(timer); al_destroy_event_queue(event_queue); al_destroy_font(pongtitle); al_destroy_font(score); al_destroy_font(smalltitle); //al_destroy_sample(sound_bg_loop); al_destroy_display(display); //end distruction// } [/source]   Controls : Up Arrow : move paddle up Down Arrow : move paddle down Escape : quit