Congratulations Krisse!… as always, I’m impressed by how well it runs on HW… would love to see the code :-).
jorgeche
I think your hopes are too high about homebrew… or you really don’t realize how much difficult and time consuming it is to create a game by yourself; it is not only the programming (which is a huge task by itself), but creating the graphics, sounds, design the levels, etc, etc,etc are to many task for a single person to do.
It is sad that the VB homebrew scene is quite little, but there are brilliant people here who had made a lot of awesome stuff, not only games or demos, but research and hacking the machine to let the rest of us know how it works, and all of them have been very kind when asked for help about programming for the VB.
About the games… Blox is just ok??… It was programed by someone who doesn’t even is a programmer professionally!, and it works great on hardware!… I assure you that half of my programming classmates will never understand by them selves how to display an image in a specialized machine like the VB… or any game console for that matter, let alone make a game that not only works in the emulators but on the real hardware.
It is a shame that not many commercial games took advantage of the VB’s capabilities, but making that criticism to the homebrew games is not fair, being that every homebrew demo is an achievement by itself because of all the effort that it requires to program using hacking docs, not to mention that as far as I know, none of the persons who have contributed with their code are being paid for it, and have shared their work with you for free.
Not trying to be harsh… but sometimes we gamers ask to much.
jorgeche
Hi, as I promised, here is the weekly update of my entry for the competition.
jorgeche
Attachments:
Thanks Deadly-D, I was really tempted to do some bump to achieve the 100th post :-).
jorgeche
Thanks rubengar… will be posting weekly updates of the demo until the end of the competition. Hope all you like it.
jorgeche
- This reply was modified 16 years, 5 months ago by jorgeche.
Ups.. I forgot to include the sound… but here is a new one with the bgm you gave me a long time ago.
(but not sound effects, the engine supports up to two sfxs and one bgm at any given time, but I don’t have the patience to write/convert them).
I runs beautifully on HW BTW :-).
jorgeche
Attachments:
I use BGMAP for everything in my engine and left OBJs for latter expansions… now I have a use for them: particle effects which I’m designing know :-).
jorgeche
I think it will be very difficult to came with a standard library since a lot of us have made many changes to the common code, for example here is the function I use to read user input, which reflects the need I have with my engine:
/* Reads the keypad, returns the 16 button bits */
u16 vbReadPad(){
unsigned int volatile *readingStatus = (unsigned int *)&HW_REGS[SCR];
HW_REGS[SCR] = (S_INTDIS | S_HW);
// save last pressed key
previousKey = currentKey;
//wait for screen to idle
while (*readingStatus & S_STAT);
// now read the key
currentKey =1
# List of header files.
HEADERS := $(foreach DIR,$(DIRS),$(wildcard $(DIR)/*.h))
# Makes a list of the object files that will have to be created.
OBJECTS := $(addprefix $(STORE)/, $(SOURCE:.c=.o))
# Same for the .d (dependancy) files.
DFILES := $(addprefix $(STORE)/,$(SOURCE:.c=.d))
# Specify phony rules. These are rules that are not real files.
.PHONY: clean backup dirs
# Main target. The @ in front of a command prevents make from displaying
# it to the standard output.
$(TARGET).vb: $(OUTPUT)/main.elf
@echo Creating $@
@$(OBJCOPY) -O binary $(OUTPUT)/main.elf $(OUTPUT)/$@
# @$(OBJDUMP) -t $(OUTPUT)/main.elf > $(OUTPUT)/sections.txt
# @$(OBJDUMP) -S $(OUTPUT)/main.elf > $(OUTPUT)/machine.asm
# Pad rom to fit 1 MB
@echo Padding $@
@lib/padder $(OUTPUT)/$@
$(OUTPUT)/main.elf: dirs $(OBJECTS)
@echo Linking $(TARGET).
@$(GCC) -o $@ $(OBJECTS) $(LDPARAM) \
$(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) $(foreach LIB,$(LIBPATH),-L$(LIB))
# Rule for creating object file and .d file, the sed magic is to add
# the object path at the start of the file because the files gcc
# outputs assume it will be in the same dir as the source file.
$(STORE)/%.o: %.c
@echo Creating object file for $*…
@$(GCC) -Wp,-MD,$(STORE)/$*.dd $(CCPARAM) $(foreach INC,$(INCPATH),-I$(INC))\
$(foreach MACRO,$(MACROS),-D$(MACRO)) -c $< -o $@
@sed -e '1s/^\(.*\)$$/$(subst /,\/,$(dir $@))\1/' $(STORE)/$*.dd > $(STORE)/$*.d
@rm -f $(STORE)/$*.dd
# Empty rule to prevent problems when a header is deleted.
%.h: ;
# Cleans up the objects, .d files and executables.
clean:
@echo Making clean.
@-rm -f $(foreach DIR,$(DIRS),$(STORE)/$(DIR)/*.d $(STORE)/$(DIR)/*.o)
# @-rm -f $(TARGET)
@-rm -f $(OUTPUT)/*
# Backup the source files.
backup:
@-if [ ! -e .backup ]; then mkdir .backup; fi;
@zip .backup/backup_`date +%d-%m-%y_%H.%M`.zip $(SOURCE) $(HEADERS) $(EXTRA_FILES)
# Create necessary directories
dirs:
@-if [ ! -e $(STORE) ]; then mkdir $(STORE); fi;
@-$(foreach DIR,$(DIRS), if [ ! -e $(STORE)/$(DIR) ]; \
then mkdir -p $(STORE)/$(DIR); fi; )
# Includes the .d files so it knows the exact dependencies for every
# source.
-include $(DFILES)
Hopes it helps, I didn’t have to modify a single line of it to use it in Windows with Cygwin.
jorgeche
*/
I haven’t thought about the 50 fps… I will check today how that looks on hardware, but what I did test were 30 FPS and 60 FPS, and at 60 FPS it was a lot smoother than at 30.
About the wait frame, I’m using it before writing world values in the render method of my Map class:
//create an independant of software variable to point XPSTTS register
unsigned int volatile *xpstts = (unsigned int *)&VIP_REGS[XPSTTS];
//wait for screen to idle
while (*xpstts & XPBSYR);
// write the world’ values
WORLD_HEAD(31,XXXXX;
I haven’t used the hardware frame control for anything else.
jorgeche
Hey, I think I missed the matter, I was thinking about delays which create a pause in the execution of a program, like the ones I use in the boot of my games to not allow the player to pass the logo screens before watching them for 2 seconds, not delay in terms of animation or things like that.
I’m not really sure how to use the in hardware frame counter, but I found how to lock the frame rate of my engine to run at 60 FPS, that way all my animations are based on that measurement, each frame is 1/60 of a second… and from there I can calcultate how much time a frame of animation must live.
jorgeche
Regardless of the vbWaitFrame function, I’m with you DogP, I found too many problems using it (mainly because it was not properly implemented since a code like this:
while (VIP_REGS[XPSTTS] & XPBSYR);
when using the optimizing capabilities of the compiler, is and infinite loop) that and the delay is completely random.
but i didn’t found a fix until I properly implemented the clock interrupt, now I have a solution, but it is part of my engine which uses the libgccvb, I use a class called Clock, which implements the following method:
//time delay
void Clock_delay(Clock * const this, u16 miliSeconds){
float time = Clock_getTime(this);
while((Clock_getTime(this)-time)*1000 < miliSeconds);
}
the Clock class has all the necessary information to create a precise delay, so all the Clock's attributes could be expanded as static variables in a c file, but I like to abstract all what I can as a class, and it's is helpul to have more than one clock in a game (more in the vb where you need the automatic pause feature).
I like the open source idea, indeed, my own engine will be released with the whole source code, but it could be helpfull if there is a standard library, one which has the memory mapping, register settings and possible values, etc. And functions implementations can remain open.
About a character printing system, the way I implemented it is using the vbPrint function:
void vbPrint(u8 bgmap, u16 x, u16 y,const char *t_string, u16 bplt);
but since in the engine I'm mannaging the bgmap memory I implemented facade functions:
void printInt(int value,int x,int y);
void printHex(int value,int x,int y);
void printText(char *string,int x,int y);
void printFloat(float value,int x,int y);
and they ask the BGMapManager which is the next free bgmap to use to print text, so this managers keep track of the last bgmap segment used for graphics, and use the next for this kind of printing. I use these functions maily for debugging.
I know that there could be a lot better ways to do it, but I like simple functions which do the hard work for me :-).
I could post the libgccvb I'm using if someone is interested (but be aware that I use the last gccvb which must be compiled).
I almost forget, i have a Textbox class too, which is used to print text but in 3D space, so you can specify the coordinates for the textBox and the engine calculates its parallax, projection, etc. But it is different to the printXXX functions because this kind of text is displayed using a world, and the placement of the text in bgmap memory is optimized.
jorgeche
- This reply was modified 16 years, 7 months ago by jorgeche.
Hi there, I could post the libgccb I’m using right now, it has some fixes and is now separated in header and source files, that way we could distribute a compiled library, only allowing changes to the committee.
jorgeche
Hey, It would be great if you can post the source code, I made some vector drawing some time ago, and even had parallax, but when tried to fill the polygons I got stuck with the performance so I decided to focus my work on the bitmap engine.
jorgeche