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.
Hey guys, been working on a game on and off for a bit with ZGB. Currently it doesn't have a name but it is a simple adventure/rpg game. Trying to keep it reasonable for my skill level as I've never made a game before.
Anyways I've been doing pretty well on my own with the documentation and source code from other games but have been banging my head trying to figure out the print function.
Is there any ways to clear the console? Currently anything I print to the window just keeps adding to whatever string has been printed already. I can't have any dialogue system without it. I attached the window and print functionality to the pause feature to test it with. If you repeatedly press pause in the room you spawn in you can see what I'm talking about.
Also if anyone is using ZGB on Linux and could share how you are building on Linux I would be so grateful. Currently using vmware with a windows vm to build, would make my life much nicer
Here is my latest build, the pause thing I was talking about only works in the room you spawn in. Also the bottom door just takes you back to the main area but you can explore the other rooms
http://s000.tinyupload.com/index.php?fi … 6634087498
Offline
When you use printf or the ZGB print functions you modify background tiles so to "erase" the text you can write over previous text with " " values. You will need to use PRINT_POS and Printf or Print (all ZGB functions) to start at a specific tile in the window otherwise just using printf will cause the text to append in the manner it is in your ROM.
Last edited by gbjosh (2019-02-23 12:07:19)
Offline
Oh man thank you so much. It's one of those things where I just needed that tiny little push and I kind of feel dumb about it haha.
I was looking at it like printing something into a terminal when you are coding on a desktop, I just had to put the print position on it again.
Okay well that is huge, I can start working on my text system. Kind of want to make it like zelda where it prints out one letter at a time.
If anyone reads this and is building zgb on Linux let me know
Offline
As far as I know, printf in GBDK should be avoided like the plague. It clobbers a lot of video state (all 256 BG tiles, LCDC and scoll regs also?); the correct way to print text being to copy tile IDs to the tilemap.
Offline
I'm using ZGB on Linux (and also work on an RPG haha).
It's actually fairly easy to set up, this is what I did in order to build ZGB-template:
1. Install sdcc with your package manager
2. download gbdk-2.96a-i586-pc-linux2.2.tar.gz
unpack to /opt/gbdk (or any other directory of your choice)
Set GBDK_HOME="/opt/gbdk"
At some point Zal0 wrote on his ZGB wiki that you should use 2.95-3, but the Linux version of lcc seems to have a problem with Objectfile names that have more than 8 characters, but the above worked for me.
3. git clone ZGB & ZGB template
Set ZGB_PATH="/path/to/ZGB/common"
(4. Change all #includes with \ to / (e.g in StateGame.c))
Then you can just use the makefiles to build the project:
Open up a terminal in ZGB/common/src/ and type make.
Then go to ZGB-template/src and type make.
This will then build the ROM and put it in ZGB-template/bin/
I use an older version of ZGB, but I think it should still work. Also there might be a better way but this is just more or less the first thing I tried and it worked so I didn't bother any further...just ask if you have any questions
EDIT: added link to gbdk
Also I recommend wine to run bgb if you don't use that already.
Last edited by cloudZz (2019-03-03 13:06:57)
Offline
Hey thanks! I haven't quite got it working yet but I think I'm close, getting this in the terminal:
linux@linux:~/Dropbox/zgb/src$ make
../Release/SpriteOrb.d:1: *** multiple target patterns. Stop.
Pretty sure it's something about the paths in MakeFileCommon in /zgb/src. Gonna try and figure it out later!
Offline
Okay so I followed your instructions except for downloading the ZGB template since I wanted to build my project. Just had to delete the previous build folder and run chmod +x on all the compiling tools and it works!
Only issue now is music won't compile, I built a new mod2gbt from the github and placed it in the right directory but it always fails at compiling the music.
Not too worried, it was just a placeholder until I make some of my own so I've just removed it from my project for now. Thank you so much, building on Linux is a treat and will improve my workflow greatly
Offline
Great!
I don't use mod2gbt in my project, but I just fiddled with it a bit and I think I got it to work.
I compiled the legacy_gbdk version from this repo using gcc. Had to make a few adjustments so that this version would compile:
1. remove "inline" from all function definitions
2. line 907 change "#pragma bank=" to "#pragma bank " (my sdcc complained that it does not recognize e.g #pragma bank=4, but #pragma bank 4 works)
Then I just followed the music guide from the ZGB wiki to load the template song.
Important: I had to make sure I use a seperate bank just for the music data, else there were lots of warnings and the ROM would crash upon start up.
I don't know if this problem is there as well if you build it with Windows.
For my project I use the Game Boy Tracker (aka Paragon5/Beyond Tracker iirc) instead and I modified ZGB to support that.
I plan to submit a pull request to ZGB eventually, but my toolchain is currently too hacky for public use...but if you're interested I could send you the files (might take me a few days to write a short guide how to use it though).
Game Boy Tracker has more sophisticated effects plus a quite good sound emulation in its editor, imo it's easier to make something that actually sounds passable. The drawback is that while the editor works on Linux, it's not open source (haven't contacted the author though) although the sound driver is.
Anyway I look forward to playing your game, the graphics already look nice!
Offline
Hi Zalo! Could you specify which issues exactly? I haven't run into any yet, but so far I haven't done anything particularly calculus heavy....mostly been writing a data driven RPG event system (where the most common operations are just setting variables, bank switching and calling ZGB functions).
When I first tried 2.95-3 on Linux the linker seemed to have a problem with object files with names exceeding 8 chars iirc?
Also thank you very much for creating ZGB! Makes creating an actual game so much easier....
Offline
EDIT:
Here is what worked for me (Linux Mint, GNU Make 4.1, x86_64), slightly updating the instructions from above
1. Install sdcc with your package manager (it may also install sdcc-doc and sdcc-libraries)
sdasgb is at least one dependency that isn't in the SourceForge gbdk linux releases, but is in included with the OS package manager package.
2. download gbdk-2.96a-i586-pc-linux2.2.tar.gz
(the 2.95-3 sdcc binary segfaults for me on Linux)
unpack to /opt/gbdk
2-A. Set:
GBDK_HOME="/opt/gbdk"
2-B.
nano -w /opt/gbdfev/gbdk
# SDCC_ROOT = /usr/lib/$(SDCC_OR_GBDK)
SDCC_ROOT = /opt/$(SDCC_OR_GBDK)
And/Or do
sudo ln -s /opt/gbdk /usr/lib/gbdk
3. git clone ZGB & ZGB template
git clone https://github.com/Zal0/ZGB.git
git clone https://github.com/Zal0/ZGB-template.git
3-A. Set:
ZGB_PATH="<fill in path to>/gbdev/ZGB/common"
4. Make some source changes
4-A. In the game Template, change all #includes with \ to / (e.g in StateGame.c)
4-B. in ZGB
common/src/Makefile
@@ -1,3 +1,8 @@
+PROJECT_NAME = Common
+include ../../common/src/MakefileCommon
+
+all: build_lib
common/src/MakefileCommon
@@ -1,5 +1,5 @@
ZGB_PATH_UNIX := $(subst ',,$(subst \,/,'$(ZGB_PATH)'))
-GBDK_HOME := $(ZGB_PATH_UNIX)/../env/gbdk
+#GBDK_HOME := $(ZGB_PATH_UNIX)/../env/gbdk
5. Then use the makefiles to build the project:
Open up a terminal in ZGB/common/src/ and type make
Then go to ZGB-template/src and type make
This will then build the ROM and put it in ZGB-template/bin/
Last edited by bbbbbr (2019-03-05 00:32:35)
Offline