Page 14 of 19

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

Posted: Sun Aug 08, 2010 1:08 pm
by dandymcgee
MrDeathNote wrote:
LeonBlade wrote:I fucking dicked around with trying to set the current working directory in Qt for fucking an hour or two using all this stupid shit... (mind you I'm tired right now)
And out of god damn know where I check the project settings and it's in a fucking dialog...

I felt like such a fucking idiot :nono:
Anyways, I'm going to start getting the game to run in the window (just to test), then the editor!
Also, I got SDL to run in Qt finally too :) but I'm glad I'm using them both together though.

Also, today is my birthday... so I expect everyone to get me something when I wake up ;)
Thanks everyone for your help thus far, it's very much appreciated. <3
Just wondering, but why do you need to use SDL with Qt?
Audio maybe?

Happy Birthday Leon. Hope you get something nice from someone (cus you ain't getting it from me). ;)

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

Posted: Sun Aug 08, 2010 5:07 pm
by LeonBlade
Hahaha, thank you guys.
And thank you for the cat/cake :) haha.

Also, I'm using SDL for events just because it was the core of my engine when I started making it.
If you guys suggest I use something else, let me know!

OH using SDL in Qt haha I read that wrong...
Well, I wont actually be using it >_> but it's used currently in my animation system which I need to swap it out for something else.

Code: Select all

if (oldTime + frameRate > SDL_GetTicks())
	return; // not ready for next frame
	
oldTime = SDL_GetTicks();
currentFrame += frameIncrease;
Tell me if you know something I should use instead!
Sorry if these seems like noob-ish questions to you guys, haha. I've never used OpenGL or Qt really before... :roll:

I'll be getting the engine going inside Qt now, let me know if you have anymore suggestions.

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

Posted: Sun Aug 08, 2010 7:38 pm
by LeonBlade
BAH, something's wrong... every so often the map will load in, other times it doesn't ):
I have no idea what's wrong at all... and it seems that my player wont move no matter what.
I try setting his position and it doesn't change on the screen.

I think I've come to the conclusion that my screen isn't updating!

BUT WAIT...
I realize lol I didn't call the updateGL() function >_> whoops...
So I do and BAM shit works :)

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

Posted: Mon Aug 09, 2010 5:14 am
by MrDeathNote
LeonBlade wrote:BAH, something's wrong... every so often the map will load in, other times it doesn't ):
I have no idea what's wrong at all... and it seems that my player wont move no matter what.
I try setting his position and it doesn't change on the screen.

I think I've come to the conclusion that my screen isn't updating!

BUT WAIT...
I realize lol I didn't call the updateGL() function >_> whoops...
So I do and BAM shit works :)
Lol i've done that so many times, and every time it gets a WTF from me. As regards SDL, everything you need can be handled by Qt itself(probably), eg for the example you gave you could use a QTimer to manage framerate.

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

Posted: Mon Aug 09, 2010 6:02 am
by LeonBlade
Here's my update on my Editor.
Image
So far the scroll bars... don't actually work >_> you'll see that the map is being drawn from the 0,0 coords which I need to fix... again...
However! I've added a new little feature that will come in play for later that lets you set the tileset!
Image
Then I choose my tileset and there you go...
Image
This one is just another color haha, but you get the idea...

Sorry not much of really ANYTHING was done here... I was trying to get scrollarea working but that wasn't so I think I'll get these scrollbars working by "hand".
Work ends at 4:30 AM so that doesn't give me a lot of room to play other than the few minutes that are here and there during work.

Here are my goals for tomorrow:
1. Get the map to render from the top left ;)
2. Hook up the scrollbars to scroll the map, the max being the size of the map so there's no overflow of black on the outside like you see now.
3. Get the mouse events hooked up so I can click a tile to change it
4. Add a dock (the floating little panels) for the tileset you have loaded.
5. Get a "New Map" dialog working
6. Saving & Loading maps

And maybe something else after all that... well I'm off to bed!

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

Posted: Mon Aug 09, 2010 6:27 pm
by eatcomics
good update, in my books if there's screenies, its good :D and keep it up

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

Posted: Tue Aug 10, 2010 2:31 am
by Milch
Cool, screenies :3
Looks nice so far - keep up the good work!

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

Posted: Tue Aug 10, 2010 8:55 am
by LeonBlade
Well... my list of goals didn't get achieved yesterday, but today they will!
I had to get over a big UI hump plus work prevented me from doing much on it, but I have today and tomorrow off!

So here's my current status.
So far, I've added the scrollbars and they work like how I originally wanted them :)
And some small map properties have been added.

BUT, I've run into an error :(
Let me take you through the steps of resizing your map...

