Page 6 of 19

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

Posted: Wed Mar 24, 2010 8:54 am
by Falco Girgis
LeonBlade wrote:
MrDeathNote wrote:
LeonBlade wrote: Oh, and I want to use ColorKey to set a certain color to be transparent... except... I can't get that to work...
So, I'm just using a regular PNG with transparency instead :roll:
What code where you using for the ColorKey?
I just was about to get you or someone else to help me out, but I got it working.
Only problem is, I have to use BMP files in order for it to work right... what the fuck is this shit?
You're better off just using a regular PNG with transparencies anyway. In the hardware accelerated world (OpenGL), you never mask colors. You just use textures that have transparency. It's less of a pain in the ass in the long run.

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

Posted: Wed Mar 24, 2010 11:24 am
by GroundUpEngine
GyroVorbis wrote:
LeonBlade wrote:
MrDeathNote wrote:
LeonBlade wrote: Oh, and I want to use ColorKey to set a certain color to be transparent... except... I can't get that to work...
So, I'm just using a regular PNG with transparency instead :roll:
What code where you using for the ColorKey?
I just was about to get you or someone else to help me out, but I got it working.
Only problem is, I have to use BMP files in order for it to work right... what the fuck is this shit?
You're better off just using a regular PNG with transparencies anyway. In the hardware accelerated world (OpenGL), you never mask colors. You just use textures that have transparency. It's less of a pain in the ass in the long run.
/agreed

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

Posted: Wed Mar 24, 2010 11:26 am
by MrDeathNote
GyroVorbis wrote:
LeonBlade wrote:
MrDeathNote wrote:
LeonBlade wrote: Oh, and I want to use ColorKey to set a certain color to be transparent... except... I can't get that to work...
So, I'm just using a regular PNG with transparency instead :roll:
What code where you using for the ColorKey?
I just was about to get you or someone else to help me out, but I got it working.
Only problem is, I have to use BMP files in order for it to work right... what the fuck is this shit?
You're better off just using a regular PNG with transparencies anyway. In the hardware accelerated world (OpenGL), you never mask colors. You just use textures that have transparency. It's less of a pain in the ass in the long run.
Very true, thats exactly what i'm doing in my rpg engine with opengl. I looked at scanning through each pixel and adding an extra channel for alpha, but holy fuck was it a pain in the ass lol.

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

Posted: Wed Mar 24, 2010 6:13 pm
by LeonBlade
Alright, thank you everyone for your responses.
I'll continue to use transparent PNGs instead of ColorKey.

The only thing is, when I use the map editor, and I want to use a transparent tile on ground, it shows up as transparent, but when you click, it makes it black (the screen color).
What should I do for this? Should I just make a seperate black tile or what?

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

Posted: Wed Mar 24, 2010 9:08 pm
by quickshot14
GyroVorbis wrote:
LeonBlade wrote:
MrDeathNote wrote:
LeonBlade wrote: Oh, and I want to use ColorKey to set a certain color to be transparent... except... I can't get that to work...
So, I'm just using a regular PNG with transparency instead :roll:
What code where you using for the ColorKey?
I just was about to get you or someone else to help me out, but I got it working.
Only problem is, I have to use BMP files in order for it to work right... what the fuck is this shit?
You're better off just using a regular PNG with transparencies anyway. In the hardware accelerated world (OpenGL), you never mask colors. You just use textures that have transparency. It's less of a pain in the ass in the long run.
Falco just nailed it its much simpler easier and of course standard pretty much to use in my vb.net project i'm using pngs for there transparencies and it really is easy. And definlty saves times and issues. You have a good questions and granted i'm not this far on the step yet (working on a tile editor) i belive having a seprate black tile is something thats normal or basic, if my memory servers i belive even mappy does this. So that is a possiblity unless there is a better way of doing or handling it witch more experinced people here may have and idea on.

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

