Open danboid opened 4 years ago
Glad you're looking into the project for its intended purpose. Lots of bad code practices here but hopefully it at least clarifies how to get something to work at all.
I haven't touched the code base since the last commit. I'm sure the kernel is quite different 5 years later. I'll look into it though, thanks.
@kivan117 The kernel hasn't changed that much. I think these errors are from 3 things:
First I went into my main uzebox
directory and cloned this repo. Then I did a git checkout localonly
to switch to that branch, and after making the following changes to the Makefile, I was able to successfully build on Linux, but it looks like parts of the tileset are still messed up.
index d564257..bd15dcf 100644
--- a/ghostyghost/default/Makefile
+++ b/ghostyghost/default/Makefile
@@ -4,15 +4,15 @@
## General Flags
PROJECT = ghostyghost
-GAME= GGHOST
+GAME= gghost
MCU = atmega644
TARGET = $(GAME).elf
CC = avr-gcc
INFO=../gameinfo.properties
-UZEBIN_DIR = c:/uze_workspace/uzebox_bin_Win32_dev_trunk_r212/bin/
+UZEBIN_DIR = ../../../bin/
## Kernel settings
-KERNEL_DIR = c:/git-repo/Uzebox/uzebox/kernel
+KERNEL_DIR = ../../../kernel
KERNEL_OPTIONS = -DVIDEO_MODE=3 -DINTRO_LOGO=0 -DSCROLLING=1 -DSOUND_MIXER=1 -DSOUND_CHANNEL_5_ENABLE=0
KERNEL_OPTIONS += -DUART=1 -DDEBUG=1 -DUART_RX_BUFFER_SIZE=64 -DUART_TX_BUFFER_SIZE=64
KERNEL_OPTIONS += -DMAX_SPRITES=18 -DRAM_TILES_COUNT=23 -DSCREEN_TILES_V=27 -DFIRST_RENDER_LINE=24
@@ -57,7 +57,7 @@ LINKONLYOBJECTS =
INCLUDES = -I"$(KERNEL_DIR)"
## Build
-all: $(TARGET) $(GAME).HEX $(GAME).eep $(GAME).lss $(GAME).UZE size
+all: $(TARGET) $(GAME).hex $(GAME).eep $(GAME).lss $(GAME).uze size
## Compile Kernel files
uzeboxVideoEngineCore.o: $(KERNEL_DIR)/uzeboxVideoEngineCore.s
@@ -83,7 +83,7 @@ $(GAME).o: ../gghost.c
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
-%.HEX: $(TARGET)
+%.hex: $(TARGET)
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@
%.eep: $(TARGET)
@@ -92,8 +92,8 @@ $(TARGET): $(OBJECTS)
%.lss: $(TARGET)
avr-objdump -h -S $< > $@
-%.UZE: $(TARGET)
- -$(UZEBIN_DIR)packrom $(GAME).HEX $@ $(INFO)
+%.uze: $(TARGET)
+ -$(UZEBIN_DIR)packrom $(GAME).hex $@ $(INFO)
UNAME := $(shell sh -c 'uname -s 2>/dev/null || echo not')
AVRSIZEFLAGS := -A ${TARGET}
@@ -108,7 +108,7 @@ size: ${TARGET}
## Clean target
.PHONY: clean
clean:
- -rm -rf $(OBJECTS) $(GAME).* dep/* *.UZE
+ -rm -rf $(OBJECTS) $(GAME).* dep/* *.uze
## Other dependencies```
Oof, hard coded windows directories :/ Good catch. I'll have to update that I guess.
The letters being scrambled is interesting. It's clearly trying to correctly Print the string. You can see it's repeating identical bad data for repeat string characters. It looks like I was only using SetFontTilesIndex instead of SetFontTable or some other method to specify where to grab font tiles from. This might have relied on some (now broken) assumption about tile memory layout, or a quirk of the kernel build I was using.
Wish I could be more helpful but I'll have to setup a new Uzebox dev environment before I can really dig into any of this.
Copying all of the font tile data into the title_tiles[]
array at the end (making sure to add a comma before the font tiles) fixed the scrambled fonts, but I noticed if I interrupt the uzebox logo screen the ghost doesn't go away, and draws over top of the menu, and there is some other corruption that looks like the sprites aren't being hidden.
Really? The draw menu function should be calling a helper sub function to draw the outside frame. During that routine the first step is SetSpriteVisibility(false). The frame is clearly drawn in the screen shot you sent, so we know that is being called properly.
I'll setup a Linux VM dev environment and sort this all out in the near future. A lot of little stuff seems to be broken now.
This code could use a solid cleanup anyway. No reason people should be trudging through 1200 lines in a single file.
Here are some of the glitches I'm still seeing after making those Makefile changes and moving the font tiles to the end of the title_tiles array: https://youtu.be/-ae1IQ3ZTmc https://youtu.be/TmgNwYV-PWo
Whenever I re-setup a uzebox dev environment for myself I use the commands that I copied and pasted into the description of this video I made: https://www.youtube.com/watch?v=vT2TUSZWDf8&list=PLmw_SSuraf8smbS3K22i--Bl2vaeW5Dsk
I haven't tried compiling it with an older compiler.
Sprite visibility isn't being set to false on menus, and it looks like the tileset isn't being switched over from the menu to the gameplay tile set in the second glitch.
Additionally, the parallax effect of the city tiles isn't working.
Similar to fonts, the parallax relied on updating a starting offset value in tile memory.
Thanks for the assistance in identifying the glitches.
Thanks for looking into this @artcfox !
After making your suggested changes to the makefile and copying the font tile data I have got it to build but the game doesn't start, instead I get a messed up loading screen under cuzebox.
I'll try again when @kivan117 has had a chance to update it.
EDIT
I didn't switch branch before adjusting the makefile which will explain my problem.
After starting over using the localonly branch and applying Matt's tiles fix, I can confirm it both builds and I can start the game but yeah, it's pretty glitchy.
I think I've found the fix for the messed up text. Replace:
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -Os -fsigned-char -ffunction-sections -fno-inline ##-mcall-prologues
With
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -Os -fsigned-char -ffunction-sections -fno-toplevel-reorder
in the Makefile.
Hi @kivan117
Just to let you know that I recently updated the Uzebox getting started guide with a Tutorials section and I've linked to Ghosty ghost as the best example of a well commented Uzebox game so it'd be great if you could update it to get it building cleanly.
You should find it easier to get a Uzebox dev environment set up from the revised wiki instructions. I wrote the Linux guide and Uze revised the Windows instructions recently.
I'm trying to learn to code for the Uzebox and gghost looks like it would make a great example for a beginner to pick apart, if it would build against recent Uzebox kernels at least. It would make a good learning aid because it is a simple game and you've commented almost every line - thanks for that!
After changing VRAM_TILES_V to 32 in the Makefile, I get as far as this: