StarBugz game prototype and engine (using Gu) with source
StarBugz game prototype and engine (using Gu) with source
This is a prototype of StarBugz, a Space Invader clone. The purpose of the project was to get myself familiar with programming PSP games, and hopefully to build up a simple game engine in the process.
After working on the project in my spare time for nearly a month, the hardware accelerated 2D game engine, called JGE (Jas Game Engine), was basically done. JGE uses Gu libraries for image rendering and StarBugz now becomes a small showcase of the engine, demonstrating various features of it.
Here are few screen shots of StarBugz:
I've learned everything about programming the PSP from the PSP homebrew community, including this forum and source code from http://svn.ps2dev.org. I guess it's time for me to give a small contribution back to the community. Here is the complete source code of StarBugz prototype, the game engine JGE and also a small demo of the engine.
(Just a side note: The classes/functions naming of JGE is based heavily on HGE, a Windows based 2D game engine, as I found HGE such a good game engine to play with! Thanks Haaf! In fact, my goal is evetually have the same source code of StarBugz to build with JGE and HGE at the same time!)
StarBugz/JGE/JGE Demo source 375KB
Firmware 1.50 binary(MD5:f291af03ab01033e7d63a8ba6478d64c) 815KB
Special thanks to my lovely wife for her support and beta testing StarBugz for me.
After working on the project in my spare time for nearly a month, the hardware accelerated 2D game engine, called JGE (Jas Game Engine), was basically done. JGE uses Gu libraries for image rendering and StarBugz now becomes a small showcase of the engine, demonstrating various features of it.
Here are few screen shots of StarBugz:
I've learned everything about programming the PSP from the PSP homebrew community, including this forum and source code from http://svn.ps2dev.org. I guess it's time for me to give a small contribution back to the community. Here is the complete source code of StarBugz prototype, the game engine JGE and also a small demo of the engine.
(Just a side note: The classes/functions naming of JGE is based heavily on HGE, a Windows based 2D game engine, as I found HGE such a good game engine to play with! Thanks Haaf! In fact, my goal is evetually have the same source code of StarBugz to build with JGE and HGE at the same time!)
StarBugz/JGE/JGE Demo source 375KB
Firmware 1.50 binary(MD5:f291af03ab01033e7d63a8ba6478d64c) 815KB
Special thanks to my lovely wife for her support and beta testing StarBugz for me.
-
- Posts: 4
- Joined: Tue Dec 06, 2005 2:59 am
Good start to maybe a classic PSP game ;) I took the game out with me last night and let my friend's kids play on it, they loved it.. but got really frustrated at the boss fights.. you can't evade his shots, allowing free movement across the game screen. Thanks for the source, I've been learning C++ for the majority of this year, done a few x86 games and got a PSP for my birthday, its been quite a learning experience and late nights.
Keep releasing new versions and I will download them ;)
Keep releasing new versions and I will download them ;)
Im loving your engine dr_watson! Ive been PMing you questions and i thnik you for all your help, and you asked me to post here so that other people can share the answers too, so im going to post some of the questions ive asked so far. :)
Thanks for all your help, but how do i make a .png image from the font builder? It seems to only let me do BMP TGA and RAW.
and i changed a 32 bit TGA into a png, and now im getting a TON of multiple definition errors when i compile, one for each member of JLBFont.
The engine seems to be cutting off the bottom pixles of everything i display!
The files need to be to the power of 2, so it would be best to put alot of sprites onto one image, for example 256x256 or 512x512 and create quads out of that BIG image because you'll try to avoid switching textures.
Im having trouble with the fonts engine..
You need to create your font by using LMNOpc's Bitmap Font Builder.
If you take a look of the StarBugz source, for example, in Invader.h:
JLBFont* mFont;
then in Invader.cpp:
mFont = new JLBFont(this, "Res/f3", 16, true);
Note that for the first parameter of JLBFont, you need to pass in pointer of class derived from JGE! 16 is the height of the font!
Thanks for all your help, but how do i make a .png image from the font builder? It seems to only let me do BMP TGA and RAW.
and i changed a 32 bit TGA into a png, and now im getting a TON of multiple definition errors when i compile, one for each member of JLBFont.
No worries! I'm so glad that someone is actually using my little engine for something ;)
Obviously you need some tools to convert those BMP/TGA into PNG, for example PaintShop Pro.
For the font to be used in JGE, you also need to create a data file by using Bitmap Font Builder's menu option: "Save Font Widths (L+ABC format)". Say the name of your font is "xyz", you will have 2 files, "xyz.png" and "xyz.dat" evetually.
When you create your JLBFont object, supposed the height is 16:
mFont = new JLBFont(this, "Res/xyz", 16, true);
What errors did you have exactly? Can you post code segments and errors so that I can check them out?
Obviously you need some tools to convert those BMP/TGA into PNG, for example PaintShop Pro.
For the font to be used in JGE, you also need to create a data file by using Bitmap Font Builder's menu option: "Save Font Widths (L+ABC format)". Say the name of your font is "xyz", you will have 2 files, "xyz.png" and "xyz.dat" evetually.
When you create your JLBFont object, supposed the height is 16:
mFont = new JLBFont(this, "Res/xyz", 16, true);
What errors did you have exactly? Can you post code segments and errors so that I can check them out?
Yeah i changed it into a png with photoshop. I already got the .dat file too.
Im using Dev-C++ as my IDE, so this is what i get in the compile log:
thats the raw output, but it wont let me select all of the parsed error log, but heres a small part:
and basicly one of those for every member function of JLBFont.
Heres what i got to call and use the fonts:
Im not including anything twice, i dont know why its saying that.
UPDATE: Ive managed to reduce the amount of errors from around 27 to 19 by removing Main.o from my objects in my makefile. Ive updated the above errors with the new ones.
Im using Dev-C++ as my IDE, so this is what i get in the compile log:
Code: Select all
Compiler: PSP
Executing make...
make.exe -f "Makefile" all
psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -LC:/cygwin/usr/local/pspdev/psp/sdk/lib main.o JGE/JGE.o -lpng -lz -lm -lmikmod -lmmio -lpspaudiolib -lpspaudio -lpspgu -lstdc++ -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -lpspkernel -o PSPopups.elf
JGE/JGE.o: In function `JLBFont::JLBFont(JGE*, char const*, int, bool)':
JGE.cpp:(.text+0x2694): multiple definition of `JLBFont::JLBFont(JGE*, char const*, int, bool)'
main.o:main.cpp:(.text+0x0): first defined here
JGE/JGE.o: In function `JLBFont::JLBFont(JGE*, char const*, int, bool)':
JGE.cpp:(.text+0x2878): multiple definition of `JLBFont::JLBFont(JGE*, char const*, int, bool)'
main.o:main.cpp:(.text+0x1e4): first defined here
JGE/JGE.o: In function `JLBFont::~JLBFont()':
JGE.cpp:(.text+0x2a5c): multiple definition of `JLBFont::~JLBFont()'
main.o:main.cpp:(.text+0x3c8): first defined here
JGE/JGE.o: In function `JLBFont::~JLBFont()':
JGE.cpp:(.text+0x2ab4): multiple definition of `JLBFont::~JLBFont()'
main.o:main.cpp:(.text+0x420): first defined here
JGE/JGE.o: In function `JLBFont::GetStringWidth(char const*) const':
JGE.cpp:(.text+0x2b0c): multiple definition of `JLBFont::GetStringWidth(char const*) const'
main.o:main.cpp:(.text+0x478): first defined here
JGE/JGE.o: In function `JLBFont::DrawString(char const*, float, float, int)':
JGE.cpp:(.text+0x2b60): multiple definition of `JLBFont::DrawString(char const*, float, float, int)'
main.o:main.cpp:(.text+0x4cc): first defined here
JGE/JGE.o: In function `JLBFont::printf(float, float, char const*, ...)':
JGE.cpp:(.text+0x2d00): multiple definition of `JLBFont::printf(float, float, char const*, ...)'
main.o:main.cpp:(.text+0x66c): first defined here
JGE/JGE.o: In function `JLBFont::SetColor(unsigned short)':
JGE.cpp:(.text+0x2d88): multiple definition of `JLBFont::SetColor(unsigned short)'
main.o:main.cpp:(.text+0x6f4): first defined here
JGE/JGE.o: In function `JLBFont::SetBlendMode(int)':
JGE.cpp:(.text+0x2d9c): multiple definition of `JLBFont::SetBlendMode(int)'
main.o:main.cpp:(.text+0x708): first defined here
collect2: ld returned 1 exit status
make.exe: *** [PSPopups.elf] Error 1
Execution terminated
Code: Select all
C:\Documents and Settings\Owner\Desktop\Popups\Menu.o In function `JLBFont::JLBFont(JGE*, char const*, int, bool)':
(.text+0x0) C:\Documents and Settings\Owner\Desktop\Popups\Menu.cpp multiple definition of `JLBFont::JLBFont(JGE*, char const*, int, bool)'
(.text+0x0) C:\Documents and Settings\Owner\Desktop\Popups\main.o:main.cpp first defined here
C:\Documents and Settings\Owner\Desktop\Popups\Menu.o In function `JLBFont::JLBFont(JGE*, char const*, int, bool)':
Heres what i got to call and use the fonts:
Code: Select all
//in Menu.h:
#include "JGE/JLBFont.cpp"
class Menu: public JGE
{
...
public:
JLBFont* mFont;
...
}
//in Menu.cpp:
//in Menu::Create():
mFont = new JLBFont(this, "Res/08underground", 16, true);
//in Menu:Render():
mFont->DrawString("hello world", 10, 10, JGETEXT_LEFT);
UPDATE: Ive managed to reduce the amount of errors from around 27 to 19 by removing Main.o from my objects in my makefile. Ive updated the above errors with the new ones.
this line here:
#include "JGE/JLBFont.cpp"
what you should really put:
#include "JGE/JLBFont.h"
when you include "JGE/JGE.o" in your makefile, you don't need to include any of the ".cpp" file from "JGE/" folder.
#include "JGE/JLBFont.cpp"
what you should really put:
#include "JGE/JLBFont.h"
when you include "JGE/JGE.o" in your makefile, you don't need to include any of the ".cpp" file from "JGE/" folder.
Last edited by dr_watson on Sun Dec 11, 2005 11:58 am, edited 1 time in total.
:D it compiles fine now! Thanks!
But now i cant seem to get the alpha channel saved in the .TGA image, its just a blank white image, even when i save it as 32 bit. Is there another version of this font maker that can save directly as a .png with alpha?
And also im getting this:
It looks like its getting the width and height right, but starting too high.
But now i cant seem to get the alpha channel saved in the .TGA image, its just a blank white image, even when i save it as 32 bit. Is there another version of this font maker that can save directly as a .png with alpha?
And also im getting this:
It looks like its getting the width and height right, but starting too high.
Hey dr_watson, i think a great way to get ppl to use your engine would be to submit it to pspupdates along with a little description! Email pspupdates@contentholdings.com to do that.
I just love this engine and i dont like that not many ppl are using it.
I just love this engine and i dont like that not many ppl are using it.
-
- Posts: 171
- Joined: Mon Nov 14, 2005 1:32 am
- Location: Boston, Massachusetts
- Contact:
Thanks seventoes!
Thanks Wraggster too! He posted a news item for me on dcemu forum!
In fact pspupdates post a news for me not long after I post here in this forum as well :). Later on I did a post in their psp development forum.
I think the entire PSP homebrew scene is still relatively small. News spreads pretty fast!
Thanks Wraggster too! He posted a news item for me on dcemu forum!
In fact pspupdates post a news for me not long after I post here in this forum as well :). Later on I did a post in their psp development forum.
I think the entire PSP homebrew scene is still relatively small. News spreads pretty fast!
I'm new to this and seems I can't compile this project.
This is what I get.
What could be?
This is what I get.
Code: Select all
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/
pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -D_PSP_FW_VERSIO
N=150 -c -o ../JGE/JGE.o ../JGE/JGE.cpp
../JGE/JGfx.cpp: In member function 'void JGE_Gfx::Gfx_ScreenShot(const char*)':
../JGE/JGfx.cpp:441: error: invalid conversion from 'int*' to 'int'
../JGE/JGfx.cpp:441: error: initializing argument 4 of 'int sceDisplayGetFrame
Buf(void**, int*, int*, int)'
make: *** [../JGE/JGE.o] Error 1
-
- Posts: 107
- Joined: Sat Jan 13, 2007 11:50 am
Looks like your psp set of libraries (psptoolchain or whatever it is called) is out of date.XRS wrote:I'm new to this and seems I can't compile this project.
This is what I get.
What could be?Code: Select all
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/usr/local/ pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -D_PSP_FW_VERSIO N=150 -c -o ../JGE/JGE.o ../JGE/JGE.cpp ../JGE/JGfx.cpp: In member function 'void JGE_Gfx::Gfx_ScreenShot(const char*)': ../JGE/JGfx.cpp:441: error: invalid conversion from 'int*' to 'int' ../JGE/JGfx.cpp:441: error: initializing argument 4 of 'int sceDisplayGetFrame Buf(void**, int*, int*, int)' make: *** [../JGE/JGE.o] Error 1
@willow :--) - I think it's you who has the out-dated libraries, check the latest pspsdk and they changed this.
It seems dr_watson is using a somewhat stale copy of the toolchain for things. Anyway, I got this working with the latest toolchain (I recompiled the toolchain today, so I know it's recent) and working for 3.xx firmware (why everyone feels the need to use 1.5 I will never understand). I got rid of the exception handler as it was the only thing needing kernel mode and if the game doesn't crash, you don't need it (didn't feel like fixing it) ^^
d6237ddeeac1570a65a6eefeb4dd86f8 JGE_StarBugz_Src_v001_fw3xx.zip
f651e61b0d2e1c0193464d41c301bfe2 StarBugz_v001_fw3xx.zip
It seems dr_watson is using a somewhat stale copy of the toolchain for things. Anyway, I got this working with the latest toolchain (I recompiled the toolchain today, so I know it's recent) and working for 3.xx firmware (why everyone feels the need to use 1.5 I will never understand). I got rid of the exception handler as it was the only thing needing kernel mode and if the game doesn't crash, you don't need it (didn't feel like fixing it) ^^
d6237ddeeac1570a65a6eefeb4dd86f8 JGE_StarBugz_Src_v001_fw3xx.zip
f651e61b0d2e1c0193464d41c301bfe2 StarBugz_v001_fw3xx.zip
-
- Posts: 107
- Joined: Sat Jan 13, 2007 11:50 am
Oh but wait, Starbugz is made for JGE 0.2, which is seriously outdated (see the date of Dr_Watson's post)
I've encountered the exact same problem a few months ago while trying to compile JGE 1.0 with and old psp toolchain... so I assumed the problem was the same as mine, but it was actually the opposite : old JGE library With new tooolchain.
Edit : I should try to update my toolchain though... but I remember doing it less than 4 months ago... I should probably finish my current projects before updating.
I've encountered the exact same problem a few months ago while trying to compile JGE 1.0 with and old psp toolchain... so I assumed the problem was the same as mine, but it was actually the opposite : old JGE library With new tooolchain.
Edit : I should try to update my toolchain though... but I remember doing it less than 4 months ago... I should probably finish my current projects before updating.