Posted: Wed Mar 24, 2010 11:52 pm
by LeonBlade
Image
This is what the editor looks like atm... shitty graphics I know (I can't sprite :lol:)
I'm gonna add in the side panel to load all the sprites and UI to scroll through the full tilesheet.
Then I'm going to add scrolling for the map...
Then I'm going to make the buttons do shit at the top there ;)
Finish up the UI classes to handle some dialogs for New/Open/Save and some other shit as well.

So that's my plan of attack for the next few days or so.

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

Posted: Wed Mar 24, 2010 11:58 pm
by quickshot14
LeonBlade wrote:Image
This is what the editor looks like atm... shitty graphics I know (I can't sprite :lol:)
I'm gonna add in the side panel to load all the sprites and UI to scroll through the full tilesheet.
Then I'm going to add scrolling for the map...
Then I'm going to make the buttons do shit at the top there ;)
Finish up the UI classes to handle some dialogs for New/Open/Save and some other shit as well.

So that's my plan of attack for the next few days or so.
Awsome man! Looks like a good start and a plan of attack, things will probley change but hey that happens no matter what its progress and thats always encourging, looks good :)

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

Posted: Thu Mar 25, 2010 1:45 am
by LeonBlade
I just realized that scrolling my map is going to be a bitch...
Everything is loaded onto a single dimension LOL.
So here's how I'm going to have to do this if I continue to just load tiles in on a single dimension.

Lets say I'm 3 tiles over...
I have to start 3 tiles over so 3 times the tiles high and then get all tiles from my position over and BLAH BLAH
I DONT EVEN WANNA WRITE IT OUT IM BUSY

So yeah... I'll have to reconfigure that unless I wanna do extra work :lol:

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

Posted: Thu Mar 25, 2010 12:51 pm
by RyanPridgeon
Aye, you'll wanna be doing something which only renders the tile in view of the camera. Something like

Code: Select all

for (i = cameraX / tileWidth; i < (cameraX + screenW) / tileWidth; i++){
 for (j = cameraY / tileHeight; j < (cameraY + screenH) / tileHeight; j++){
  renderTile(tiles[i][j], i * tileWidth - cameraX, j * tileHeight - cameraY)
 }
}

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

Posted: Thu Mar 25, 2010 1:54 pm
by MrDeathNote
RyanPridgeon wrote:Aye, you'll wanna be doing something which only renders the tile in view of the camera. Something like

Code: Select all

for (i = cameraX / tileWidth; i < (cameraX + screenW) / tileWidth; i++){
 for (j = cameraY / tileHeight; j < (cameraY + screenH) / tileHeight; j++){
  renderTile(tiles[i][j], i * tileWidth - cameraX, j * tileHeight - cameraY)
 }
}
Yea this is pretty much what your gonna have to do, it works well and i've used it myself.

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

Posted: Thu Mar 25, 2010 4:21 pm
by LeonBlade
MrDeathNote wrote:
RyanPridgeon wrote:Aye, you'll wanna be doing something which only renders the tile in view of the camera. Something like

Code: Select all

for (i = cameraX / tileWidth; i < (cameraX + screenW) / tileWidth; i++){
 for (j = cameraY / tileHeight; j < (cameraY + screenH) / tileHeight; j++){
  renderTile(tiles[i][j], i * tileWidth - cameraX, j * tileHeight - cameraY)
 }
}
Yea this is pretty much what your gonna have to do, it works well and i've used it myself.
Thanks guys, I could of planned it out like I normally do when I write the topic concerning my issue.
However, I was under a lot of shit atm and VERY tired :lol: thank you for your help :)

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

Posted: Fri Mar 26, 2010 10:34 pm
by LeonBlade
I'm thinking ahead at the moment, but I want to obviously use Lua as my scripting language in my engine.
What I want to do, is have Events essentially on my map.

You can create either: NPCs, Signs and Scripts.
Each event ties back to a script, I want to have my events in my map file look like this...

Code: Select all

00 00 06 07 03 01 00 01
Which is first the ID of the event so I can reference it from other events.
Then Event Type which is either 00, 01 or 02.
Then X and Y for position on the map.
Then there's Sprite which will be the sprite ID of the event or 00 if there is no sprite.
Then the Face of the sprite. This value is either 00, 01, 02, or 03 (4 faces). The value is used for NPCs to chose what way they face.
Then Moving is just a 00 or 01 value. Either they're not moving or they are. The moving is just a random movement.
The last is Script and that is the script ID that the event is associated with.

Now, there are two issues I need to address.
First off, is how I'm going to compile a list of Sprites to associate with the Sprite ID.

