Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#26 2017-02-21 22:23:16

Tag365
Member
Registered: 2016-06-01
Posts: 41

Re: ZGB, a little engine for the Game Boy

Did you add Background Map attributes yet?

Offline

 

#27 2017-02-22 03:50:17

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: ZGB, a little engine for the Game Boy

Tag365 wrote:

Did you add Background Map attributes yet?

I think that only Works for game boy color.

Offline

 

#28 2017-03-13 00:57:18

npzman
Banned
From:
Registered: 2014-11-19
Posts: 197

Re: ZGB, a little engine for the Game Boy

Can I use Visual Studio 2010 or do I have to use Visual Studio 2015


Twitter : @Sfeedman please follow
Join : sfeed.club my website please join

Offline

 

#29 2017-03-29 15:12:10

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: ZGB, a little engine for the Game Boy

I hope I did it correctly, I cloned Zalo's project on github and updated the engine here:

ZGB_Clone

I also added a demo to test things I am going to use in my games:

video https://www.youtube.com/watch?v=GWu-MOOYdj4

Super Princess' 2092 Exodus will compile with this, but won't work because I had to modify "ScrollSetMap" function.

The make.bat file has two settings to compile games.
        COLOR:
        yes = enable game boy color functions, ROM wil only work well on GBC.
        no = disable game boy color functions, ROM will only work well on DMG.
        CPlayer:
        yes = enable Carillon player for music, disable GBT player. Only .sav files will be used.
        no = enable GBT player for music, disable Carillon player. Only .mod files will be used.

Hope you like it smile.

Last edited by Mills (2017-03-29 16:03:18)

Offline

 

#30 2017-03-30 03:27:21

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: ZGB, a little engine for the Game Boy

Impressive job, Mills

Now you just need to do a pull request so I can start reviewing and merging all the changes (and Fix Super Princess so it can work with all these changes)

Offline

 

#31 2017-03-30 04:26:08

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: ZGB, a little engine for the Game Boy

Zalo wrote:

Impressive job, Mills

Now you just need to do a pull request so I can start reviewing and merging all the changes (and Fix Super Princess so it can work with all these changes)

I forgot to say... bank 0 and 1 are so full, you can't init all states and sprites from main in bank 1.
It only lets you init about 3 states and 3 sprites.
But doing it from other banks works well, so you just have to init all sprites in a start function of a state in other bank, and then go to the level or menu they are used, and they will be there smile. (This way I could compile princess, because it filled up the first bank).

Also the animation structs seem to fill the ram used by carillon editor (depending on the game itself). This only happens on color mode, not in DMG mode.

Last edited by Mills (2017-03-30 04:27:37)

Offline

 

#32 2017-03-30 04:42:07

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: ZGB, a little engine for the Game Boy

Yes, I also wanted to change that initialization to another bank because I almost run out of memory in Super Princess

Offline

 

#33 2017-03-31 12:27:53

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: ZGB, a little engine for the Game Boy

Zalo wrote:

Yes, I also wanted to change that initialization to another bank because I almost run out of memory in Super Princess

I also forgot to tell you... "Find tile in corners" function was disabled to fit the code in the banks... But I realised it fits in bank 0 again, so just activate it.

Ups.. it produced some random gfx problems... it is surelly filling up the rom bank..

Last edited by Mills (2017-03-31 16:32:48)

Offline

 

#34 2017-04-03 13:14:31

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

Hey, fellas. So I download this today and set it up correctly (as far as I know), but when I try to build the template, this happens:

https://i15.photobucket.com/albums/a372/xduox/untitled_zpsw7qx0kzx.jpg

So is it something I'm doing wrong or what? I know my bgb.exe is elsewhere, but what's with all the "wrote twice" errors? Isn't that, like, a banking thing?

Offline

 

#35 2017-04-04 02:43:42

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: ZGB, a little engine for the Game Boy

Which version of gbdk are you using? You should use 2.95-3

Offline

 

#36 2017-04-04 08:07:47

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

Zalo wrote:

Which version of gbdk are you using? You should use 2.95-3

Ahh, that did it! Thank you very much.
Now, let's find out how this works.

Offline

 

#37 2017-04-04 21:14:25

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

Hey, so... New question:
I was following the tutorial from the github page, but got lost when you tell to change the player sprite to the boy and export it.

I've changed it, added two frames, but where do I export it to? From where does the engine load it up? I couldn't find any sort of 'include "player.b2.c"' or anything of the sort anywhere.

I tried exporting the new sprite anyway, but the build.bat now just gives me an error ("Duplicate symbol 'bank_SPRITE_PLAYER', synbol IGNORED") right on  SpritePlayer.c's third line. The whole file looks pretty much the same it does on the tutorial, so what am I missing?

