Blade Brothers Engine: Creating my first 2D Game Engine
Moderator: PC Supremacists
- LeonBlade
- 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
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?
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 ~/
- MrDeathNote
- 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
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.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?
http://www.youtube.com/user/MrDeathNote1988
"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
"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
- LeonBlade
- 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
Thank you, I'm glad to see I'm on the right track then!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.
Very much appreciated, once I get some time I should optimize all of this.
There's no place like ~/
- xx6heartless6xx
- Chaos Rift Cool Newbie
- Posts: 80
- Joined: Wed Feb 02, 2011 9:42 pm
Re: Blade Brothers Engine: Creating my first 2D Game Engine
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.
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.- LeonBlade
- 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
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?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.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.
There's no place like ~/
- xx6heartless6xx
- Chaos Rift Cool Newbie
- Posts: 80
- Joined: Wed Feb 02, 2011 9:42 pm
Re: Blade Brothers Engine: Creating my first 2D Game Engine
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.LeonBlade wrote: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?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.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.
- LeonBlade
- 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
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.xx6heartless6xx wrote: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.LeonBlade wrote: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?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.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.
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 ~/
- xx6heartless6xx
- Chaos Rift Cool Newbie
- Posts: 80
- Joined: Wed Feb 02, 2011 9:42 pm
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?LeonBlade wrote: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.xx6heartless6xx wrote: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.LeonBlade wrote: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?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.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.
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.
- LeonBlade
- 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
It depends on what you mean exactly, you would be going from what to what? What are you using Qt for?xx6heartless6xx wrote:Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?LeonBlade wrote: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.xx6heartless6xx wrote: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.LeonBlade wrote: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?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.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.
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 ~/
- xx6heartless6xx
- Chaos Rift Cool Newbie
- Posts: 80
- Joined: Wed Feb 02, 2011 9:42 pm
Re: Blade Brothers Engine: Creating my first 2D Game Engine
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.LeonBlade wrote:It depends on what you mean exactly, you would be going from what to what? What are you using Qt for?xx6heartless6xx wrote:Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?LeonBlade wrote: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.xx6heartless6xx wrote: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.LeonBlade wrote: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?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.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.
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.
- LeonBlade
- 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
That's the problems I was having for a while You should check out this video I made.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.LeonBlade wrote:It depends on what you mean exactly, you would be going from what to what? What are you using Qt for?xx6heartless6xx wrote:Rendering with Opengl in Qt then is simple? Do you need to change any of your Opengl code to work in Qt?LeonBlade wrote: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.xx6heartless6xx wrote: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.LeonBlade wrote: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?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.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.
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.
Watch around 9:00 or so.
There's no place like ~/
- xx6heartless6xx
- Chaos Rift Cool Newbie
- Posts: 80
- Joined: Wed Feb 02, 2011 9:42 pm
Re: Blade Brothers Engine: Creating my first 2D Game Engine
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.LeonBlade wrote:That's the problems I was having for a while You should check out this video I made.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.
Watch around 9:00 or so.
- 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: Blade Brothers Engine: Creating my first 2D Game Engine
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
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.
- koolgraph
- 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
he just put this
in leon's quoteThanks 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
- LeonBlade
- 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
Lol yeah I noticedkoolgraph wrote:he just put thisin leon's quoteThanks 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
There's no place like ~/