Page 9 of 11

Re: Simple 2D RPG Engine

Posted: Tue May 14, 2013 8:46 pm
by Falco Girgis
Light-Dark wrote:Basically it's doing a bounding box collision detection between the player and the specified tile, if the player is colliding with the lower tile it shifts the depth value down in lua, however if the player is colliding with the upper tile it shifts the depth value up. To keep from creating unnecessary issues I have the players x and y 'snapped' to multiples of 32x32 so the player won't be colliding with both at the same time. This system serves as a place holder for the moment.
Yeah, that's basically how we're going to handle it. I didn't even realize the player was being snapped to a grid in the video, since motion looked so smooth.

Chrono Trigger's engine calls these "z-transitional" tiles.
Light-Dark wrote:And this is how camera zooming/rotating is currently handled:
void GameSystem::Camera_Transform(const float scale,const float rotation)
{
    UniformScaleVal = scale;
    camera.w = SCREEN_WIDTH * (1/scale);
    camera.h = SCREEN_HEIGHT * (1/scale);
    glScalef(scale,scale,1);
    
    glTranslatef(camera.w/2,camera.h/2,0);
    glRotatef(rotation,0,0,1);
    glTranslatef(-camera.w/2,-camera.h/2,0);
    
}
You have the right basic idea (obviously, or it wouldn't be working as well as it is now). The order of operations is:
1) translate to the center of the screen, so that every transform is now relative to this point.
2) apply the camera's uniform zoom/scale
3) apply the camera's rotation
4) translate back to the camera's world-space coordinates

Actual algorithm used in ES:

Code: Select all

void CameraSystem::PushTransform(void) {
	gyMatPush();
	gyMatTranslate(_scrWidth/2.0f, _scrHeight/2.0f, 0.0f);
	gyMatScale(transform._scale.x, transform._scale.y, 1.0f);
	gyMatRotateZ(transform._orientZ);
	gyMatTranslate(-transform._pos.x, -transform._pos.y, 0.0f);
}
Cheers.

Re: Simple 2D RPG Engine

Posted: Sun May 19, 2013 12:32 am
by Light-Dark
Falco Girgis wrote:You have the right basic idea (obviously, or it wouldn't be working as well as it is now).
Good to know I'm on the right track :)!

Anyways, I've recently begun learning to do some pixel art so I can make placeholder or possibly real assets for the game itself and this is what I have to show for it:
Placeholder.png
Artwork
(112.96 KiB) Not downloaded yet
It's pretty meh right? I'm not that great of an artist :lol:. You'll also notice I've changed the layout around on the editor and added a new depth settings widget for controlling the newfangled depth/elevation system annnd I also changed the style of the UI because why not!

Re: Simple 2D RPG Engine

Posted: Sun May 19, 2013 10:56 am
by Falco Girgis
How does the depth slider work? Do you have to make a selection first, and it is applied to the tile(s) within the selection?

Re: Simple 2D RPG Engine

Posted: Sun May 19, 2013 11:57 am
by Light-Dark
Falco Girgis wrote:How does the depth slider work? Do you have to make a selection first, and it is applied to the tile(s) within the selection?
The depth is applied when you lay a tile with the depth flag turned on(otherwise it's automatically set to 0), the depth slider also controls which elevation of the collision layer you are dealing with/viewing.

Re: Simple 2D RPG Engine

Posted: Mon May 20, 2013 9:05 am
by Falco Girgis
Aaaaah, I gotcha. Nice!

Thought of another question. Is only one of your layers elevatable? If they are both elevatable, does one always have to be above the other one, or can layer 1 technically be levated above layer 2?

Re: Simple 2D RPG Engine

Posted: Mon May 20, 2013 10:34 am
by Light-Dark
Falco Girgis wrote:Aaaaah, I gotcha. Nice!

Thought of another question. Is only one of your layers elevatable? If they are both elevatable, does one always have to be above the other one, or can layer 1 technically be levated above layer 2?
I spent a bit testing that out and it appears that layer 2 will always render above the first layer despite elevation levels.


Also, I thought I should show some footage of the Dreamcast version in action. It's kinda outdated now as I'm still working on getting/making a BBA or coders cable but consider this confirmation that it is indeed happening!


Re: Simple 2D RPG Engine

Posted: Mon May 20, 2013 12:10 pm
by bbguimaraes
I smell an instant promotion...

Re: Simple 2D RPG Engine

Posted: Mon May 20, 2013 10:27 pm
by Light-Dark
bbguimaraes wrote:I smell an instant promotion...
I guess your prediction was right :lol:, I've always wanted to have a game I made run on a console and now that dream is going to be realized!

Re: Simple 2D RPG Engine

Posted: Fri May 24, 2013 2:31 pm
by Light-Dark
Just a quick update everybody, got a DC SD card adapter ordered! Expect some more Dreamcast in future updates/videos!

EDIT:

Adding on to this update, I updated KOS and the Dc tool-chain so now everything runs on KOS 2.0.0.

Re: Simple 2D RPG Engine

Posted: Thu Jun 06, 2013 3:39 pm
by Light-Dark
I'm rewriting it again. Now you might be wondering why I'm deciding to rewrite it in the middle of a rewrite? Well that's because of a few design issues and the annoyance of switching between two different builds of the same thing. To combat these issues I've been working on a library written in C that abstracts the engine away from the PC and Dreamcast, so far I've got the PC version up and running and I'm working on the DC version now. I'm currently working on the Matrix transformations for the Dreamcast and I'm hoping to have basic functionality for both versions of the library working soon. All of this shouldn't be to big of a delay, this is something I feel that overall will be more beneficial to the project. More updates later!

Re: Simple 2D RPG Engine

Posted: Thu Jun 06, 2013 3:55 pm
by bbguimaraes
Light-Dark wrote:Now you might be wondering why I'm deciding to rewrite it in the middle of a rewrite?
Everybody knows time passes more slowly on the inner rewrites.

Re: Simple 2D RPG Engine

Posted: Thu Jun 20, 2013 1:25 pm
by Light-Dark


Got things running on the Dreamcast nicely now as shown in the video ( apologies for the camera-pointed-at-tv method of recording, I long for the days when I had my capture card). I now have a Dreamcast SD Card adapter and that has made testing a lot easier and reliable ( NullDC does not seem to like hardware sprites ).

Re: Simple 2D RPG Engine

Posted: Fri Dec 20, 2013 2:23 am
by Light-Dark


Progress Made on top of the rewrite:
- Totally revamped Character system
- Revamped animation system ( way more flexible for character animations)
- New Dialogue/Textbox System ( allows for complex branching conversations)
- Revamped log system ( looks prettier! )
- Optimized rendering routines ( Noticeable performance gain, especially on the dreamcast, runs at 60fps)

Re: Simple 2D RPG Engine

Posted: Fri Dec 20, 2013 2:29 pm
by dandymcgee
Wow, didn't know you were still working on this. Nice progress, you should post updates here more often!

Re: Simple 2D RPG Engine

Posted: Fri Dec 20, 2013 4:20 pm
by Falco Girgis
Glad you're still fighting the good fight! Looks great.