Blade Brothers Engine: Creating my first 2D Game Engine

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
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

Well, each tile is just represented as one value, for example 33 for an ID.
The render function calculates different SDL_Rects for the source rectangle and Vector2s for position.
I was thinking making an array of SDL_Rects and Vector2s and when the map loads it would calculate them once and pass through all the rects and vectors at render time and not have to worry about re-calculating. One thing, however, is that the Toolkit would need to recheck every time a new auto-tile is placed.
Each tile might consist of just 1 rect or possibly 2, 3 or 4 depending on what it is.

Do you think this would be the appropriate approach?
There's no place like ~/
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by MrDeathNote »

LeonBlade wrote:Well, each tile is just represented as one value, for example 33 for an ID.
The render function calculates different SDL_Rects for the source rectangle and Vector2s for position.
I was thinking making an array of SDL_Rects and Vector2s and when the map loads it would calculate them once and pass through all the rects and vectors at render time and not have to worry about re-calculating. One thing, however, is that the Toolkit would need to recheck every time a new auto-tile is placed.
Each tile might consist of just 1 rect or possibly 2, 3 or 4 depending on what it is.

Do you think this would be the appropriate approach?
That's very appropriate, isn't that the entire point of having a toolkit? It's static content, if you calculate it once, you don't ever want to do that again. The idea is that you calculate your autotiles in the toolkit(which helps level development). Then you load that static content at runtime. The engine should never have to worry about caluculating that. The more you can abstract from the engine at runtime, the better.
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

MrDeathNote wrote:That's very appropriate, isn't that the entire point of having a toolkit? It's static content, if you calculate it once, you don't ever want to do that again. The idea is that you calculate your autotiles in the toolkit(which helps level development). Then you load that static content at runtime. The engine should never have to worry about caluculating that. The more you can abstract from the engine at runtime, the better.
Thank you, I'm glad to see I'm on the right track then! ;)
Very much appreciated, once I get some time I should optimize all of this.
There's no place like ~/
User avatar
xx6heartless6xx
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Wed Feb 02, 2011 9:42 pm

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by xx6heartless6xx »

Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
level.png (65.24 KiB) Viewed 3213 times
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
There's no place like ~/
User avatar
xx6heartless6xx
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Wed Feb 02, 2011 9:42 pm

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by xx6heartless6xx »

LeonBlade wrote:
xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
I used to use SDL for rendering before I moved over to Qt but now I want to use Qt's functions. I never really used OpenGl.
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
I used to use SDL for rendering before I moved over to Qt but now I want to use Qt's functions. I never really used OpenGl.
I suggest looking into learning OpenGL before anything, it's not as complicated as you first might think, trust me. Once you're confident, try learning about QGLWidgets in QT and also learning about the sharedWidget property in the QGLWidget constructor to pass things back and forth between widgets so you can make the map editor work properly without loads of run time errors with white texture and loads of other problems.

If you need to ask any questions, feel free to and I'll try to help the best I can. I still need to remake my Toolkit again as I keep striving towards a very open OO design and I keep starting over not feeling satisfied.
There's no place like ~/
User avatar
xx6heartless6xx
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Wed Feb 02, 2011 9:42 pm

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by xx6heartless6xx »

LeonBlade wrote:
xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
I used to use SDL for rendering before I moved over to Qt but now I want to use Qt's functions. I never really used OpenGl.
I suggest looking into learning OpenGL before anything, it's not as complicated as you first might think, trust me. Once you're confident, try learning about QGLWidgets in QT and also learning about the sharedWidget property in the QGLWidget constructor to pass things back and forth between widgets so you can make the map editor work properly without loads of run time errors with white texture and loads of other problems.

If you need to ask any questions, feel free to and I'll try to help the best I can. I still need to remake my Toolkit again as I keep striving towards a very open OO design and I keep starting over not feeling satisfied.
Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
I used to use SDL for rendering before I moved over to Qt but now I want to use Qt's functions. I never really used OpenGl.
I suggest looking into learning OpenGL before anything, it's not as complicated as you first might think, trust me. Once you're confident, try learning about QGLWidgets in QT and also learning about the sharedWidget property in the QGLWidget constructor to pass things back and forth between widgets so you can make the map editor work properly without loads of run time errors with white texture and loads of other problems.

If you need to ask any questions, feel free to and I'll try to help the best I can. I still need to remake my Toolkit again as I keep striving towards a very open OO design and I keep starting over not feeling satisfied.
Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?
It depends on what you mean exactly, you would be going from what to what? What are you using Qt for?
There's no place like ~/
User avatar
xx6heartless6xx
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Wed Feb 02, 2011 9:42 pm

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by xx6heartless6xx »

LeonBlade wrote:
xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
I used to use SDL for rendering before I moved over to Qt but now I want to use Qt's functions. I never really used OpenGl.
I suggest looking into learning OpenGL before anything, it's not as complicated as you first might think, trust me. Once you're confident, try learning about QGLWidgets in QT and also learning about the sharedWidget property in the QGLWidget constructor to pass things back and forth between widgets so you can make the map editor work properly without loads of run time errors with white texture and loads of other problems.

If you need to ask any questions, feel free to and I'll try to help the best I can. I still need to remake my Toolkit again as I keep striving towards a very open OO design and I keep starting over not feeling satisfied.
Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?
It depends on what you mean exactly, you would be going from what to what? What are you using Qt for?
I'm using Qt because I want to create a level editor where someone else can use it to design levels without having to touch code or know how to code. The UI of your level editor is almost exactly what I am trying to create. The difficulty I am having is I am not sure how to be able to display the current map I am editing on the right side in one widget and on the left showing the tilesheet so I can switch between the current tile selected.
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:
LeonBlade wrote:
xx6heartless6xx wrote:Hey Leon, your level editor looks really cool and I want to make mine like it. I was wondering how you display your level on the screen in Qt. I have my layout like this in the image and want to display the level in the large white area in the center of my program.
level.png
My level editor also reads from a .map file where each tile has an id and it reads from the .map file and shows the tile it should. I'll post code if I'm not being clear enough. Thanks.
What are you rendering your map with, or should I say what do you want to render it with? I use OpenGL, I assume you're using that?
I used to use SDL for rendering before I moved over to Qt but now I want to use Qt's functions. I never really used OpenGl.
I suggest looking into learning OpenGL before anything, it's not as complicated as you first might think, trust me. Once you're confident, try learning about QGLWidgets in QT and also learning about the sharedWidget property in the QGLWidget constructor to pass things back and forth between widgets so you can make the map editor work properly without loads of run time errors with white texture and loads of other problems.

If you need to ask any questions, feel free to and I'll try to help the best I can. I still need to remake my Toolkit again as I keep striving towards a very open OO design and I keep starting over not feeling satisfied.
Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?
It depends on what you mean exactly, you would be going from what to what? What are you using Qt for?
I'm using Qt because I want to create a level editor where someone else can use it to design levels without having to touch code or know how to code. The UI of your level editor is almost exactly what I am trying to create. The difficulty I am having is I am not sure how to be able to display the current map I am editing on the right side in one widget and on the left showing the tilesheet so I can switch between the current tile selected.
That's the problems I was having for a while ;) You should check out this video I made.

Watch around 9:00 or so.
There's no place like ~/
User avatar
xx6heartless6xx
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Wed Feb 02, 2011 9:42 pm

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by xx6heartless6xx »

LeonBlade wrote:
xx6heartless6xx wrote: I'm using Qt because I want to create a level editor where someone else can use it to design levels without having to touch code or know how to code. The UI of your level editor is almost exactly what I am trying to create. The difficulty I am having is I am not sure how to be able to display the current map I am editing on the right side in one widget and on the left showing the tilesheet so I can switch between the current tile selected.
That's the problems I was having for a while ;) You should check out this video I made.

Watch around 9:00 or so.
Thanks for the help Leonblade, I'm still finding my way around opengl but thanks for pointing me in the right direction. Anyway your engine is looking pretty nice. Keep up the hard work and keep up us updated here and on the youtubes.
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: Blade Brothers Engine: Creating my first 2D Game Engine

Post by superLED »

What's the point of that post? it's just a quote x)

Edit: This post doesn't count anymore since a mod cleaned up a bit on the quotes :p
Last edited by superLED on Mon Sep 05, 2011 10:03 am, edited 1 time in total.
User avatar
koolgraph
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 18
Joined: Thu Feb 17, 2011 1:49 am
Current Project: A-RPG (MMO ?) Engine
Favorite Gaming Platforms: SNES, GameBoy, PS3, PC
Programming Language of Choice: C++/#

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by koolgraph »

he just put this
Thanks for the help Leonblade, I'm still finding my way around opengl but thanks for pointing me in the right direction. Anyway your engine is looking pretty nice. Keep up the hard work and keep up us updated here and on the youtubes
in leon's quote
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Post by LeonBlade »

koolgraph wrote:he just put this
Thanks for the help Leonblade, I'm still finding my way around opengl but thanks for pointing me in the right direction. Anyway your engine is looking pretty nice. Keep up the hard work and keep up us updated here and on the youtubes
in leon's quote
Lol yeah I noticed :lol:
There's no place like ~/
Post Reply