Shadows of Power - 2d RPG made in SDL & C++

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:

Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

Hello to all of you guys! This is my first SERIOUS attempt to make a 2d rpg game made in SDL and C++ :) i started working on the engine 2 weeks ago and 3 weeks on the level editor.

A video showing both Engine and Level editor!



Engine:

The engine currently supports:
- Tile maps with multiple layers
- Basic physics(Collision, Acceleration etc..)
- Players lol
- Npc's
- Camera system
- Simple AI (for the npc's)
- Lua scripting for the level and objects
- Objects

Some Images!

Image

Image

All the objects have "attached" a lua script, so when the player use them it runs the current object script, im working on Separating axis theorem for collision as well :mrgreen:

Level Editor:

The level editor has a simple GUI made in sdl, im going to be using Qt in the future :)
it supports 2 layers but im working on a 3'rd one now!

You can download a simple demo of the engine so far!||

http://www.mediafire.com/?doscy6wryz8gzdf


Hope you guys enjoy and i would like to hear your thought about the engine and the level editor, if you have any suggetion or question feel free to ask! ;)

And thanks to all the ES team, they got me into programming, and are my source of inspiration to continue working on my game ;)
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: Shadows of Power - 2d RPG made in SDL & C++

Post by dandymcgee »

Great work man. Though tech demos and engines are cool I'd love to see this turn into a playable game.
I hope you find the motivation and desire to bring it to something you can call a final product.
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: Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

dandymcgee wrote:Great work man. Though tech demos and engines are cool I'd love to see this turn into a playable game.
I hope you find the motivation and desire to bring it to something you can call a final product.
Yes, i would love that to, thats actually the most difficult part :| the demo was only showing some of the engine functionality, but my new plan is to release a "game" demo, just 1 - 2 quest's to see how the engine works on an actual game :)
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by Falco Girgis »

Looks great, dude!
lalacomun wrote:All the objects have "attached" a lua script, so when the player use them it runs the current object script, im working on Separating axis theorem for collision as well
Out of curiosity, how do you plan to render oriented objects? SDL's rendering is software-based, so you don't have GPU acceleration to rotate your images. There are software-based rotation and scaling algorithms for SDL, but they are going to be extremely slow and CPU heavy.

Your best bet is really to move to OpenGL if you plan to start transforming objects like that.
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: Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

Falco Girgis wrote:Looks great, dude!
lalacomun wrote:All the objects have "attached" a lua script, so when the player use them it runs the current object script, im working on Separating axis theorem for collision as well
Out of curiosity, how do you plan to render oriented objects? SDL's rendering is software-based, so you don't have GPU acceleration to rotate your images. There are software-based rotation and scaling algorithms for SDL, but they are going to be extremely slow and CPU heavy.

Your best bet is really to move to OpenGL if you plan to start transforming objects like that.
I was planning on using SDL_gfx, that allows me to rotate and scale surfaces, but yes, is slow as hell, so i think im gonna be using OpenGL :) and thanks for the feedback!
Image
User avatar
DistortedLance
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 26
Joined: Fri Jul 22, 2011 12:36 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by DistortedLance »

SDL_gfx is indeed incredibly slow, and with SDL 1.2 (which I see you're using), only multiples of 90 degree rotations have acceptable performance.

SDL 2.0 has hardware accelerated surfaces, though (called SDL_Texture; SDL_SWSURFACE, SDL_HWSURFACE, etc. are deprecated, I believe). SDL_Textures can be blit with a rotation applied to them, or just rendered normally.
//Renders a hardware-accelerated texture to the destination renderer
int SDL_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture,
     const SDL_Rect* srcrect, const SDL_Rect* dstrect);

//Renders a hardware-accelerated texture with optional rotation and/or flipping applied
int SDL_RenderCopyEx(SDL_Renderer* renderer, SDL_Texture* texture,
     const SDL_Rect* srcrect, const SDL_Rect* dstrect,
     const double angle, const SDL_Point* center,
     const SDL_RendererFlip flip);
It's not too different from SDL 1.2, with the main differences being that you now have SDL_Window and SDL_Renderer instead of something like SDL_Surface* screen = SDL_SetVideoMode() (which is also deprecated).
SDL_Window* window = SDL_CreateWindow("My Game", 0, 0, 640, 480, SDL_WINDOW_SHOWN);
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

SDL_Surface* surface = IMG_Load("MyLovelyImage.png");
SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_FreeSurface(surface);

