Jump to content


Photo

GLESGAE

GLES Game Engine C++ Tutorial

  • Please log in to reply
31 replies to this topic

#1 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 09 February 2012 - 11:25 AM

I suppose I should start shunting stuff over here, so I'll go with what I'm actively working on just now.
Original gubbins here: http://www.gp32x.com.../59428-glesgae/

GLESGAE ( GL ES Game Application Engine ) is an engine I started last year to help further my own graphics programming, and thought that it might be beneficial to write down tutorials along the way - as a way to help the community, and ensure I do in fact know what I'm doing :D
It stalled for a bit, but it's now back on track!
The name derives from the fact it works pretty well for what it describes, and it's a Scottish colloquialism for Glasgow, and me being Scottish, thought it was amusing!

There are two repositories on the go for this, one which is linked to the tutorials up on the Wiki, and another which is "bleedin' edge" and is likely to break from time to time, especially when I go about doing vicious wide-ranging rewrites of things.

Stable Repository: http://svn.xp-dev.co.../glesgae/trunk/
Wiki Link: http://pandorawiki.org/GLESGAE
Bleedin' Edge: https://github.com/stuckie/glesgae

The path outline changes as I need to do things, so neither the original post, or the current TOC on the wiki really give an outline of what's coming up... or at least, the ordering of it.
What I will be doing, is focusing on implementing Scripting via JavaScript over the next couple of months.
Oh yes... I has a plan for entering something into the Rebirth competition thingie... and you get GLESGAE for free.


In terms of the tutorial line - I've just finished writing up about Resources, although the code has not yet been fully tested and committed back to the stable repository as yet.
I have an overview chapter on the Graphics System to write up - with what mess I made of it in the unstable repository, and why, then I have a few utilities to write up on ( HashString, Logger and File... finally! ) before pushing over the JavaScript stuff into the stable repository.
This will mark the two of them as more or less in-line with one another, before ploughing ahead with binding stuff out to JavaScript.

There is method in my madness, but you'll just have to wait and see what comes out of it ;)

#2 OFFLINE   Wrath of Khan

Wrath of Khan

    Jazz it up baby!

  • Supporter
  • 3619 posts
  • Local time: 03:58 AM
  • LocationIreland

Donator

Posted 09 February 2012 - 12:44 PM

Just had a quick look.So ostensibly it's a game engine with included tutorials for making games for the pandora.Though im sure there's more to it but im no programmer/techie guy.Sounds good though. :)

Tick tock, ever gently killing silence, ticks the clock. Tick tock where the fuck is the icp2?

 

Currently working on Spirit-shard and Labyrinth of Crystalia for Pandora and other systems.


#3 OFFLINE   pmprog

pmprog

    www.pmprog.co.uk

  • Members
  • PipPipPip
  • 2415 posts
  • Local time: 03:58 AM
  • LocationCheshire, UK

Donator

Posted 09 February 2012 - 01:07 PM

I was pointed to your tutes when I started looking at coding Hot Pursuit. Unfortunately a number of things IRL have prevented me from doing much on HP - or even my competition entry. I'm glad you're carrying on with it though, and I'll be sure to pop back in when I'm back on the case.
pmprog.pngpandora.pngbutton-small.pngtournamenthub.pnggithub.png

#4 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 09 February 2012 - 01:13 PM

Yea, everything on GLESGAE stalled due to things that went a bit mad for me too, so real life can be a right pest at times ;)
As I said though, I'll be needing this for my own competition entry.. whether I'll be able to keep up to speed with the tutorials at the same rate ( organising your thoughts into words, and explaining things takes much longer than actually coding and debugging the damn thing, generally! ) I'm not sure, but hopefully no-one will hold it against me too much!
Also, if anything's unclear, feel free to let me know, and I'll go update it.. I'm not your standard programmer in any sense of the word, and I do tend to jump around a lot, and it wouldn't be the first time I've glossed over something critical that I shouldn't have! ( or explained something wrong, but have it right in the code... that happens too *cough* )

#5 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 10 February 2012 - 08:23 PM

I'm currently compiling webkit - mainly to pinch the javascriptcore library from it.
As such, here are my findings for anyone else wanting to go near it to use webkit for the use of building a browser, for instance.
The joys of cross-compiling a large scale library with many many dependencies!

I'm using the yactfeau toolchain, in my own custom VM ( which has NFS mounts to my dev drives on my main box.. but that shouldn't matter much to you, you'll just need PLENTY of space for this in your VM )