Offline

 

#38 2017-04-05 09:55:13

npzman
Banned
From:
Registered: 2014-11-19
Posts: 197

Re: ZGB, a little engine for the Game Boy

Does anyone have the completed version of the ZGB template. That is the version after it doing the tutorial in the ZGB page github.

Last edited by npzman (2017-04-05 10:01:00)


Twitter : @Sfeedman please follow
Join : sfeed.club my website please join

Offline

 

#39 2017-04-05 10:07:42

npzman
Banned
From:
Registered: 2014-11-19
Posts: 197

Re: ZGB, a little engine for the Game Boy

@Zal0 why did you ignored my email when I needed help on using ZGB. I was asking to help me find out why when I hit compile on the ZGB template nothing shows on bgb. Lucky I found out why and fixed it myself it tooked me a nearly month too.

@Millis why all of a sudden you stop helping me via email and replying ? Lucky that I got it sorted


Twitter : @Sfeedman please follow
Join : sfeed.club my website please join

Offline

 

#40 2017-04-06 02:59:54

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: ZGB, a little engine for the Game Boy

DU0 wrote:

Hey, so... New question:
I was following the tutorial from the github page, but got lost when you tell to change the player sprite to the boy and export it.

I've changed it, added two frames, but where do I export it to? From where does the engine load it up? I couldn't find any sort of 'include "player.b2.c"' or anything of the sort anywhere.

If you just export it, it will be exported to res/src of your project. From there, the makefile will pick it (it is a .c file, so it needs to be compiled) and that's how the magic happens. If you want to change the name instead of Export, select Export To, this will open a pop up where you can change the paht of the sprite.
Everything exported into res/src willl remain there so if you rename  a file you should enter this folder and clean the old files manually


DU0 wrote:

I tried exporting the new sprite anyway, but the build.bat now just gives me an error ("Duplicate symbol 'bank_SPRITE_PLAYER', synbol IGNORED") right on  SpritePlayer.c's third line. The whole file looks pretty much the same it does on the tutorial, so what am I missing?

That's because you haven't changed the name of the var in your .c file UINT8 bank_SPRITE_PLAYER = 2; it has to be named exactly as you named your Sprite in your code
See the tutorial where I create the enemy here and follow the steps carefully

Offline

 

#41 2017-04-06 03:20:33

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: ZGB, a little engine for the Game Boy

npzman wrote:

@Zal0 why did you ignored my email when I needed help on using ZGB. I was asking to help me find out why when I hit compile on the ZGB template nothing shows on bgb. Lucky I found out why and fixed it myself it tooked me a nearly month too.

Because as I told you, you were starting the get annoying. You should really calm down a bit, wait for people to answer and listen to what they are saying. You don't enter a forum and say people are pissing you off and start posting about whatever you want anywhere. Also sending thousand of emails to people won't help. I'd like to think you are just too young...

Offline

 

#42 2017-04-06 07:41:12

npzman
Banned
From:
Registered: 2014-11-19
Posts: 197

Re: ZGB, a little engine for the Game Boy

Zalo wrote:

npzman wrote:

@Zal0 why did you ignored my email when I needed help on using ZGB. I was asking to help me find out why when I hit compile on the ZGB template nothing shows on bgb. Lucky I found out why and fixed it myself it tooked me a nearly month too.

Because as I told you, you were starting the get annoying. You should really calm down a bit, wait for people to answer and listen to what they are saying. You don't enter a forum and say people are pissing you off and start posting about whatever you want anywhere. Also sending thousand of emails to people won't help. I'd like to think you are just too young...

You're right I am younger than you think. The only reason I sent you a email and contacted you on skype was becuase I was banned on the forums.


Twitter : @Sfeedman please follow
Join : sfeed.club my website please join

Offline

 

#43 2017-04-08 10:39:31

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

@Zalo, I think I found a mistake in the tutorial. When you teach how to do collisions for the enemy, there's the following:

In order to collide with the enemy you have to add the next code at the end of the method Update of SpritePlayer.c

#include "ZGBMain.h"
...

void Update_SPRITE_PLAYER() {
    UINT8 i;
    struct Sprite* spr;
    ...


    SPRITEMANAGER_ITERATE(i, spr) {
        if(spr->type == SPRITE_ENEMY) {
            if(CheckCollision(THIS, spr)) {
                SetState(STATE_GAME);
            }
        }
    }
}

If i'm correct, the part in bold should be above, with the other declarations. It just doesn't work inside the Update, but once I took it all up there, the code compiled flawlessly. I also realize it's something really minor, but to people who aren't quite "fluent" in programming, it's a needless hassle.

Offline

 

#44 2017-04-08 20:50:30

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: ZGB, a little engine for the Game Boy

