GP2X Sgzengine


Stuckie

Member
Joined
Apr 7, 2004
Messages
492
Age
38
Location
Tired, and sleeping in the basement...
Website
www.stuckieworld.net
You may have read in the Pandora area about me wanting to port an engine to the Pandora, that runs Lua-based scripts with extras in what equates to a VM/Sandbox styled engine.

I've just fixed a few things and have it compiling on the GP2X :)

SGZEngine is my older engine, however.. my newer one ( codenamed SGEngine.. because I like confusing people ;) ) requires dynamic linking, as each major component - Renderer, Audio, Input, etc.. - are in separate linked libraries to load in on runtime which proves to be stupidly awkward on the GP2X. You can tell this was another experimental Uni project ;) That said, the script interface itself can be dropped and changed between both engines very easily, so there's no harm in having the older messy engine for the GP2X and the cleaner one for the Pandora and Wiz ( which, seeing as it's been postponed to February, I may have enough money by then to get one! )

Sometime next week, I'm going to do a release of the code, and hopefully some documentation too.
I'll try document as much as I can, but there's a stupid amount of functions exposed to Lua, and as it's the original engine, the extra bits that were added during Plight of The Weedunks - which did get documented to some degree - don't exist.

Once this first release is done, I'll be going back into the code and optimising the crap out of it.
Don't be alarmed when you run the demo app and it's not all that fast.. here's a few things to keep in mind:
-- Though the majority of the engine is in C++, barely anything is const safe.
-- Barely any function takes parameters by reference or pointer, instead creating local copies and instances.
-- The original engine was coded from scratch in one year, on top of several other coursework projects.
-- My toolchain is a bit buggered and contains a mish-mash of library versions.. and though I think it may have linked with the latest HW-Accelerated SDL 1.2.13, I'm not sure... also my version of SDL_mixer won't play mod files, and there's probably some other little gotchas in there somewhere.
-- Several bad code practices that crept in due to lack of time in getting everything done.
-- There were 240 warnings that CodeBlocks spat at me when doing the Windows build ;) ( though I think those were due to redefines of some things )

All those problems aside, however.. it does work!
With time, I'll be able to get it to work better :) Luckily at the moment, I've got the time, and lots of it!
Once the Pandora and Wiz come out, I'll port it to them as well, and hopefully let anything created with it be automagically ported with it, save for possibly some config issues ( screen resolution, button configs, etc.. )

Also, if I can find my GP32 ( it's in a box... somewhere.. having just recently moved back from Uni, I have no idea where anything is! ) I might have a quick go at backporting it.. though I fear the Lua overhead itself might kill it. Can but try... would be fun to attempt it anyway :)

At the moment, I've basically ripped out all extra platform support bar Windows, Linux and GP2X.. though I've managed to bugger up the controls on the GP2X just now, hehe.. this'll be fixed for the weekend, but just now, I thought I'll get something put up for people to see if it works on other hardware and get some feedback on it ( I've found that one version of the engine doesn't like Vista, doesn't run right on XP either, and has some other little quirks ... so as limited as the below demo is.. if people could at least run it and let me know it works, that'll do for now :) My First Edition F100 GP2X is also at firmware 2.0 ... so I've no idea if it runs on newer/older editions/firmwares.. again, let me know please! )

http://www.stuckiegamez.co.uk/apps/SGZEngi...-14-NOV-2008.7z

That 7z ( of about 2.5mb ) contains a Windows binary ( plus all the SDL DLL gubbins ) and a GP2X binary ( SGZ2D.gph.gpe .. spot the open2x toolchain user ;) ).
If the Wiz has some sort of binary compatibility with the GP2X, if someone feels like testing it on that ( or let me know how to setup a toolchain to output a Wiz binary ) gimme a shout :)

Oh and those that used the search to see what I've previously been up to, will notice that the small demo contains some Tiny Critters content ;)
 
I've been doing some major refactoring of the engine the past couple of days.

After the initial shock of seeing 240 warnings on a recompile of the current codebase wore off... I set GCC to pedantic and to stick to ANSI standards... it shot up to 3,800 warnings! :lol:
So I decided to totally gut the engine and rebuild chunks of it...