I'm compiling webkit from SVN as well, so it's relatively recent ( mine might be a few commits out now, but it's verified working. )

Anyway, create a project folder (mine shall be called glesgae, and checkout ( or link to ) recent versions of webkit, glib, libsoup, cairo, pixman, glib-networking, gnutls, libnettle, gstreamer, gstreamer-plugins-base
Specifically, I'm using webkit revision 105733, glib 2.31.12, cairo 1.10.0, pixman 0.18.4, libsoup 2.37.1, glib-networking 2.31.6, gnutls 2.12.12, libnettle 2.1, gstreamer 0.10.30, gst-plugins-base 0.10.30


First up, glib.
If your system's version of glib is lower than the one we're compiling, you'll need to build this version for the host.
If you're using Ubuntu, you have additional fun in that you have to clean up Ubuntu's mess... you'll need to delete the old glib libraries in /usr/lib and the one in /lib for your newly compiled version to be found and used correctly.

If your glib is fine (you'll find out if you get weird errors in the configure stage for the Pandora) we'll move on to the Pandora compile.
Create a pandora.cache file with the following in it:
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes
glib_cv_uscore=no
glib_cv_stack_grows=no
Then run configure as follows:
LIBFFI_CFLAGS=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include/arm-angstrom-linux-gnueabi pndconfigure --cache-file=pandora.cache
Then
make

If you're really lucky, it'll compile without issue.
If you end up with the cryptic error of:
  GEN    stamp-testmarshal.h
You should give exactly one directory name
You'll need to do the following:
cd tests/gobject
glib-genmarshal --prefix=test_marshal testmarshal.list --header >> xgen-gmh
(cmp -s xgen-gmh testmarshal.h 2>/dev/null || cp xgen-gmh testmarshal.h;)
rm -f xgen-gmh xgen-gmh
glib-genmarshal --prefix=test_marshal testmarshal.list --body >> xgen-gmc
cp xgen-gmc testmarshal.c
rm -f xgen-gmc xgen-gmc~
cd ../..
make
The Makefile is supposed to do this, but seems to get confused, for some reason.. either way, it should continue afterwards.

Once it's done,
make install
as usual for it to dump itself into your project's end structure - /mnt/utmp/glesgae

Next, pixman.
This one's straightforward enough, it's just
pndconfigure && make && make install

Next, cairo.
This also requires a pandora.cache file, this time containing:
ax_cv_c_float_words_bigendian=no
Then it's just:
pndconfigure --cache-file=pandora.cache && make && make install

Next, libnettle.
pndconfigure && make && make install
I got errors during install while building tests, but it seemed happy enough to copy the includes and libs over, which is what we needed anyway.

Next, gnutls.
pndconfigure --without-p11-kit && make && make install

For the host, I needed glib-networking to be built here, if I was building for host as well.

Now for libsoup.
Again, it's just:
pndconfigure && make
I got errors during making the tests.. I brazenly ignored them and issued
make install
To which I got the same errors, but it had already built the libs and headers, and copied them into place.

On to gstreamer.
I had to specify the lib folder of where all the glesgae is being dumped...
LDFLAGS=-L/mnt/utmp/glesgae/lib/pndconfigure && make && make install
Other than that, a nice and easy library to compile...

Now gstreamer-plugins-base.
I again had to specify the lib folder of where all the glesgae is being dumped...
LDFLAGS=-L/mnt/utmp/glesgae/lib/ pndconfigure
make
I got an error during the compile about something including a part of glib directly.
It was an easy fix, though.. I just had to edit gst/typefind/gsttypefindfunctions.c and change the line to #include <glib.h>
make install

Now the big bugger, webkit:
LIBSOUP_CFLAGS="-pthread -I/mnt/utmp/glesgae/include -I/mnt/utmp/glesgae/include/glib-2.0 -I/mnt/utmp/glesgae/lib/glib-2.0/include -I/mnt/utmp/glesgae/include/libsoup-2.4 -I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include/libxml2" LIBSOUP_LIBS=-L/mnt/utmp/glesgae/lib pndconfigure --with-gtk=2.0 --with-unicode-backend=glib
Unless you feel like compiling GTK 3.0? No? ;)
The LIBSOUP stuff is required as it doesn't seem to have updated pkg-config correctly - probably due to the errors in the tests.
Again, it points to where glesgae is all going out to.
make jsc
It'll give up building the interpreter, but we don't need that... we just need the library and the include files.
Specifically, these are hiding in .libs, and the header files in Source/JavaScriptCore/API

I couldn't get the full webkit to build ( just issuing "make" ) due to glib-genmarshal errors again.. but I now have JavaScriptCore compiled and ready.

.... after three days on and off of attempting to compile the bugger, hence this post.

Edited by stuckie, 10 February 2012 - 08:42 PM.


#6 OFFLINE   slaeshjag

slaeshjag

    :รพ

  • Members
  • PipPipPip
  • 1915 posts
  • Local time: 04:58 AM
  • Location~Stockholm, Sweden

Donator

Posted 10 February 2012 - 08:26 PM

You could've asked, this is stuff I've been doing for my Midori port ;)

From eight were not to mess with empty and accounted for Between distress!
/* Fanatic C programmer */


#7 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 10 February 2012 - 08:47 PM

I need to be able to build it for other platforms as well, and ensure I'm using the same versions across the board ;) so wasn't a complete waste of time!
Certainly not something I want to go through again, hehe

I only needed the JSC part of it too, so it was a bit of a long-way around when I could've just pinched one little library from you which is ( effectively ) self-dependent ( well, depending on whether you compiled glib unicode support, or went with icu which is a dependency. ) But yea, the need to ensure everything's compiled at the same level is a bit important at the moment, so wasn't a waste.

Oh and my Javascript test in the bleedin' edge GLESGAE repository works on Pandora now as well.
Onwards to the fun stuff!

Edited by stuckie, 10 February 2012 - 08:51 PM.


#8 OFFLINE   pmprog

pmprog

    www.pmprog.co.uk

  • Members
  • PipPipPip
  • 2415 posts
  • Local time: 03:58 AM
  • LocationCheshire, UK

Donator

Posted 11 February 2012 - 12:56 PM

Out of curiousity, why are you adding Javascript to GLESGAE? If it's for some form of in-game scripting, damn, you could have chosen a better language ;)
pmprog.pngpandora.pngbutton-small.pngtournamenthub.pnggithub.png

#9 OFFLINE   PokeParadox

PokeParadox

    Advanced Member

  • Moderators
  • 2104 posts
  • Local time: 03:58 AM

Donator

Posted 11 February 2012 - 02:28 PM

Maybe to port some HTML5 games to not require a browser? :S


Tired of the infamous preorder queue? Donate and help get this queue cleared!
Twitter: @PokeParadox
If you like my work, please consider leaving a rating or feedback or donating, every little "thank you" is appreciated!
My Pandora Apps - My Development Blog - Pirate Games


#10 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 11 February 2012 - 03:55 PM

PokeParadox is right..
Effectively, having looked around myself at things like appMobi, appcelerator, et al.. they all do pretty much the same thing - a big engine thing that wraps up a JavaScript interpreter and binds out enough bits for Canvas and friends to work, and a huge bunch of other junk that generally isn't really needed for games.
They still tend to work faster, as instead of going through the browser framework - which is meant to be standards compliant, after all - it can potentially be banging the hardware directly, in whatever manner it feels like... so this is what I'm going to be doing with GLESGAE for the Rebirth compo; have it in a state that JavaScript games can just be thrown over, and take advantage of the hardware if needed. That's the freebie at least, as I'll be doing a game alongside it to act as an example, and ensure everything works. ( well, that's the plan at least ... )