You mean outside the method? It seems ok the way it is right now, just at the begginig

Offline

 

#45 2017-04-09 07:54:10

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: ZGB, a little engine for the Game Boy

DU0 wrote:

@Zalo, I think I found a mistake in the tutorial. When you teach how to do collisions for the enemy, there's the following:

In order to collide with the enemy you have to add the next code at the end of the method Update of SpritePlayer.c

#include "ZGBMain.h"
...

void Update_SPRITE_PLAYER() {
    UINT8 i;
    struct Sprite* spr;
    ...


    SPRITEMANAGER_ITERATE(i, spr) {
        if(spr->type == SPRITE_ENEMY) {
            if(CheckCollision(THIS, spr)) {
                SetState(STATE_GAME);
            }
        }
    }
}

If i'm correct, the part in bold should be above, with the other declarations. It just doesn't work inside the Update, but once I took it all up there, the code compiled flawlessly. I also realize it's something really minor, but to people who aren't quite "fluent" in programming, it's a needless hassle.

I compiled it that way, and it works, you just have to be sure the UINT and struct are the first lines inside the update function, and then you can add other things.

Offline

 

#46 2017-04-09 08:16:00

npzman
Banned
From:
Registered: 2014-11-19
Posts: 197

Re: ZGB, a little engine for the Game Boy

@Mills did you got my email and skype call ?


Twitter : @Sfeedman please follow
Join : sfeed.club my website please join

Offline

 

#47 2017-04-09 11:48:32

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

Mills wrote:

DU0 wrote:

@Zalo, I think I found a mistake in the tutorial. When you teach how to do collisions for the enemy, there's the following:

In order to collide with the enemy you have to add the next code at the end of the method Update of SpritePlayer.c

#include "ZGBMain.h"
...

void Update_SPRITE_PLAYER() {
    UINT8 i;
    struct Sprite* spr;
    ...


    SPRITEMANAGER_ITERATE(i, spr) {
        if(spr->type == SPRITE_ENEMY) {
            if(CheckCollision(THIS, spr)) {
                SetState(STATE_GAME);
            }
        }
    }
}

If i'm correct, the part in bold should be above, with the other declarations. It just doesn't work inside the Update, but once I took it all up there, the code compiled flawlessly. I also realize it's something really minor, but to people who aren't quite "fluent" in programming, it's a needless hassle.

I compiled it that way, and it works, you just have to be sure the UINT and struct are the first lines inside the update function, and then you can add other things.

I just tested it here, and indeed, it works if those are the first parameters. Will it make any relevant difference if I leave it inside or outside of the method?
I remember hearing about how this stuff should always be outside, but I don't know if there's any difference on the Game Boy or anything.

Offline

 

#48 2017-04-09 12:40:47

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: ZGB, a little engine for the Game Boy

I don't think it should for this specific function.

If you declare your variables outside of it, it means they are globals : they can be use by any function of your file (or other files using the [i]extern[i/] keyword). If declared inside of your function, they can only be used by this specific function.

Declaring non-global variables is usually safer since it avoids side functions to write on your variable.
However, on GBDK, the main difference is that global variables are statically allocated to a specific RAM address while non-global variables are store on the stack, which requires some calculation to access them (hence more time). It's speed versus safety if you prefer.

Last edited by Xephyr (2017-04-09 12:41:08)

Offline

 

#49 2017-04-10 16:49:41

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

Xephyr wrote:

I don't think it should for this specific function.

If you declare your variables outside of it, it means they are globals : they can be use by any function of your file (or other files using the extern keyword). If declared inside of your function, they can only be used by this specific function.

Declaring non-global variables is usually safer since it avoids side functions to write on your variable.
However, on GBDK, the main difference is that global variables are statically allocated to a specific RAM address while non-global variables are store on the stack, which requires some calculation to access them (hence more time). It's speed versus safety if you prefer.

Thanks, that's very well put. I recall reading about something GB-specific, but I didn't make a lot of sense at the time.

Offline

 

#50 2017-04-11 17:20:56

DU0
Member
From: Porto Alegre - RS - Brazil
Registered: 2017-04-01
Posts: 23
Website

Re: ZGB, a little engine for the Game Boy

So, I've pretty much finished the tutorial (I skipped the music part because I'm still figuring that out). However, there are a couple of things that are still not clear to me:

- How do I put more maps into my game? The tutorial just tells you how to modify the one that's already there.

- That being done, how do I change scenes? Where do I declare them?

- Not sure if that this has anything to do with the engine itself, but how do I make a save point?

- Finally, is it possible to make a ROM that'll have colors but still work fine on DMG? Or should I just compile two ROMs, one for each system?


Also, sorry if I'm spamming or something, but I'm just really excited with being able to do stuff on the Game Boy :3

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson