[Staff][Dev] GL 2D Game Engine

Here you can find side projects of the staff and great projects which we think should get extra support. (Note that featured projects are not projects by staff members of MaxCoderz)

Moderator: MaxCoderz Staff

User avatar
qarnos
Maxcoderz Staff
Posts: 227
Joined: Thu 01 Dec, 2005 9:04 am
Location: Melbourne, Australia

Re: [Staff][Dev] GL 2D Game Engine

Post by qarnos »

graphmastur wrote:I think that this project is amazing!!! Do you have a current release?
Thanks :)

There is no current release - I am still in the process of moving it over into an APP. Some things - like the texture mapping - use a lot of self-modifying code and will be painfully slow without it, so I'm still considering the possible solutions on that.

There is probably enough usable code in it to make an experimental release, perhaps next weekend, but I already wasted all this weekend playing with gravity so I will have to get cracking.
"I don't know why a refrigerator is now involved, but put that aside for now". - Jim e on unitedti.org

avatar courtesy of driesguldolf.
graphmastur
New Member
Posts: 3
Joined: Sat 25 Jul, 2009 3:29 pm

Re: [Staff][Dev] GL 2D Game Engine

Post by graphmastur »

That is good. So I could program it just like a standard asm program?
User avatar
qarnos
Maxcoderz Staff
Posts: 227
Joined: Thu 01 Dec, 2005 9:04 am
Location: Melbourne, Australia

Re: [Staff][Dev] GL 2D Game Engine

Post by qarnos »

graphmastur wrote:That is good. So I could program it just like a standard asm program?
Yep. You use it in the same way you would use the built in routines in a shell such as MirageOS - it just provides a bunch of routines which your program can call. The are some #defines as well, such as .glLoadIdentity, but these just expand into routine calls. They're just there for convenience, and they make the code easier to read.

The only catch is that you need some special code at the start of your program to make the routines available (although this is just a cut-and-paste job) and once the library is loaded, you need to jump through a few hoops if you want to call a shell routine. This is because the library gets paged into the same address range ($4000 - $7FFF) that the shell was loaded into. So if you want to call a shell routine, you need to flip to the shell page, call the routine, and then flip back to the library page again.

This might be an issue initially, since the library doesn't provide any sprite routines (yet), apart from the really slow texture mapped ones. I'd like to add regular sprites but they are pretty low down on my priority list, since I don't need them for the game I am working on (which is, after all, the motivation for this project!).

Are there any features in particular which piqued your interest? I'd like to do some kind of experimental release this weekend but a lot of stuff is going to have to be left out. If there is something in particular you liked, I will make sure I include it if at all possible.
"I don't know why a refrigerator is now involved, but put that aside for now". - Jim e on unitedti.org

avatar courtesy of driesguldolf.
graphmastur
New Member
Posts: 3
Joined: Sat 25 Jul, 2009 3:29 pm

Re: [Staff][Dev] GL 2D Game Engine

Post by graphmastur »

What piqued my interest was the idea of doing the 2d lines like this. It seems very fast, and could be used for many different things. The whole shell mapping thing is not that big of a deal. I mean, how hard is it to have two routines:

Code: Select all

SwapAppPages:
    in (06),a
    cp 69 ; Your application page, whatever it is
    jr z,loadback
    ld HL, AppBackupScreen
    ld (HL), a
    ld a, 69 ; Your application page, whatever it is
    out (06),a
    ret
loadback:
    ld HL, AppBackupScreen
    ld a,(HL)
    out (06),a
    ret
That should work, and it uses the first byte of AppBackupScreen.

Oh, and I don't really know about features to add, until I actually see what it can do. Basic lines would be good, I guess.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Re: [Staff][Dev] GL 2D Game Engine

Post by King Harold »

That assumes your page is known at compile time or you use SMC, and if you go down that road you could just as well do:

Code: Select all

SwapAppPages:
    in (6),a
  label_hack = $ + 1
    xor 69^69 (Your applicationg page ^ the other page)
    out (6),a
    ret
Just write the correct value into label_hack when your app starts..
User avatar
qarnos
Maxcoderz Staff
Posts: 227
Joined: Thu 01 Dec, 2005 9:04 am
Location: Melbourne, Australia

Re: [Staff][Dev] GL 2D Game Engine

Post by qarnos »

Actually, what I'd like is a custom B_CALL type system. Something like:

Code: Select all

    call shellcall
    .dw ifastcopy   ; shell routine address
The tricky part is you need to preserve all registers (including F) because you don't know the inputs/outputs of the shell routine. I wrote a couple of versions of a routine to do it, but it's always pretty slow - usually around 200cc iirc.

