Garbe Engine/Editor C++/SDL

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

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! ;)

Image


Image


Image

Image

Image



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!!! :shock:


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 :cry:
Last edited by lalacomun on Wed Feb 15, 2012 2:09 pm, edited 1 time in total.
Image
User avatar
Light-Dark
Dreamcast Developer
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

Post by Light-Dark »

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
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: Garber Engine/Editor C++/SDL

Post by dandymcgee »

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. ;)
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

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 ;)
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!

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. ;)
Hell yes!! much better, devcpp was shit compared to visual ! thank you !
i just downloaded and instal SDL thanks alot
Image
EddieRingle
Chaos Rift Cool Newbie
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

Post by EddieRingle »

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). ;)
User avatar
superLED
Chaos Rift Junior
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

Post by superLED »

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). ;)
One of my early mistakes... "What the fuck, 1 000 000 kb memory usage for this shitty small game?"
User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

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). ;)
No, because the function free the previous surface each time a new key is realesed ;)
Image
User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

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). ;)
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)
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 ;)

superLED wrote:
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). ;)
One of my early mistakes... "What the fuck, 1 000 000 kb memory usage for this shitty small game?"
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 runs :)
Image
User avatar
superLED
Chaos Rift Junior
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

Post by superLED »

lalacomun wrote:
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). ;)
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)
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 ;)
But when you already have loaded the image once to memory, why remove it and load it back in again?
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);
}
I wrote this code fast and dirty, just so it could be easily understandable. But I hope you got the drill.
User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

superLED wrote:
lalacomun wrote:
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). ;)
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)
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 ;)
But when you already have loaded the image once to memory, why remove it and load it back in again?
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);
}
I wrote this code fast and dirty, just so it could be easily understandable. But I hope you got the drill.
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 color :)
Image
User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

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:



Image



Image



Image



Image




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 :lol:
Image
User avatar
Light-Dark
Dreamcast Developer
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

Post by Light-Dark »

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
Image
User avatar
superLED
Chaos Rift Junior
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

Post by superLED »

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).
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.
But surely, the must make a clipping system sooner or later.
User avatar
GroundUpEngine
Chaos Rift Devotee
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

Post by GroundUpEngine »

Cool project, bit like the early version of elysian shadows!
User avatar
lalacomun
VS Setup Wizard
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

Post by lalacomun »

GroundUpEngine wrote:Cool project, bit like the early version of elysian shadows!
8-) 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! ;)
Image
Post Reply