Garbe Engine/Editor C++/SDL
Moderator: PC Supremacists
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Garbe Engine/Editor C++/SDL
Hi everyone, i just want to present my engine and editor that i am currently working on for making a 2d RPG game called Garbe
the engine and editor are developed in C++ using SDL as API , Here some screenshots:
The logo!
And here a video of what i have done so far:
Sorry,sorry for the Quality!!! i dont know why movie maker sucks that much!!!
Let me know what you think, please leave a comment below, also what i need to improve
i know the art suks but most of the tiles are made in paint since i dont have a graphic artist
the engine and editor are developed in C++ using SDL as API , Here some screenshots:
The logo!
And here a video of what i have done so far:
Sorry,sorry for the Quality!!! i dont know why movie maker sucks that much!!!
Let me know what you think, please leave a comment below, also what i need to improve
i know the art suks but most of the tiles are made in paint since i dont have a graphic artist
Last edited by lalacomun on Wed Feb 15, 2012 2:09 pm, edited 1 time in total.
- Light-Dark
- Dreamcast Developer
- Posts: 307
- Joined: Sun Mar 13, 2011 7:57 pm
- Current Project: 2D RPG & NES Platformer
- Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
- Programming Language of Choice: C/++
- Location: Canada
Re: Garber Engine/Editor C++/SDL
Ive noticed a inconsistance with your post, you said C++ is your language when the engine source file is .c? which is a C source file opposed to the .cpp, but hey might be your IDE or something, looks pretty good so far, keep up the good work man. Oh and im assuming you used a lazyfoo tutorial?, your Player class and collision detection look like his
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
- dandymcgee
- 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: Garber Engine/Editor C++/SDL
Looks like a great start man. The only constructive criticism I can give you based on that screenshot is to CLICK HERE NOW.
You will never regret it, I promise.
You will never regret it, I promise.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Garber Engine/Editor C++/SDL
I already downloaded visual c++, dev-c++ didnt let me put .cpp it sais it was coorrupted wtf!? i think it was an error of the IDE, and yes i learn all i know from lazy foo so i am not surprised is basicly the same function, but yes i am going to be uploading uptdates!Light-Dark wrote:Ive noticed a inconsistance with your post, you said C++ is your language when the engine source file is .c? which is a C source file opposed to the .cpp, but hey might be your IDE or something, looks pretty good so far, keep up the good work man. Oh and im assuming you used a lazyfoo tutorial?, your Player class and collision detection look like his
Hell yes!! much better, devcpp was shit compared to visual ! thank you !dandymcgee wrote:Looks like a great start man. The only constructive criticism I can give you based on that screenshot is to CLICK HERE NOW.
You will never regret it, I promise.
i just downloaded and instal SDL thanks alot
-
- Chaos Rift Cool Newbie
- Posts: 69
- Joined: Sun Apr 10, 2011 5:58 pm
- Programming Language of Choice: C
- Location: Detroit, MI
Re: Garbe Engine/Editor C++/SDL
Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Garbe Engine/Editor C++/SDL
One of my early mistakes... "What the fuck, 1 000 000 kb memory usage for this shitty small game?"EddieRingle wrote:Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Garbe Engine/Editor C++/SDL
No, because the function free the previous surface each time a new key is realesedEddieRingle wrote:Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Garbe Engine/Editor C++/SDL
My load image, load's a bmp image then optimize it to a png image, after that it free the previous image (the bmp one)EddieRingle wrote:Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
so as you saw on the screenshot:
load_image(c:\...player.bmp);
i load that image , then optimize it, and then free the bmp image
jaja Well I once made a game that only moved a car in the screen and collides with objects and it used almost 60% of my cpu and tons of ram !! but i didnt care of it if the game runssuperLED wrote:One of my early mistakes... "What the fuck, 1 000 000 kb memory usage for this shitty small game?"EddieRingle wrote:Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Garbe Engine/Editor C++/SDL
But when you already have loaded the image once to memory, why remove it and load it back in again?lalacomun wrote:My load image, load's a bmp image then optimize it to a png image, after that it free the previous image (the bmp one)EddieRingle wrote:Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
so as you saw on the screenshot:
load_image(c:\...player.bmp);
i load that image , then optimize it, and then free the bmp image
You should just load the image once, when you init your engine, and reuse that image throughout the whole game, then you free the image when the game ends.
Think about it. Now, each and every frame, the program opens the image, read every single pixels from the image, and stores in to memory, and frees the surface.
Code: Select all
void initDot() {
SDL_Surface * dot_img_up = load_image(dot_up.png);
SDL_Surface * dot_img_down = load_image(dot_down.png);
SDL_Surface * dot_img_right = load_image(dot_right.png);
SDL_Surface * dot_img_left = load_image(dot_left.png);
int dot_facing = 0; //0 = up, 1 = down, 2 = right, 3 = left
}
void drawDot() {
if(dot facing == 0) {
draw_surface(dot_img_up, dot_x, dot_y);
}
else if(dot facing == 1) {
draw_surface(dot_img_down, dot_x, dot_y);
}
else if(dot facing == 2) {
draw_surface(dot_img_right, dot_x, dot_y);
}
else if(dot facing == 3) {
draw_surface(dot_img_left, dot_x, dot_y);
}
}
void moveDot() {
/* your movement stuff here */
case SDLK_UP:
facing = 0;
break;
case SDLK_DOWN:
facing = 1;
break;
case SDLK_RIGHT:
facing = 2;
break;
case SDLK_LEFT:
facing = 3;
break;
}
void cleanUpDot() {
SDL_FreeSurface(dot_img_up);
SDL_FreeSurface(dot_img_down);
SDL_FreeSurface(dot_img_right);
SDL_FreeSurface(dot_img_left);
}
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Garbe Engine/Editor C++/SDL
you are totaly right, just started working on that!, i am also working in a menu system, no to fancy just a couple of buttons in the center that if i press them they change colorsuperLED wrote:But when you already have loaded the image once to memory, why remove it and load it back in again?lalacomun wrote:My load image, load's a bmp image then optimize it to a png image, after that it free the previous image (the bmp one)EddieRingle wrote:Looks like a neat start, but I heavily suggest you don't re-load the textures in the Dot class on every key press (dunno what your load_image function does, but I can only assume the worst).
so as you saw on the screenshot:
load_image(c:\...player.bmp);
i load that image , then optimize it, and then free the bmp image
You should just load the image once, when you init your engine, and reuse that image throughout the whole game, then you free the image when the game ends.
Think about it. Now, each and every frame, the program opens the image, read every single pixels from the image, and stores in to memory, and frees the surface.
I wrote this code fast and dirty, just so it could be easily understandable. But I hope you got the drill.Code: Select all
void initDot() { SDL_Surface * dot_img_up = load_image(dot_up.png); SDL_Surface * dot_img_down = load_image(dot_down.png); SDL_Surface * dot_img_right = load_image(dot_right.png); SDL_Surface * dot_img_left = load_image(dot_left.png); int dot_facing = 0; //0 = up, 1 = down, 2 = right, 3 = left } void drawDot() { if(dot facing == 0) { draw_surface(dot_img_up, dot_x, dot_y); } else if(dot facing == 1) { draw_surface(dot_img_down, dot_x, dot_y); } else if(dot facing == 2) { draw_surface(dot_img_right, dot_x, dot_y); } else if(dot facing == 3) { draw_surface(dot_img_left, dot_x, dot_y); } } void moveDot() { /* your movement stuff here */ case SDLK_UP: facing = 0; break; case SDLK_DOWN: facing = 1; break; case SDLK_RIGHT: facing = 2; break; case SDLK_LEFT: facing = 3; break; } void cleanUpDot() { SDL_FreeSurface(dot_img_up); SDL_FreeSurface(dot_img_down); SDL_FreeSurface(dot_img_right); SDL_FreeSurface(dot_img_left); }
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Garbe Engine/Editor C++/SDL
Ok finally i got my menu system to work!, also i change some things to the apply_surface function so not to loading the image each time i press a key and also made some new maps for the game, here some screenshots:
o and in case you didnt notice... visual studio!
soon i am going to be uploading a video of the menu functionality, these is not the final product, it is made in paint
o and in case you didnt notice... visual studio!
soon i am going to be uploading a video of the menu functionality, these is not the final product, it is made in paint
- Light-Dark
- Dreamcast Developer
- Posts: 307
- Joined: Sun Mar 13, 2011 7:57 pm
- Current Project: 2D RPG & NES Platformer
- Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
- Programming Language of Choice: C/++
- Location: Canada
Re: Garbe Engine/Editor C++/SDL
Noooooo why are you creating surfaces for each direction D:, you should nicely clip a entire sheet, im positive theres a lazyfoo tutorial on it :P, hell im 100% sure in the TileSyste.cpp source file in my SMB engine theres a 32x32 tile clipper(you can make adjustments to dimensions).
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Garbe Engine/Editor C++/SDL
I guess it's the easiest way to start up and learn. Tilesheets/spritesheets can be somehow hard to get the hang on when you are having tons of other stuff to learn.Light-Dark wrote:Noooooo why are you creating surfaces for each direction D:, you should nicely clip a entire sheet, im positive theres a lazyfoo tutorial on it :P, hell im 100% sure in the TileSyste.cpp source file in my SMB engine theres a 32x32 tile clipper(you can make adjustments to dimensions).
But surely, the must make a clipping system sooner or later.
- GroundUpEngine
- Chaos Rift Devotee
- Posts: 835
- Joined: Sun Nov 08, 2009 2:01 pm
- Current Project: mixture
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: UK
Re: Garbe Engine/Editor C++/SDL
Cool project, bit like the early version of elysian shadows!
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Garbe Engine/Editor C++/SDL
thanks i am working now in the inventory system so i can grab and drop items, add them to the inventory etc.. a video comming tonight to show the inventory!GroundUpEngine wrote:Cool project, bit like the early version of elysian shadows!