SDL_Point center = {16, 16};
SDL_RenderCopyEx(renderer, texture, 0, 0, 45, &center, SDL_FLIP_HORIZONTAL);
SDL_RenderPresent(renderer);
Considering SDL_Textures are solely primarily (they might exist outside of hardware memory if you're out of it) hardware textures, I would imagine that this is a hardware-accelerated process and wouldn't be as painfully slow as SDL_gfx. I haven't run any tests to see if it's significantly faster or close enough to OpenGL (I'm too lazy to compile the latest version of SDL_image and can't run OpenGL. Go me), although you might find this to be acceptable compared to switching completely to OpenGL rendering. It's another option if your hardware can't handle the newer versions of OpenGL, at least (Intel, you suck).
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by Falco Girgis »

I would imagine that should probably be pretty fast. Do they not also have a way to scale it?
User avatar
DistortedLance
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 26
Joined: Fri Jul 22, 2011 12:36 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by DistortedLance »

Scaling is actually done automatically. The dimensions of the destination rect are used to scale. If you have a 32x32 image with a destination rect of (0, 0, 320, 32), the image will be stretched by a factor of 10 horizontally. This occurs before any rotation/flipping, so if you specify a rotation and a destination rect, you see the scaled THEN rotated image. It's still developmental, but it's pretty neat stuff nonetheless.

EDIT: A quick test using some random wallpapers I have showed that flipping and rotating are pretty much instantaneous (software-rotating the same images took at least 2 seconds before the image was finished rotating/flipping).
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: Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

DistortedLance wrote:Scaling is actually done automatically. The dimensions of the destination rect are used to scale. If you have a 32x32 image with a destination rect of (0, 0, 320, 32), the image will be stretched by a factor of 10 horizontally. This occurs before any rotation/flipping, so if you specify a rotation and a destination rect, you see the scaled THEN rotated image. It's still developmental, but it's pretty neat stuff nonetheless.

EDIT: A quick test using some random wallpapers I have showed that flipping and rotating are pretty much instantaneous (software-rotating the same images took at least 2 seconds before the image was finished rotating/flipping).
I think i will give SDL 2.0 a try, are the bin files available?? i only see the merccurial repository aveilable :|
Image
User avatar
DistortedLance
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 26
Joined: Fri Jul 22, 2011 12:36 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by DistortedLance »

They have the latest versions of the SDL source in a .zip file on the website. There aren't any pre-compiled files available, but they included the project files for Visual Studio, XCode, etc. If you aren't using Visual Studio...DOO ED :P To build, I literally just had to open up their solution/project files and hit Build. They don't have SDL 2.0 versions for SDL_image, SDL_ttf, etc. available as archives, so you need to clone their Mercurial repository if you want to use those. I could also send you compiled libraries for Windows if you can't get things to work.

Anyway, the game's looking nice. Are you going for a Final Fantasy style 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: Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

DistortedLance wrote:They have the latest versions of the SDL source in a .zip file on the website. There aren't any pre-compiled files available, but they included the project files for Visual Studio, XCode, etc. If you aren't using Visual Studio...DOO ED :P To build, I literally just had to open up their solution/project files and hit Build. They don't have SDL 2.0 versions for SDL_image, SDL_ttf, etc. available as archives, so you need to clone their Mercurial repository if you want to use those. I could also send you compiled libraries for Windows if you can't get things to work.

Anyway, the game's looking nice. Are you going for a Final Fantasy style game? ^_^ ^_^ ^_^
Thanks! ;) , actually i want the game to be a bit more like Chrono trigger gameplay and Secret of mana combat system, you know a bit more "dynamic" 8-)
Image
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by bbguimaraes »

Thought I'd make a developer happy today: your game runs on linux/wine! Screenshot attached.

Oh, and I really laughed when I saw Luigi didn't animate when walking up or down. I remember I did the same thing back when I was first messing with movement animations.

Keep up the good work!
Attachments
2013-01-08-15-01-47.png
(244.89 KiB) Not downloaded yet
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: Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

bbguimaraes wrote:Thought I'd make a developer happy today: your game runs on linux/wine! Screenshot attached.

Oh, and I really laughed when I saw Luigi didn't animate when walking up or down. I remember I did the same thing back when I was first messing with movement animations.

Keep up the good work!
Holy Shit! Thanks! you just made my day! :mrgreen: :mrgreen:
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: Shadows of Power - 2d RPG made in SDL & C++

Post by lalacomun »

Well, this is the first update of the game! and no, the project is not dead, im just to lazy to do a vid and update the post, that actual content of the vid was made about a month ago :lol: im working on the battle system and the quest system now so i can have a playable rpg demo someday soon! you will see all that in the vid.

Things implemented on the vid:

- OpenGL rendering!! :mrgreen:
- Improved items (exmine them)
- Added a health and a stamina bar
- Added an npc dialogue box
- Fading text effect when talking to an npc

Thing im working on:

- Battle system
- Quest system
- DC port, its almost done, im working on the input for the controller now
- Inventory system :p
- Separating axis theorem for rotated textures collision

The video:



Some images:

Image

Image

Well, thats it, what do you guys think?? please feel free to criticize!
Image
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Shadows of Power - 2d RPG made in SDL & C++

Post by bbguimaraes »

Looking nice, specially the transparent menus (programmer's only know how much you struggle to get it right the first time). If I would suggest something: a little more contrast between the text and the text box and aligning the bars with the text box. Otherwise, good job!
Post Reply