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 »

REBIRTH

Hello everyone, it's been a long time.

http://www.youtube.com/watch?v=rcVeEFJk148

Please take note before watching, I'm redoing the way I handle Lua thanks to short and GyroVorbis as it appears I fucked up completely on how I'm going about this! So try not to facepalm to hard at my failures.
There's no place like ~/
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: Blade Brothers Engine: Creating my first 2D Game Engine

Post by GroundUpEngine »

Nice work man, good to see this project again! I like all the control used via Lua ;)
But I also agree with Falco, don't let Lua do everything... find a balance! :)

Instead of std::vector or whatever, for the first entity indexed on the stack.

Code: Select all

Entity::EntityStack[0]...
Try std::map, with the first player on the stack. I use this from time to time..

Code: Select all

Entity::EntityStack["player1"]...

// So beforehand you can ->
Entity* ent = new Player();
Entity::EntityStack["player1"] = ent;
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 »

Here is a link back to the question I posted earlier on Lua and C++ balance.
http://elysianshadows.com/phpBB3/viewto ... =13&t=6014

Again, thanks to short and GyroVorbis for putting me in the right direction as to how I should go about implementing Lua.
I'm pretty sure some of my Lua functions that are overloaded are in the right place, but the way I'm handling everything else is terribly terribly wrong.

I'll be creating a small little project (terminal based) for Lua and a dialog system so that I can get a better understanding as to what I need to be doing.

If you'd like to check out my Engine thus far, feel free to clone it like so:

Code: Select all

git clone git://github.com/LeonBlade/Blade-Brothers-Engine.git
Please be warned though, the Lua implementation again like I said is awful, and I'll be pushing changes to it later on in the day.
If you would like to help me tackle my Toolkit issues, that is in the git repo and I'm using Qt 4.7. Feel free to check it out, and let me know if you have any issues running it as the Run path needs to be set to the right spot otherwise it fails.
GroundUpEngine wrote:Nice work man, good to see this project again! I like all the control used via Lua ;)

Instead of std::vector or whatever, for the first entity indexed on the stack.

Code: Select all

Entity::EntityStack[0]...
Try std::map, with the first player on the stack. I use this from time to time..

Code: Select all

Entity::EntityStack["player1"]...

// So beforehand you can ->
Entity* ent = new Player();
Entity::EntityStack["player1"] = ent;
Thanks a lot, man. It's projects like yours and others out there that motivated me back into working.
I'll be sorting out how I should go about that pretty soon, I have to do some revisions as to how I'm going about all this Lua nonsense.
There's no place like ~/
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 »


Changes are also pushed to the repo, not sure if everything will work out of the box, but it should work just fine.
Toolkit is in the stages of being remade, so it wont work what so ever, Engine should compile fine platform issues aside.
Still need to address the scrolling issue, but that will come later.
There's no place like ~/
User avatar
bnpph
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 75
Joined: Thu Mar 10, 2011 12:30 pm

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

Post by bnpph »

To check if snapped to grid just use modulo, and split up movements into numbers divisible by grid number.

You are unable to move outside the map in some places because I'm assuming that you are accessing out of bounds data.
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 »

bnpph wrote:To check if snapped to grid just use modulo, and split up movements into numbers divisible by grid number.

You are unable to move outside the map in some places because I'm assuming that you are accessing out of bounds data.
I already have grid snapping working just fine along with multiple other things like multiple tile selection etc.
The problem is the widget doesn't scroll and it offsets everything.

And the player being stopped by the map doesn't make any sense, there are no bounds of data in this case just a number telling where OpenGL needs to render a quad.
There's no place like ~/
User avatar
bnpph
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 75
Joined: Thu Mar 10, 2011 12:30 pm

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

Post by bnpph »

I already have grid snapping working just fine along with multiple other things like multiple tile selection etc.
Oh, I guess I saw that from an outdated video - the new one looks good!
The problem is the widget doesn't scroll and it offsets everything.
Why not translate the GL matrix to match the scroll amount?
And the player being stopped by the map doesn't make any sense, there are no bounds of data in this case just a number telling where OpenGL needs to render a quad.
That's strange. Does it happen without the grid snapping code?
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 »

bnpph wrote:
I already have grid snapping working just fine along with multiple other things like multiple tile selection etc.
Oh, I guess I saw that from an outdated video - the new one looks good!
The problem is the widget doesn't scroll and it offsets everything.
Why not translate the GL matrix to match the scroll amount?
And the player being stopped by the map doesn't make any sense, there are no bounds of data in this case just a number telling where OpenGL needs to render a quad.
That's strange. Does it happen without the grid snapping code?
Ha, yeah it's fine man. I'm hoping to put the selection back in because I started from scratch AGAIN. It was really rough last time, so hopefully I can make it a lot better.

And yes! I think that's my problem... I just don't ever remember having to do it before, you know? So I was confused... hopefully I'll get that issue solved shortly. I'm adding just straight QGLWidgets to a QTabWidget so I need to change a few chunks of code to make the change work to add the QScrollArea back in.

And yeah, I'm not really sure why that happened... I haven't looked at it since then actually. I should put in the collision of the map edges anyways, I think I'll do that next.

Thanks for the reply by the way, very appreciated!
There's no place like ~/
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

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

Post by THe Floating Brain »

Very nice work :-)
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
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 »

THe Floating Brain wrote:Very nice work :-)
Thanks man!


Finally got auto-tiles working! Next will be making them work better and then start back on the Toolkit... again...
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 »

So are you calculating the autotiles every time they're rendered? Why not do your calculations and then edit the actual layer so that once you've edited it it'll persist. In fact you don't even need them in the engine at all, why not just have the calculations performed in the editor then just have your tile layout stored the same as normal. I might be missing something here since i'm in work and i'm trying to look productive while watching this ;)
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
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

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

Post by XianForce »

MrDeathNote wrote:So are you calculating the autotiles every time they're rendered? Why not do your calculations and then edit the actual layer so that once you've edited it it'll persist. In fact you don't even need them in the engine at all, why not just have the calculations performed in the editor then just have your tile layout stored the same as normal. I might be missing something here since i'm in work and i'm trying to look productive while watching this ;)
Well, all the calculations can't be stored solely in the editor, because he's laying tiles in the actual engine, right? But editing the actual tile layer is definitely a good idea imo.
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

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

Post by Ginto8 »

Well, one could actually have all the autotile calculations be done when you change tiles rather than when you render them. That would not only save CPU time, it would also make your life at least a little easier.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
bnpph
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 75
Joined: Thu Mar 10, 2011 12:30 pm

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

Post by bnpph »

Ginto8 wrote:Well, one could actually have all the autotile calculations be done when you change tiles rather than when you render them. That would not only save CPU time, it would also make your life at least a little easier.
Yeah, you only need to update the 8 adjacent tiles of the one that has been changed.
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 »

Ginto8 wrote:Well, one could actually have all the autotile calculations be done when you change tiles rather than when you render them. That would not only save CPU time, it would also make your life at least a little easier.
Isn't that what I said?
XianForce wrote: Well, all the calculations can't be stored solely in the editor, because he's laying tiles in the actual engine, right?
He's loading the file from the editor, if he's going to edit the layer he could do that in the editor. The visual effect would be the same in the engine since he would be loading the same data that he's calulating at runtime now. This is all assuming that he doesn't want to edit the level at runtime in the engine, if he does then I take back what I just said.
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
Post Reply