Everything should now be const safe, as well as conform somewhat more to the C++ standards.
There's a mass of optimisations that have gone in, including basic things as placing inlines on functions that weren't done!
And, it's slightly more friendlier to use if you're wanting it just as a C++ framework and run "the odd Lua script," rather than employ the Lua interface exclusively... though I do need to fix the Script Manager in order to juggle Lua scripts properly to allow this ( as it's primarily geared to just throw everything to Lua. )

What I'm going to do now, is document the script interface and build an example game using it.
This will be done for Thursday ( I have an interview on Friday, so it'll be useful to take with me as an addition to the rest of my portfolio :) ) where I'll release tested engine binaries for Windows, Linux ( Ubuntu 8.10 anyway.. but they should work elsewhere ) and the GP2X. I'll also release the engine sources and the documentation too :)

For now, it's 4am... the engine's just finished doing a full compile without any warnings, so I'm heading to bed for some sleep.
I'll try and add preliminary documentation here as and when I write it, so that people can look over it and hopefully give some suggestions for additional features and other things :)
 
Well the week hasn't quite gone to plan.

Train for my interview for Friday was overbooked and my ticket canceled so Wednesday through to Friday was taken up with me trying to sort the mess out.. with my interview being rescheduled for this coming Wednesday instead ( and train tickets being bought immediately to ensure I get there, this time ;) )

I've also had insane amounts of trouble trying to get Cygwin and Vista to co-operate and I eventually gave up and installed 64bit Arch Linux, only to have problems compiling the "new-libs" branch of the open2x toolchain ( freetype was looking for the host compiler, messing with the makefiles to get it to compile the older version got passed this, and then libungif bailed trying to look for /usr/include/gnu/stubs-32.h ... which doesn't exist under 64bit Arch Linux as it doesn't use multilib, and I'd have thought it'd be looking in the open2x includes for that rather than the host's )
So currently, I've fished my laptop out which is running 32bit Ubuntu 8.10, and it's going through new-libs just now.. so I'll see if it works on that.

I'm still aiming to have something done for my interview, even though I've lost a few days.. so I'll keep at it and hopefully have something to show soon :)

I have at least been making headway in the example game and the documentation.. as the script interface isn't changing, I've at least been able to work on that.
The example is a simple single-screen puzzle game. The graphics aren't anything much at all, but it's meant more as a demonstration anyway.. graphics can always be redone later, if anyone plays it!

But that's the status update for now.. I'll hopefully have something more substantial soon.

-edit-

Well my laptop chew through new-libs without any problems other than the makefile for SDL having it do a distclean before it's makefiles existed from autogen ;)
Unfortunately, compiling Guyfawkes' test application has SDL_Mixer refuse to play MP3s, OGGs or MODs ... but, otherwise, it works.. so it lets me get back to working on it anyway - minus audio!

-another edit .. cause edits are fun!-

With help from Orkie in IRC, managed to get the libraries to compile on my 64bit Desktop :)
Also managed to get SDL_Mixer to actually play something back!
Now I can get back to work fully ... or seeing as it's coming up for 2:30am, have a nap first then get some work done ;)
 
I know I'm stupidly late with this, but I moved down to England not long after the last post, I have no internet at my new place yet, and I've been stupidly busy with this new "work" thing that I had managed to avoid till now ;)

That said, I've still been working on things and have added a fair amount of extra bits and pieces that I wasn't going to do for the first release - camera work and things, so you can actually have the engine scroll the camera around a large playfield rather than doing the donkey work yourself in Lua, for example... just to make up for it being late!

I'm also not entirely sure where my GP2X is at the moment!
It's in a box... somewhere... though the vast majority of my stuff is still in boxes.
So I'll need to find that first for testing.

I'll try come up with a current feature list over the weekend and post it on Monday, so if anyone has ideas on what they want/would like, feel free to post.. hopefully it'll already be planned ( or better yet - done! ) but it can't hurt to get some ideas out anyway :)

On the plus side, what with me having one of these job things now, I'll be able to get a Wiz as well :) and with the engine being the way it is, it should just be a quick recompile and it'll be done!