Anyway, I've put together a usable version, though it's still lacking a lot of stuff. Polygons are drawn a little off. Lines can only be draw black. Lots of other shortcomings, but usable.

The zip file contains the binaries and includes, a small demo and some incomplete reference documentation. Between the documentation and the demo comments, you might be able to piece enough of it together to at least play around with it.
Image
"I don't know why a refrigerator is now involved, but put that aside for now". - Jim e on unitedti.org

avatar courtesy of driesguldolf.
User avatar
qarnos
Maxcoderz Staff
Posts: 227
Joined: Thu 01 Dec, 2005 9:04 am
Location: Melbourne, Australia

Re: [Staff][Dev] GL 2D Game Engine

Post by qarnos »

Just a little extra...

I used the lib to create a very crude orbit game. Try it out if you like

The left and right arrows control rotation (one press = one pulse of the thrusters) and holding down 2nd fires your main engine. Plus/minus zoom in and out and mode quits.

There is no collision detection :P
Image
"I don't know why a refrigerator is now involved, but put that aside for now". - Jim e on unitedti.org

avatar courtesy of driesguldolf.
User avatar
NanoWar
Extreme Poster
Posts: 365
Joined: Fri 17 Dec, 2004 6:39 pm
Location: #$&"%§!
Contact:

Re: [Staff][Dev] GL 2D Game Engine

Post by NanoWar »

"Shit guys, we got the missiles are coming, fire our shit" "but i am le tired." "well have a nap, THEN FIRE ZE MISSLES!"
Revolution Software
darkstone knight
New Member
Posts: 67
Joined: Sun 09 Nov, 2008 1:56 pm

Re: [Staff][Dev] GL 2D Game Engine

Post by darkstone knight »

that makes me think about wind waker :D

that boat game dude is hilarious 8)
User avatar
Eeems
New Member
Posts: 16
Joined: Sat 28 Feb, 2009 9:37 pm
Location: Edmonton, Alberta
Contact:

Re: [Staff][Dev] GL 2D Game Engine

Post by Eeems »

hmm, I tried the orbit thing, but it just quits on me before doing anything...
ImageImageImageImageImageImageImageImage
User avatar
qarnos
Maxcoderz Staff
Posts: 227
Joined: Thu 01 Dec, 2005 9:04 am
Location: Melbourne, Australia

Re: [Staff][Dev] GL 2D Game Engine

Post by qarnos »

Eeems wrote:hmm, I tried the orbit thing, but it just quits on me before doing anything...
Did you send zlibgl83.8xk to your calc as well as orbit.8xp? If you didn't it will quit immediately with no error message. That's the only reason I can think for that happening.
"I don't know why a refrigerator is now involved, but put that aside for now". - Jim e on unitedti.org

avatar courtesy of driesguldolf.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4120
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Re: [Staff][Dev] GL 2D Game Engine

Post by tr1p1ea »

I gave it a try and it works really nicely.

Also i had a quick squiz at some of your routines and i am particularly impressed with the math ones :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Eeems
New Member
Posts: 16
Joined: Sat 28 Feb, 2009 9:37 pm
Location: Edmonton, Alberta
Contact:

Re: [Staff][Dev] GL 2D Game Engine

Post by Eeems »

qarnos wrote:
Eeems wrote:hmm, I tried the orbit thing, but it just quits on me before doing anything...
Did you send zlibgl83.8xk to your calc as well as orbit.8xp? If you didn't it will quit immediately with no error message. That's the only reason I can think for that happening.
actually no I didn't...I can't seem to find it, could you give me a link to it please? I thought I was missing something, but yeah....
ImageImageImageImageImageImageImageImage
User avatar
qarnos
Maxcoderz Staff
Posts: 227
Joined: Thu 01 Dec, 2005 9:04 am
Location: Melbourne, Australia

Re: [Staff][Dev] GL 2D Game Engine

Post by qarnos »

tr1p1ea wrote:I gave it a try and it works really nicely.

Also i had a quick squiz at some of your routines and i am particularly impressed with the math ones :).
Thanks :)

I have a fetish for maths routines :P
qarnos wrote:
Eeems wrote:hmm, I tried the orbit thing, but it just quits on me before doing anything...
It's available in this zip file (in the "bin" directory).
"I don't know why a refrigerator is now involved, but put that aside for now". - Jim e on unitedti.org

avatar courtesy of driesguldolf.
User avatar
Eeems
New Member
Posts: 16
Joined: Sat 28 Feb, 2009 9:37 pm
Location: Edmonton, Alberta
Contact:

Re: [Staff][Dev] GL 2D Game Engine

Post by Eeems »

ah thanks :)
hmm interesting...I like it
ImageImageImageImageImageImageImageImage
Post Reply