You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
libgccvb committee
Posted on: 2008/6/12 17:08
Administrator
Joined 2000/1/8
Germany
2516 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) App Coder90+ Game Ratings
one thing i am missing is a consistent library. there are numerous versions of libgccvb floating around, and everybody seems to have his own modified/updated version.
for example, i have just messed around with the source to dogp's etch-a-sketch, which includes a customized libgccvb with numerous very useful functions and mnemonics, for example for direct screen draw, which can not be found in any other libgccvb version i have seen.

so, to give everybody the best possible tools and to avoid confusion, why don't we all try to work towards a consistent library with regular releases, always being kept on the latest point of knowledge?
Top

#2
Re: libgccvb committee
Posted on: 2008/6/12 21:36
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
It would be cool, now how can we merge all the versions?, I have made a lot of changes to the library for my project, even separeted the declarations and implementation in .h a .c files to not have link issues.

jorgeche
Top

#3
Re: libgccvb committee
Posted on: 2008/6/12 22:02
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Even though I haven't been programming for very long, I did notice that there are an awful lot of libgccvb's floating around.

I don't know where you would begin merging them. You could probably start by just taking the most basic and useful functions from all of them, and moving them into one file (e.g. vbSetWorld, vbReadPad, etc.) You could add on more things (like direct screen draw) from there. I need to take a look at that etch a sketch demo...
Top

#4
Re: libgccvb committee
Posted on: 2008/6/17 21:28
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
I am behind this 100%.

I think we should start with Jorge's version and make a standard ELF library and a libgccvb.h which includes other .H files broken down by category.

Then we can update http://gccvb.sf.net/ and use Source Forge's CVS repository to keep track of changes.

Once we have that established, I encourage everyone who has released a demo to convert it to compile with the new library.

The first thing I want to add is this minimal *printf implementation I found. The included sprintf function can be used with the current vbPrint/vbTextOut functions to output to a BGMap, or an initialization function could be written which automatically sets up the font Chars, a BGMap/World for display, and variables for tracking the cursor position, etc. Thus, printf itself would "just work" as it does on a PC. It could also be used when transmitting data to another VB (or to a PC) over the link port.

After this we could start adding VB-specific versions of other stdlib functions.
Top

#5
Re: libgccvb committee
Posted on: 2008/6/18 0:47
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
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
Top

#6
Re: libgccvb committee
Posted on: 2008/6/18 6:36
PVB Elite
Joined 2003/7/25
USA
1507 Posts
PVBCC 1stCoderContributor#3 PosterHOTY09 EntryLong Time User (15 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
I agree that we should have a standardized library, although I've been wishing this for a long time, and unfortunately it may be too late for me. I've done WAY too many programs with my personal libgccvb.h, and I'm not particularly interested in changing all my current projects over to a new system, and definitely have no desire in updating any of my old code to work with new libs.

One suggestion though would be to have #ifndef FUNCTIONNAME #define FUNCTIONNAME #endif around every function. This way we could have our own customized libraries #included before this one (with #define FUNCTIONNAME), and they'd override the default libraries. This would be useful for using asm optimized functions, or special requirements for that specific application, or just for laziness of porting from the old libgccvb.h that the app was originally compiled with.

I also agree about printing functions, but I don't think there should be a printf() function. I think there should be sprintf(), which can be passed to the display function. The VB does not have a terminal output, and shouldn't be treated like you would running a PC console app. If you have it print to a string, then you can decide what to do with the string, either by writing it to the display using vbPrint() or something similar, or to the link port, or just to memory (like saving high scores).