Sprites will be stored in a sprite folder.
There will be a tool created that will allow you to add sprites to a list and save out a binary file that will store the name of the sprite texture file and the ID associated with it. The byte FF will signify the end of a filename string.
Here is an example of 3 sprites (in readable form)

Code: Select all

01 "hero.png"
02 "evil_bad_guy.png"
03 "warrior3.png"
Each sprite file is going to be a different length, so instead of just wasting space by creating a static size, I will just use the byte FF to separate the end of the texture.

Here is that same list in hex:

Code: Select all

01 68 65 72 6f 2e 70 6e 67 FF
02 65 76 69 6c 5f 62 61 64 5f 67 75 79 2e 70 6e 67 FF
03 77 61 72 72 69 6f 72 33 2e 70 6e 67 FF
In the actual file, they wouldn't be split up on lines (obviously) but I did this so you could see the break more easily.
So when the engine starts it parses the sprite binary file and adds the sprite textures to the Sprite Texture Manager.

Same goes with the scripts as well, those can be taken care of with a script manager as well.
A separate manager class can be created to handle loading those in, however, I'm not entirely sure how to link Lua up to C++ yet so I'm not sure what I'll do until I read up some more.

But yeah, figured I'd get that down so I don't forget later :lol:
Let me know what you think.

ALSO! The editor in SDL is kind of coming along... not really though.
I'm currently working on it though... so I'll let you know how that goes.
I think I'm looking too much into the big picture.
I'll just focus on the UI alone first then I'll worry about the entire map editor later.

So far, Buttons have been created... that's it... lol.
Well that is all.

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

Posted: Sat Mar 27, 2010 8:34 am
by Live-Dimension
Each sprite file is going to be a different length, so instead of just wasting space by creating a static size, I will just use the byte FF to separate the end of the texture.

Here is that same list in hex:

Code: Select all

01 68 65 72 6f 2e 70 6e 67 FF
02 65 76 69 6c 5f 62 61 64 5f 67 75 79 2e 70 6e 67 FF
03 77 61 72 72 69 6f 72 33 2e 70 6e 67 FF
FF is a bad choice. I don't know how moddable you plan to make a game, but FF is an allowed character in the windows file naming system, so as such, can be input as a file name. I do know that some characters are banned for file/folder names, such as the question mark "?" (3F). I don't know if it's also a banned name on unix systems. If it is, then it's a better way to differ between files then FF, which is ÿ. Thankfully, I don't thing that unicode is apart of any file/folder naming system, so you only have to deal with ASCII, but I could be totally wrong.

I do like the idea of your sprite management system, linking sprites directly to ID's.
Each event ties back to a script, I want to have my events in my map file look like this...

Code: Select all

00 00 06 07 03 01 00 01
I'm also going to assume that you realise you need more then 8 bytes for what your planning ;) As I'm sure you know, each byte is only capable of 256 unique values. It's just you seem insistent on using a maximum of 256 events, 256 sprites.... upto 256 X/Y positioning.

There's some things about your idea of events that confuse me, so if you don't mind (if more for personal curiosity/learning then anything else)
Which is first the ID of the event so I can reference it from other events.
Then Event Type which is either 00, 01 or 02.
Then X and Y for position on the map.
Then there's Sprite which will be the sprite ID of the event or 00 if there is no sprite.
Then the Face of the sprite. This value is either 00, 01, 02, or 03 (4 faces). The value is used for NPCs to chose what way they face.
Then Moving is just a 00 or 01 value. Either they're not moving or they are. The moving is just a random movement.
The last is Script and that is the script ID that the event is associated with.
Why do you need a sprite/facing/moving for an event? What triggers these events? Other events?

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

Posted: Sun Mar 28, 2010 5:22 am
by LeonBlade
Hahahaha yeah I wrote this at like wicked early and didn't really think it through :lol:
The basic idea is there though...

Also, an even can be an NPC.
So the sprite/facing/moving is for NPCs.

Like I said, I have no idea what I was thinking about completely haha :lol:
I was basing it off of something else, I think I'll create NPCs and other Events separate...

Also, for the sprite manager, what should I use to break the different IDs apart... if at all...
Should I even MAKE a binary file for sprites?

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

Posted: Sun Mar 28, 2010 7:13 am
by Live-Dimension
I don't see the need to. It's easier to mod and mess around with text-based files. I'd probably end up making final archive files to store all the files in, however.