Here is my editor (fancy eh? lolnonotreally)
Image

Okay, so let's go to map properties! (oops should probably change the title heh)
Image

And lets resize it!
Image
Uh... oh god... what the shit?

Basically what happens is, my tiles get shifted all around the map because they're just layed out in order from top-left to bottom-right (like how you would read) and it goes down each line each time. So basically my tiles get moved around...

So there are a few ways I can get around this.
1. Have each tile have a coordinate on the map
2. Inject blank tiles where needed

While 1 would be kinda easier, 2 would be more efficient in the long run.
So that's what I'm gonna work on next.

Right now I wrote this all while having a POUNDING and I mean POUNDING FUCKING HEADACHE
So I'm going to bed now haha, suggestions if you have any and comments are always welcome!

Good night<3

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

Posted: Tue Aug 10, 2010 10:53 am
by GroundUpEngine
Man great work so far, looks sweet!! Be persistent my brotha, problem solving is an essential skill in programming ;)

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

Posted: Tue Aug 10, 2010 2:27 pm
by eatcomics
Dude nother fine update, I like it when people post frequent updates because it makes me feel bad for not and then I get to work :D

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

Posted: Wed Aug 11, 2010 8:21 am
by LeonBlade
Okay, so when I resize the map it was working... but I re-broke it >_<
I got saving, loading, etc implemented now.

Wait... what the fuck have I been doing all day then?
FFFUUUUUUUUUUUUUUU-
I'm gonna work harder today >_>

Anyways, the fucking thing screws up when I make the map any taller... I don't get it...
How should I get the tileset to load in on the left?
Should it be in a new OpenGL screen? Or should I learn how to use something like QGraphicsView or some shit?

See you guys later, I'm gonna get some breakfast and go to bed. <3

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

Posted: Wed Aug 18, 2010 7:46 am
by LeonBlade
I have a big update in store for my next post, but right now I some help.
As you all know, or should if you've been following along, my map file is stored in a binary format.

Now, I need to add a few things to the header section, which currently holds the filesize, tilesX and tilesY.
I need to store the tileset name that it uses, and also the name of the map, something like "The Town of the Dead" just a string like that.

Now, how should I go about this, because I've tried many ways and have failed every time.
This is my current MapHeader struct:

Code: Select all

struct MapHeader
{
	unsigned int		fileLength;
        unsigned short		tilesX;
	unsigned short		tilesY;
};
How do I add those few fields to it?
Thanks.

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

Posted: Wed Aug 18, 2010 8:53 am
by Ginto8
LeonBlade wrote:I have a big update in store for my next post, but right now I some help.
As you all know, or should if you've been following along, my map file is stored in a binary format.

Now, I need to add a few things to the header section, which currently holds the filesize, tilesX and tilesY.
I need to store the tileset name that it uses, and also the name of the map, something like "The Town of the Dead" just a string like that.

Now, how should I go about this, because I've tried many ways and have failed every time.
This is my current MapHeader struct:

Code: Select all

struct MapHeader
{
	unsigned int		fileLength;
	unsigned short		tilesX;
	unsigned short		tilesY;
};
How do I add those few fields to it?
Thanks.

Code: Select all

struct MapHeader {
	char				name[32];
	unsigned int		fileLength;
	unsigned short		tilesX;
	unsigned short		tilesY;
};
this will allow for a name up to 31 characters (you need a trailing '\0'), and it will correctly serialize.

Anyway, I've been lurking a bit on this project, and it's really looking nice! Keep up the good work!

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

Posted: Wed Aug 18, 2010 9:01 am
by Van-B
I think your file format will go from neat and easy, to brutal rape in the course of that change. I hate doing anything with text,l spent the last 2 evenings making a bitmap text font system, and that drove me mad, not even saving data out or loading it in.

This will sound daft, but can't you just index things, like standardise your tile maps, store their name in an array, and stick to it - so that you can refer to a tile map by it's number instead. So your level file might say, use tile map 5 and it's area 7, which could be 'snowytiles' and 'horrible mountains'. That way you can keep the format as binary, but also you will have less chance of running into file issues - because if you specify a tile map by name in the level file, that tile map can't easily be renamed, nor can your level name - however if it's an index to an array, then your golden - you just change the index text instead.

Would take a bit of organisation, but compared to fighting with character strings in files, comparing them, consistancy... well I wouldn't relish that, infact I'd avoid it like the plague.

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

Posted: Wed Aug 18, 2010 2:01 pm
by mv2112
Ginto8's method works, i'm now using it for my map file format :mrgreen:
And also, great work, the editor looks awesome! I too am also making a map editor with Qt...