I want to go a little more in detail about what PenjinPrescale is actually doing. When scaling an image you have a few alternatives depending on the graphics API used and so on. In PenjinTwo I have included Scale2X if using SDL, you can change the display port size if using OpenGL/GLES and I also provide the option to use prescaling.
Prescaling is resizing the sprites/images at load time. PenjinTwo is setup to use states. In code written in this intended format you load the sprites when the state is created. While the sprite is loading if PenjinPrescale or PokeScale is active it will resize all images, text glyphs in this loading period.
In the PenjinTwo config file you can set a BaseResolution which is the native resolution of your application. You can set this up in code an it will be written to the config on startup or shutdown. You can also set a Resolution which is a target resolution. From the BaseResolution and target resolution we can calculate a horizontal and vertical scale factor and using the scale factor we can ensure that all images are scaled correctly at load time (Using an optional smoothing filter).
Generally I have tried to ensure that game logic is kept the same irrespective of the scaled output, where internal classes have been used, they know to take the scale factor into consideration. In some cases you may need to work around scaling problems and the scale factor can be obtained from the GPU object.
Hi guys so it's been a long while and it seems I am sucking at keeping this blog of mine going. But in any case here is a new entry for you. I have finished a lot of work that means PenjinTwo is now compiled as separate modules and you can more easily pick and choose.
I have also finished the major work to replace SimpleIni with a self- written INI file loader. I have a little bit of work to finish this but it works in the basic sense. Some of the things I need to continue with are avoiding unnecessary saving and also my idea for having a KEY_ID = VALUE system. That is for every KEY you can have an ID number to simplify things like level loading.
Took a lot of thinking to sort it all out but I've managed to figure out how to select the Renderer at runtime… although it's not quite working. This will eventually let you change a config file and pick GL/SDL rendering as you wish. Currently if you compile for GL and configure to use SDL it doesn't create the window properly… Hopefully some inspiration or suggestion from someone will help me progress this. Also the GL renderer has some weird bugs that I haven't any ideas about, at present.
You may have noticed that Project Infinity has some advertisement banners and google custom search implemented. Well this was always the intended plan, but only recently have I found a way to implement it in a convenient way. This is just me trying to recover some of the costs involved in keeping this site open! If of course the advertisements bug you that much, please feel free to install Ad-block or similar!
The Pirate Games MineCraft server is doing reasonably well these days we are averaging 5 or 6 users per day. Please feel free to join us online:
Well it turns out I didn't win anything in the compo, but it was fun taking part, and there were some great titles produced. Congratulations to everyone that took part and to Uni for organising such a well run compo! PirateBaby was not finished for the compo but people did vote for it in this unfinished state, Thanks guys!
I have previously been throwing some code together for an algorithm I've had in my head for quite a while. I showed some promise in my previous blog post. After the pressure of the compo subsided, I worked a little more on my scaling algorithm… rewriting it again! And this time I have results that are good enough to be included in PenjinTwo. It is an optional filter and is used in conjunction with the PenjinPrescale feature, whereby Sprites are rescaled at loadtime. I currently have a screenshot from the current build of PirateBaby.
Well hello there! I've been a busy bee as usual and my biggest news is I'm now a DAD! I have a healthy little boy. Well done Mrs PokeParadox! :D
So down to business, I have been rewriting Penjin from the ground up and made a fair bit of progress. I've made the code available on github. It uses the same simple approach but has the following new features:
The rewrite is also introducing cleaner, easier to maintain code and a better class hierarchy, removing copy-pasta code.
PirateBaby is a virtual pet style toy and is progressing nicely and is by myself(code) and Dragons_Slayer(graphics), although many images are still place-holders. It is our entry for the RiOTdigital Tag-team Coding Competition.
I'm not sure if we'll be able to meet the deadline, but here is a newer screenshot.
Finally in the last couple of days, I started working on a scaling/smoothing filter, intended scaling sprites. Today I got some nice images out of my attempts, but there are still some bugs as you will see below.
I currently doubt it could be used as a real-time filter, but the intended use is for pre-scaling sprites on image load.
Well it would appear that I forgot to give you guys anything interesting to read again… Life has a tendency to have things happen and those things, coupled with actually using time to develop and such meant that I never got around to doing a blog post… yeah I know, excuses excuses.
I think overall the project went well. Were there any things that I would do differently? Sure… if there wasn't then it wouldn't be much of a learning process. The important thing is that the result was the intended result. We managed to bring a nice, fun launch title for the Pandora made for and by the GP32X community.
I've been looking into spiffing up the Pirate Games site 1) and basically I found a rocking CMS, Concrete5. This is a good immediate solution since we've had issue after issue getting a homepage that works.
Penjin has seen some good progress since switching to being open-source, most of which during the development of PandoraPanic! and it is a completely usable project and already quite versatile. I had some chats with foxblock and we agreed that maybe it could some restructuring and tidying up… it has begun. I planned out a nice class diagram and have much of the structure reworked for the better. Also this is another chance it properly introduce Deoxygen comments so we can auto-generate the help manual… I now understand how it works a lot better so maybe, just maybe you guys will have some documentation as well as the live support I provide to anyone that asks!
Pirate Games has a few ongoing projects; MarkoeZ is still continuing his work on Panjoust, I'm still working on Biotix and have progressed things a little further… I have slowed down since I have some problems I need to figure out before continuing to plug away at the keyboard… Another project started is NovaKitsune which is basically on rails space shooter akin to classic StarFox, work has been done preparing code that is GL and GLES compatible and a basic model viewer and camera is done. Apart from that bugfixes, more bugfixes and real-life… so hopefully… now I can keep updating this thing better this next year…
So yeah it's been a long long while since I bothered writing anything here… but the problem is that I now use Twitter… And it's easier to quickly post micro-updates there. Anyway… down to brass tacks.
Penjin is still progressing nicely, the SDL version is very usable and MarkoeZ and foxblock are putting it to some good use in their projects: PanDjoust and Wandor, respectively. Both are shaping up to be very promising games which use and demonstrate the tools that Penjin provides. The OGL back-end is recently getting some love, there have been a number of bugs fixed, including rotations. Work has been done to get the GL code to be ES1.x compliant and this is still ongoing.
Foxblock has given us yet another mini-game recently, a follow the ball in the cup affair with the Pandora logo! I've been working with Pickle to try and iron out one remaining critical bug… he's got the hardware, I know my code… so it's kind of like email chess of bug fixing… The current problem is to do with angles and rotations2) And some games are rotating objects correctly and other aren't. This only occurs on the Pandora build…Very puzzling.
My “secret project” which I may have written about previously… I don't actually remember; Is in full swing. It is currently called Biotix and it will use OpenGL ES for rendering. It goes without saying that it will use Penjin too. Biotix is being written from scratch and is, in essence, a sequel to CromoZome. Code is in early stages, but I'm hoping to provide a game where the creatures actually evolve and interact. That's all I want to say currently, I'm hoping I can get a very early demo together soon.
Pickle has been a great asset in narrowing down the problem of getting PandoraPanic! to actually successfully start on the Pandora, although the situation did illustrate the problems of time zone and schedule differences. Pickle would ask me for the next function to step into and I would examine my code and see where to go next. It was kind of strange but we finally narrowed down the problem to the Music class.
Whenever I get a bug like this that has me kicking myself, I do like to make a habit of pointing it out to others. It's not because I like to look like I make a lot of mistakes (which I do… I'm only human.) But it serves as a reminder to myself and others certain “gotchas” that you can fall into when writing code.
The code was getting to around here before triggering an fpe.
music.loadMusic("music/PandoraPanic_Title.ogg"); music.setLooping(true); music.play();
Now this either meant that the music file wasn't being loaded properly (doubtful, but I checked with Pickle about the filename just to rule it out.) or the only other possibility was that SDL_Mixer wasn't being initialised properly.
I checked with my engine initialisation code and I was doing a call to Music.init() so it should be initialising… But looking into what Music.init() was doing…
#ifdef PLATFORM_GP2X Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 128); #endif #ifdef PLATFORM_PC Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 512); #endif
we can see it is missing is code to initialise Audio on PLATFORM_PANDORA. This should illustrate the dangers of using #ifdefs and also wrapping library functions. It can be more convenient if you needs slightly different code to be compiled for different platforms 3) but it can obscure a problems.
It should be noted that this code to initialise sound is very early code in my framework. Back then I didn't even know about the #elif preprocessor! As soon as I thought the sound initialisation was to blame I could see the problem with the code above. There is no fallback for the #ifdef. So I added one.
#ifdef PLATFORM_GP2X Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 128); #elif PLATFORM_PC Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 512); #elif PLATFORM_PANDORA Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 256); #else Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16, MIX_DEFAULT_CHANNELS, 512); #endif
With that fix in place, PandoraPanic! is successfully running on Pandora hardware. The controls need to be mapped sensibly for the hardware, but currently I think SDL has some issues accessing the gaming buttons. So I'll have to map to some keys as a placeholder. I hope a playable version can be demoed soon.
Well I thought it might be about time to make a little update here. I've been busy… really busy! A little tired/demotivated at times, but on the whole busy!
SimpleJoy is generally finished now. It's perfectly usable. I spent a lot of time getting most of the common input types4) and the respective methods they supply inputs5) supported and mappable in the configuration scripts. That's a lot that's been done, but there's still a lot intended that can be done.
Things are coming a long nicely and there is many thanks to the Pandora release is having problems and being delays. Of course I want my Pandora NOW! but on the positive side of things, we are catching more bugs, adding more features and more mini-games. Some of the recent developments are:
Recently the new test builds were uploaded and you can grab them here.
I recently updated to the 9.04 release of Ubuntu and in turn the new release of VirtualBox. I must say, I'm really loving it. I am trying to get ReactOS working satisfactory, but it's still early days. I would just like a windows compatible OS to run in VirtualBox that I can test Windows builds of my projects in. In anycase I've gone for “a compact as possible” XP install. I installed the Guest Addition and the 3D Acceleration drivers and managed to compile an OpenGL test project, excellent. Very soon I'll be able to lessen the grip that Windows has over me, which is a great feeling. I just hope that the ReactOS team can bring their project to a more mature state, so that I can completely remove XP and just use WINE/ReactOS for anything Windowsy.
I have the setup to map devices supported through SDL, Buttons are mapped using Polymorphic classes which contain the SimpleJoy action and the relevant target key, which will trigger the SimpleJoy action.
The current obstacle is handling all the possible mappings to SDLKeys. That is one for each key on the keyboard, and some of the special keys. Obviously some are not needed for the Pandora, but all bases will need covering, in case a USB keyboard is plugged in. Everything will need testing, but the code layout seems to make some sort of sense.
Ability to map to multiple USB controllers, Mice7) I also would like to provide some form of “pass-through” function for keyboard so that you can also use SimpleJoy to type, e.g. in an Name entry screen.
There are not as many updates as I would like, but I have had trouble trying to fix my particle engine. I've had to revert changes four times or so. Very annoying.
OK… that's not really the case, basically Dragons_Slayer is my new best friend, since he's been waving his magic wand and beautifying my mini game and the spites look amazing! We also have a new logo for Penjin itself:
a Video update: