Page 1 of 2

Garbe Engine/Editor C++/SDL

Posted: Tue Feb 14, 2012 11:40 pm
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:

Re: Garber Engine/Editor C++/SDL

Posted: Wed Feb 15, 2012 6:23 am
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 ;)

Re: Garber Engine/Editor C++/SDL

Posted: Wed Feb 15, 2012 9:39 am
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. ;)

Re: Garber Engine/Editor C++/SDL

Posted: Wed Feb 15, 2012 10:12 am
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

Re: Garbe Engine/Editor C++/SDL

Posted: Wed Feb 15, 2012 5:07 pm
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). ;)

Re: Garbe Engine/Editor C++/SDL

Posted: Wed Feb 15, 2012 5:19 pm
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?"

Re: Garbe Engine/Editor C++/SDL

Posted: Thu Feb 16, 2012 12:07 am
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 ;)

Re: Garbe Engine/Editor C++/SDL

Posted: Thu Feb 16, 2012 12:18 am
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 :)

Re: Garbe Engine/Editor C++/SDL

Posted: Thu Feb 16, 2012 7:01 am
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.

Re: Garbe Engine/Editor C++/SDL

Posted: Thu Feb 16, 2012 11:24 am
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 :)

Re: Garbe Engine/Editor C++/SDL

Posted: Fri Feb 17, 2012 7:40 pm
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:

Re: Garbe Engine/Editor C++/SDL

Posted: Fri Feb 17, 2012 8:40 pm
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).

Re: Garbe Engine/Editor C++/SDL

Posted: Sun Feb 19, 2012 7:21 am
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.

Re: Garbe Engine/Editor C++/SDL

Posted: Sun Feb 19, 2012 1:17 pm
by GroundUpEngine
Cool project, bit like the early version of elysian shadows!

Re: Garbe Engine/Editor C++/SDL

Posted: Sun Feb 19, 2012 1:33 pm
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! ;)