I'll be shouting at someone to install services in my place soon... as I've had no TV, no phone and no internet.. for a while now... *twitches away into the distance*
 
I had a good pore over the code this weekend.. it's almost in a state that's readable and releasable!
I'll still need to organise SVN somewhere to store the code, but I'll get everything else finished first.

I've merged both SGZ2D and SGZ3D into the one engine again... most of the code is shared anyway and it would've been done somewhere along the line too.

By default, SGZ2D's renderer is SDL and it'll work quite happy on the GP2X.
SGZ3D's default renderer is Horde3D however, which won't work on the GP2X :( or anything much else other than Windows and Linux at the moment ( I have no Mac handy to test or code on, unfortunately! ) but it's a starting point!

The current Event System needs an overhaul.. as it's kinda bypassed completely at the moment, so that needs done first.
The Audio System is probably the most complete - abstracting pretty much everything from SDL and SDL_Mixer, including channel group support but not the custom effect functions which require void pointer data to be passed in.
The Render System is nice and basic as it just starts up, opens a window, updates and stops when necessary.
The Entity Manager needs some work still, as it's a bit messy just now.
The Level Manager needs a severe re-work as it's geared specifically for 2D tilemapped levels ( with a giant 3D array ) in it's own demented format.
The Texture Manager works fine and both this and the Entity Manager are linked closely to the Level Manager for it to grab tile data.
The Input System is fairly complete as well, though mouse support seems quite iffy at the moment.
The Client Interface takes care of most of the above systems without much problem.
The Server Interface needs some more work, as due to the Event System being bypassed, it's just sortof sitting there with nothing to do - other than when ODE is active.

There's code for linking with ODE for Physics and the Horde3D wrapper which were rewritten from the Plight of The Weedunks project. The Horde wrapper pretty much bypasses everything bar the Renderer, as it contains it's own scenegraph for dealing with things, and ODE takes over most of the Server area still.

What I'll be in the process of doing most of this week, is re-doing my data structures as they were originally written in my second year of Uni, and don't use STL. This'll clean up a lot of mess that I had to do to get things to work, and hopefully speed things up a bit as well. Once that's done, I'll finish up the manual - which only needs the Entity Manager reference written really - and finally release it for all to poke and laugh at ;)

Hopefully, it wont take too long, but I'm not going to put a date down this time! just say, it'll be done when it's done...
 
It's the end of July, and I'm still not closer to a proper release.

However, I have gone and uploaded all my engine source, and licensed it under LGPLv2.
Interested parties can have a peek here: http://svn2.xp-dev.com/svn/stuckie-SGZEngine/

I warn you that a lot of the code needs cleaned up, there's a mish-mash of styles, bits of C++ and C interspersed all over the place, and all sorts of naughty coding practices, and half finished code!

It does come with a range of Makefiles though, covering GP2X ( both GPH and Open2X firmwares.. though I haven't actually tested the Open2X binary that gets produced, hehe ), Wiz, Dingoo, Linux, PSP ( I tested with an old version that links with SDL and requires a fat with 1.50 compat. ) and basic support for the Wii, which shall be replaced with actual support when I have time... SDL on the Wii was a bit dire when I originally attempted so hopefully it's better now, or I find the time to code directly.
There's also a Codeblocks project file for Win32 and Linux.
Someone's also just got it running on the Freerunner, and will be sending me the changes soon :)

You will need some data to go with it.. either by making it yourself with the (very bare and incomplete) documentation provided, and scouring the Proxies for exposed functions, or by grabbing what I've been working on recently: http://www.stuckiegamez.co.uk/gamez/ludumdare/miniLD11/LittleQuirksT1.zip
You just need the binary, and the data folder.

This is basically a work-in-progress preview if anything, and I will be, and have been, continuing work on it throughout August.
Hope it's useful for someone :) ( as a how not to code an engine, if nothing else, hehe )

--edit--
Bah I forgot, for Windows you'll require the following libraries in DLL format:
SDL, SDL_mixer ( plus dependencies ), SDL_image ( plus dependencies ), Lua 5.1
Same with Linux, and any other platform... the version of Lua 5.1 I've been using is in the SVN though, mostly because for some handhelds I just compile it right in the binary.
 
Back
Top