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.

#1 2017-03-27 22:19:16

Alexander the bat
Member
Registered: 2017-03-19
Posts: 31

how to use Zal0's z80 engine for gameboy development?

This may sound confusing how I could use the z80 engine to work it in my project and get things programmed like oh let's say a RPG game?

does it need to be included in the main.c file or what? how one can use this engine to get programming a lot easier with this?

Offline

 

#2 2017-03-28 04:01:57

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

Re: how to use Zal0's z80 engine for gameboy development?

Check the tutorial on the github, it should help you understand it : https://github.com/Zal0/ZGB#tutorial

However I wouldn't recommend you to start making an RPG especially if you haven't completed a single game before. It needs a lot of work.

Offline

 

#3 2017-03-28 11:01:14

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

Re: how to use Zal0's z80 engine for gameboy development?

Yeah, you have to include your project in the engine, (not the engine in your project), github tutorial is very good.

Offline

 

#4 2017-04-02 01:08:56

Alexander the bat
Member
Registered: 2017-03-19
Posts: 31

Re: how to use Zal0's z80 engine for gameboy development?

Mills wrote:

Yeah, you have to include your project in the engine, (not the engine in your project), github tutorial is very good.

could linking a main.c to it work too if i used the engine? or it has to be writting in the engine's main?

Offline

 

#5 2017-04-04 12:50:05

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

Re: how to use Zal0's z80 engine for gameboy development?

Alexander the bat wrote:

Mills wrote:

Yeah, you have to include your project in the engine, (not the engine in your project), github tutorial is very good.

could linking a main.c to it work too if i used the engine? or it has to be writting in the engine's main?

You have to create an empty "state" (like the ones included in the template) declare it in main etc...

Then you have to include your program inside state functions (start, update), and replace loading functions (bkg, sprites, tiles...) with the zgb ones.

Offline

 

#6 2017-04-04 19:44:36

Alexander the bat
Member
Registered: 2017-03-19
Posts: 31

Re: how to use Zal0's z80 engine for gameboy development?

what about a Color Version of the game I planned to work on like a oh let's say a 256KB colored gameboy game of some sort?

Offline

 

#7 2017-04-05 17:24:23

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

Re: how to use Zal0's z80 engine for gameboy development?

Alexander the bat wrote:

what about a Color Version of the game I planned to work on like a oh let's say a 256KB colored gameboy game of some sort?

I added color functions to the engine, still has some bugs, you can check ZGB thread, I posted the demo uisng color.

Offline

 

#8 2017-04-06 17:49:35

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

Re: how to use Zal0's z80 engine for gameboy development?

Xephyr wrote:

Check the tutorial on the github, it should help you understand it : https://github.com/Zal0/ZGB#tutorial

However I wouldn't recommend you to start making an RPG especially if you haven't completed a single game before. It needs a lot of work.

Do you have the complete tutorial done on the ZGB template ?


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

Offline

 

#9 2017-04-06 18:07:11

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

Re: how to use Zal0's z80 engine for gameboy development?

Hello Everyone

I need help doing the Enemy chapter in the ZGB tutorial in github. So far I desgined the enemy. After that I got stuck so anyone wants to help me ?
However I done all previous chapters ?


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

Offline

 

#10 2017-04-07 03:34:32

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

Re: how to use Zal0's z80 engine for gameboy development?

Mills wrote:

I added color functions to the engine, still has some bugs, you can check ZGB thread, I posted the demo uisng color.

I am working on merging all the changes into the main branch. What bugs are you talking about?


npzman wrote:

Hello Everyone

I need help doing the Enemy chapter in the ZGB tutorial in github. So far I desgined the enemy. After that I got stuck so anyone wants to help me ?
However I done all previous chapters ?

What exactly is the problem?

Offline

 

#11 2017-04-07 03:57:43

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

Re: how to use Zal0's z80 engine for gameboy development?

Zalo wrote:

What bugs are you talking about?

The background animations use too much ram.. They will sometimes overwrite the carillon player variables if you add 6 or 7 animations in color mode... Anyway gameboy only can use 2 or 3 at the same time, and you can recicle the same animations and reload them with different data, so I think there should be no problems.

Offline

 

#12 2017-04-07 07:52:54

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

Re: how to use Zal0's z80 engine for gameboy development?

Thanks for actally starting to reply again .

Well in the chapter where I was adding ememys. I followed the steps but then there was an error when I compiled it was this :