If I was just going to bind out a proper scripting language, it'd be Lua, as I've a huge amount of experience with doing exactly that ;)

#11 OFFLINE   milkshake

milkshake

    Super Advanced Member

  • Members
  • PipPipPip
  • 3084 posts
  • Local time: 03:58 AM
  • LocationRotherham, UK

Posted 11 February 2012 - 04:26 PM

Out of curiousity, why are you adding Javascript to GLESGAE? If it's for some form of in-game scripting, damn, you could have chosen a better language ;)

I don't see why you don't like javascript as a scripting language, did you know the wolfire team use is for scripting in their overgrowth game?
minipandalogo.png Pandora Repo - software for your pandora :)

btn_donate_SM.gif If you like my site/contributions, consider donating.
Prometheus.jpg

#12 OFFLINE   Gruso

Gruso

    Advanced Member

  • Members
  • PipPipPip
  • 1729 posts
  • Local time: 01:58 PM
  • LocationSyd, Aus

Posted 11 February 2012 - 11:01 PM

Maybe to port some HTML5 games to not require a browser? :S

PokeParadox is right..

Interesting :)

(Well, the whole project is of course, but that bit grabbed me. It might also grab Craig.)
FAQs: Pandora | PND files | USB

#13 OFFLINE   pmprog

pmprog

    www.pmprog.co.uk

  • Members
  • PipPipPip
  • 2415 posts
  • Local time: 03:58 AM
  • LocationCheshire, UK

Donator

Posted 12 February 2012 - 08:54 AM

I don't see why you don't like javascript as a scripting language, did you know the wolfire team use is for scripting in their overgrowth game?

It's not "as a scripting language", more of just "as a language" :D Mainly because it is an untyped language - okay, I know most scripting languages are, and I don't really like any of them. Also, this article makes me cringe - there should not be three different ways of defining classes.

I know, I'll probably have to embrace it at some point, just a shame they couldn't have picked a better language to standardise on.

Back on topic:
It is an interesting idea though. Could be pretty useful, because things like Microsoft's Desktop Widgets are XML/HTML/Javascript. So might be interesting see other things get "interfaced".
Are you thinking of covering WebGL too?
pmprog.pngpandora.pngbutton-small.pngtournamenthub.pnggithub.png

#14 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 12 February 2012 - 10:04 AM

I'll certainly have a look at WebGL... I'd need to fix my ES2 backend first as I sortof mangled it a bit when I split up the graphics system, but that probably won't be for a while yet.
Just for basic HTML5/JS support, I need to sort out Canvas, Image and Audio primarily, so I've my hands full yet!
GLESGAE itself doesn't have any real File I/O implementation ( working on that now ) nor Audio implementation ( likely going to be OpenAL ) so those will be needing done as well.

Tutorial-wise, I think I might have to hold off for the next couple of weeks to get everything done, as looking at how much free time I can guarantee to have, I have 18 hours over the next two weeks, and getting the basics marked down and my compo entry done will be exceedingly tight!

#15 OFFLINE   crow_riot

crow_riot

    Advanced Member

  • Members
  • PipPipPip
  • 616 posts
  • Local time: 03:58 AM

Donator

Posted 12 February 2012 - 03:33 PM

you're now doing a project i also was keen on getting to work - but didn't pick it up due to time constraints (as usual ;))

hope this turns out to be great, i really see a lot of potential in such a project!
finished: audiorace | dragonbox compo: apkenv | alive&kicking compo: flashenv

#16 OFFLINE   torpor

torpor

    Advanced Member

  • Members
  • PipPipPip
  • 1045 posts
  • Local time: 03:58 AM

Posted 17 February 2012 - 11:12 AM

Use LUA! Its Better! Want proof? The go see maratis3d.org and getmoai.com right now ..

#17 OFFLINE   WizardStan

WizardStan

    Advanced Member

  • Members
  • PipPipPip
  • 7646 posts
  • Local time: 10:58 PM

Posted 17 February 2012 - 11:35 AM

I second LUA for scripting. Unlike JavaScript, LUA actually had the time to be designed properly, and it shows. Specifically it was designed with scripting and external hooks in mind.

#18 OFFLINE   milkshake

milkshake

    Super Advanced Member

  • Members
  • PipPipPip
  • 3084 posts
  • Local time: 03:58 AM
  • LocationRotherham, UK

Posted 17 February 2012 - 11:44 AM

yes but I think the main goal is getting html5 games to run without a browser so lua wont help with that.
minipandalogo.png Pandora Repo - software for your pandora :)

btn_donate_SM.gif If you like my site/contributions, consider donating.
Prometheus.jpg

#19 OFFLINE   WizardStan

WizardStan

    Advanced Member

  • Members
  • PipPipPip
  • 7646 posts
  • Local time: 10:58 PM

Posted 17 February 2012 - 12:13 PM

Oh, right.

#20 OFFLINE   stuckie

stuckie

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts
  • Local time: 03:58 AM
  • LocationPerforming dodgy hacks in the basement, on defenseless Pandoras

Posted 17 February 2012 - 01:39 PM

Yea, the goal is more to get HTML5/JS games running in a native application, as browser support for Canvas and Audio et al can still be a bit spotty at best - especially in the mobile space.
I have my reasons for implementing this first anyway, but I'll be implementing Lua as well at some point as well - especially as I have several years experience of using Lua in such situations.

Anyway, a little progress report.
I've written up a nice and simple File implementation thing.
I've pulled in SOIL to use for loading in images, as it's nice and self contained and without a mental license.
I'll also be pulling in OpenAL and Ogg Vorbis.. I won't be supporting MP3 files, as I don't want to go anywhere near that patent encumbered mess, as this engine is going to be rather important to me soon, so rather not deal with mad licenses ;)
And I'm about to start binding out stuff for Canvas and Image, to get things on screen.

As for the Rebirth project that'll be coming out of this, most of the design was written up last night, with some concept bits and pieces drawn. I'll start another topic for this closer to the time.



Also tagged with one or more of these keywords: GLES Game Engine, C++, Tutorial

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users