I also think the ASCII table should be modified from the current 256 char one to just the standard 7 bit 128 char one (with one of the non-printable characters being the blank char so you can have transparent - space isn't transparent when you have the text "highlighted"). We don't have unlimited resources, and there's really no reason to have extended ASCII (or if you really need it, add it in your own specialized lib). I guess the unprintable characters could also be replaced with special extended chars that people may use if anyone thinks that they'd actually be useful.

Another one I hate is the vbWaitFrame() function. This has had MANY different versions, and they all suck :-P. To me, waiting a frame would be a display or game frame. This has almost always been just a delay of arbitrary length, with the exception of a few versions that actually wait a full frame. The problem with waiting an unknown length is that it changes from version to version, and the waits are all messed up... and the problem with waiting a full frame is that it doesn't give you an exact amount of time that it waits, and it's also too long for most simple waits (main game loops should be based on this, not short pauses). IMO, we should have an asm function with the proper number of clock cycles counted to get near exact (minus small overhead in/out of the function) to a specified amount of time. Then call the function something like usPause() for microsecond pause (which will always stay at 1us regardless of anything). With an unsigned integer passed to it, we could wait anywhere from 1us to over an hour. I think I even wrote a function like this in asm a long time ago.

I disagree about using precompiled libraries. I like to make modifications to libraries, and especially on the VB, many of these libraries are not optimal, and based on old information (they work well enough, but using new info, they could be made better). I think the headers should be freely available for anyone to modify, and especially to view as a reference... although people should realize that it's preferred to keep the libraries standard, which is why I think we should use #ifndefs in the standard libraries, and encourage people to make copies in their own headers. That's another problem with standard libraries is that many of these functions are in their infancy, and you can't continue to make these things backwards compatible forever when they should have been done some other way.

Anyway, I haven't seen jorgeche's libs, but I know Parasyte had logically broken them down into several .h files a while ago, so it may be worth checking those out too.

DogP
Top

#7
Re: libgccvb committee
Posted on: 2008/6/18 10:43
Administrator
Joined 2000/1/8
Germany
2516 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) App Coder90+ Game Ratings
Quote:

DogP schrieb:
I also think the ASCII table should be modified from the current 256 char one to just the standard 7 bit 128 char one (with one of the non-printable characters being the blank char so you can have transparent - space isn't transparent when you have the text "highlighted"). We don't have unlimited resources, and there's really no reason to have extended ASCII (or if you really need it, add it in your own specialized lib). I guess the unprintable characters could also be replaced with special extended chars that people may use if anyone thinks that they'd actually be useful.


right, for us europeans, it would be very useful to have special characters like ń, ÷, Ř, ▀ instead.


Quote:

DogP schrieb:
Anyway, I haven't seen jorgeche's libs, but I know Parasyte had logically broken them down into several .h files a while ago, so it may be worth checking those out too.


yep. i have uploaded the lib i am using currently. i don't remember where exactly i got it from, but it is unchanged for the most parts (i created a pvblib with additional functions instead of modifying libgccvb).


furthermore, i think it would be nice to have a short decription of each function and meaning of the input parameters.

Attach file:


zip libgccvb.zip Size: 11.40 KB; Hits: 218
Top

#8
Re: libgccvb committee
Posted on: 2008/6/18 20:33
Nintendoid!
Joined 2006/3/15
Ecuador
234 Posts
PVBCC 3rdCoderLong Time User (13 Years)
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
Edited by jorgeche on 2008/6/18 20:50
Top

#9
Re: libgccvb committee
Posted on: 2008/6/19 2:23
PVB Elite
Joined 2003/7/25
USA
1507 Posts
PVBCC 1stCoderContributor#3 PosterHOTY09 EntryLong Time User (15 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
The timer is nice, but it's a bad idea for delays. Timers are especially good for running in the background while you're doing other stuff, then you can know how long something has been going. For a wait loop, you want it to block execution until a specific amount of time has gone by. There's no reason to use a timer when you can count clock cycles and have the CPU run in a loop for that long (plus it's more precise and accurate). If the standard library mandates that to use a wait you must have the timer enabled and running, then we lose the ability to have control over a really useful piece of the hardware.

About the optimizer causing an infinite loop, you need to change VIP_REGS to be volatile. The old gccVB didn't optimize that, but the new one does.

DogP
Top

#10
Re: libgccvb committee
Posted on: 2008/6/19 8:38
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
Re: Timing

I'm not a game programmer (no matter how much I pretend to be ) but I always thought it was best to keep track of how many display frames have been drawn and base your animation and such on that. For example, if you have a sprite animation that needs to wait 200ms between frames, and your system draws a frame once every 20ms, you would count 10 display frames and increment the sprite frame. To me, this sounds like a perfect way to use the current vbWaitFrame function; except maybe with an added counter variable.

Synchronizing things by making the CPU stop doing anything for a time, even if it's measured in microseconds, just sounds like a waste to me...

There even exists a thing on the VB that makes "Game frames" out of "Display frames" based on a multiplier. It will even register an error if the VIP takes more than one display frame to render all the Worlds. I don't know exacly how this is meant to be used, but it sorta sounds like what I explained above...

Like I said, I'm no game programmer. But maybe that's a good thing
Top

 Top   Previous Topic   Next Topic


Register To Post