C:\Users\owner\Desktop\ZGB-template>C:\gbdk\bin\make-3.81-bin\bin\make -C C:\gbdk\ZGB\common\src
make: Entering directory `C:/gbdk/ZGB/common/src'
make: Nothing to be done for `all'.
make: Leaving directory `C:/gbdk/ZGB/common/src'

C:\Users\owner\Desktop\ZGB-template>cd src

C:\Users\owner\Desktop\ZGB-template\src>C:\gbdk\bin\make-3.81-bin\bin\make run
compiling ZGBMain.c
ZGBMain.c(9):error *** Invalid directive
ZGBMain.c(11):error *** Invalid directive
ZGBMain.c(19):error *** code not generated for 'InitStates' due to previous errors
ZGBMain.c(23):error *** code not generated for 'InitSprites' due to previous errors
ZGBMain.c(27):error *** parse error before InitSprites
ZGBMain.c(29):error *** function 'InitSprites' already has body
ZGBMain.c(42):error *** code not generated for 'GetTileReplacement' due to previous errors
make: *** [../Release/ZGBMain.o] Error -1

C:\Users\owner\Desktop\ZGB-template\src>cd ..

C:\Users\owner\Desktop\ZGB-template>pause
Press any key to continue . . .


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

Offline

 

#13 2017-04-07 09:48:45

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

Re: how to use Zal0's z80 engine for gameboy development?

This is the code put in ZGBMain.c

#include "ZGBMain.h"

#include "StateGame.h"

#include "SpritePlayer.h"

#include "../res/src/player.h"

#Include "SpriteEnemy.h"

#Include "../res/src/enemy.h"

UINT8 next_state = STATE_GAME;

SET_N_STATES(N_STATES);
SET_N_SPRITE_TYPES(N_SPRITE_TYPES);

void InitStates() {
    INIT_STATE(STATE_GAME);
}

void InitSprites() {
    INIT_SPRITE(SPRITE_PLAYER, player, 3, FRAME_16x16, 3);
}

void InitSprites() {
    ...
    INIT_SPRITE(SPRITE_ENEMY,  enemy,  3, FRAME_16x16, 1);
}

#include "Math.h"
UINT8 GetTileReplacement(UINT8* tile_ptr, UINT8* tile) {
    if(current_state == STATE_GAME) {
        if(U_LESS_THAN(255 - (UINT16)*tile_ptr, N_SPRITE_TYPES)) {
            *tile = 0;
            return 255 - (UINT16)*tile_ptr;
        }

        *tile = *tile_ptr;
    }

    return 255u;
}


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

Offline

 

#14 2017-04-07 12:43:04

l0k1
Member
Registered: 2014-10-23
Posts: 44

Re: how to use Zal0's z80 engine for gameboy development?

C is case sensitive. Try checking lines 9 and 11 for your error.

Offline

 

#15 2017-04-08 02:18:44

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

Re: how to use Zal0's z80 engine for gameboy development?

This tutorial part I am up to in the ememy section

void Start_STATE_GAME() {
    ...
    SpriteManagerAdd(SPRITE_ENEMY, 70, 50);
}

What does "... " Mean ?

Last edited by npzman (2017-04-08 02:27:07)


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

Offline

 

#16 2017-04-08 07:00:06

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

Re: how to use Zal0's z80 engine for gameboy development?

Those points only mean there could be other code before adding the sprite, just delete them

Offline

 

#17 2017-04-08 07:29:20

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

Re: how to use Zal0's z80 engine for gameboy development?

Mills wrote:

The background animations use too much ram.. They will sometimes overwrite the carillon player variables if you add 6 or 7 animations in color mode... Anyway gameboy only can use 2 or 3 at the same time, and you can recicle the same animations and reload them with different data, so I think there should be no problems.

Ok... I'll see what I can do... I am not sure this is an engine feature but more a game specific one so I am not sure I am going to include them on the core (similar to why I didn't include any of the screen transition functions that I use in Super Princess). Remember the compiler doesn't remove unused functions and we need to make sure only the important ones are available on the core

Also, I see carrillon player has only been implemented for Game Boy Color, is this a limitation of the player?

Offline

 

#18 2017-04-08 08:08:07

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

Re: how to use Zal0's z80 engine for gameboy development?

@zal0 why delete the post ? Has the typo been fixed in the github page ?

Last edited by npzman (2017-04-08 08:11:01)


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

Offline

 

#19 2017-04-10 20:54:02

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

Re: how to use Zal0's z80 engine for gameboy development?

Does anyone have the resources to put a video tutorial for ZGB that's shows the installation and the tutorial from ZGB github page.


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

Offline

 

#20 2017-09-10 23:44:25

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

Re: how to use Zal0's z80 engine for gameboy development?

Well looks I am the only one that does. Sick of getting ignored so I decided to make my own here :
https://www.youtube.com/watch?v=KHaRJcfxYCQ

This is part 1 please give feedback


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

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson