Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: hoffa on May 18, 2012, 02:11:53 pm

Title: Dodgin' Diamond 2X (60 FPS)
Post by: hoffa on May 18, 2012, 02:11:53 pm
This is an improved port of a SDL game (as such, it uses nSDL (http://ourl.ca/14975)) called Dodgin' Diamond 2 (http://www.usebox.net/jjm/dd2/) (which has been ported to quite a few platforms EDIT: he even mentioned this port on his page 8)). Improved in this case means graphics improvements, gameplay improvements and bug fixes.

It's a vertical shooter à la SNES and has single player mode, co-op mode and high scores.

The controls are as follows:
- For player 1 you can use the whole numpad to move around (7 to go up-left, 6 to go right, etc.) and 5 is for shooting
- For player 2 the keys E,F,G,L,N,S,T,U are used to move around (the same way as player 1) and M is used for shooting
Press CTRL to pause the game.
Press I to show/hide FPS.

Here are a few screenshots:
(http://webgel.net/bf/dd2x.png) (http://webgel.net/bf/1/dd2x.png)
(http://webgel.net/bf/2/s3.png) (http://webgel.net/bf/2/s4.png)

EDIT: And a new one:
(http://i.imgur.com/cKG3RhA.png)

Gameplay video:

The game is attached to this post. (note that it could have been at least twice as small as its current size if I had the time to rearrange the sprite sheet)

Thanks for Pomi for some CX-related testing.
Source code is here (http://hoffa.franceserv.fr/dd2x/dd2x-0.3.0.rar).

Click here for latest version (0.3.0) (http://ourl.ca/16186/336693)
Title: Re: Dodgin' Diamond 2X
Post by: Hayleia on May 19, 2012, 07:09:55 am
The controls are as follows:
- For player 1 you can use the whole numpad to move around (7 to go up-left, 6 to go right, etc.) and tab is for shooting
- For player 2 the keys H,I,J,O,Q,V,W,X are used to move around (the same way as player 1) and space is used for shooting
/me hides :P

Seriously, I tried this and I like it a lot :D
The graphics are awesome, the keys are perfect, the speed is great,...
The only thing that I would like to see improved is the walls on the side: they are a bit dark and it is hard to see them.

edit: Bug report
When inputting a name for the hall of fame, the game detects a key when I push the key but also when I remove my finger from the key.
Title: Re: Dodgin' Diamond 2X
Post by: critor on May 19, 2012, 04:09:41 pm
Great! :D

We made a very enthusiastic news on TI-Planet:
http://tiplanet.org/forum/viewtopic.php?p=124488#p124488
Title: Re: Dodgin' Diamond 2X
Post by: TheNlightenedOne on May 19, 2012, 10:05:00 pm
I kinda want to try this... it looks awesome!
Title: Re: Dodgin' Diamond 2X
Post by: Hayleia on May 22, 2012, 02:22:10 pm
Bug report:
Pushing the keys 4,2 and O at the same time returns to the menu D:
Title: Re: Dodgin' Diamond 2X
Post by: Nick on May 22, 2012, 03:11:32 pm
same bugs as hayleia (cx cas)

this is soooo great, i'm really feeling sorry for my [tab] button ö but this is so cool, nice job :)
Title: Re: Dodgin' Diamond 2X
Post by: hoffa on May 22, 2012, 03:13:20 pm
Thanks for the bug reports Hayleia. :)

Here's an updated version. What's new:
- Brighter walls
- Fixed bug when inputting high score name
- Changed controls a bit (see first post)

Previous high scores should still be there.

As for the 4,2,O-bug, it's very strange and I'll have a look at it (not going to point fingers, but might be a bug in Ndless; as far as the code goes that shouldn't happen, nor should nSDL mix keys up or something). The controls have been moved a bit however so it shouldn't be an issue at this point. Please do tell me if the keys are not good, remember however that it should be relatively easy to have two players playing at the same time.
Title: Re: Dodgin' Diamond 2X
Post by: hoffa on January 29, 2013, 06:24:39 pm
Tiny update after a long pause.

Changes:
- Compiled with nSDL 1.1.1
- Changed background
- Added FPS counter (toggle with the I-key)
- Uhh... that's it

It runs at 30-40 FPS on CX, 50-60 FPS on Touchpad (but don't even bother with that one, the LCD is such a piece of shit it's only an ugly blurry mess). I haven't even bothered to optimize whatsoever.

Also a gameplay video:
EDIT: Check out the one below for a newer one

Source code available here (http://hoffa.franceserv.fr/dd2x/dd2x-0.3.0.rar).

Download attached.
Title: Re: Dodgin' Diamond 2X
Post by: DJ Omnimaga on January 29, 2013, 06:37:56 pm
That really looks great. Nice job porting this :)

For the Touch/Clickpad you should limit framerate to 15 (or allow the option to), because historically this is the framerate at which blurriness becomes acceptable, while still running decently smooth.
Title: Re: Dodgin' Diamond 2X
Post by: epic7 on January 29, 2013, 08:01:25 pm
That's pretty awesome O.O
I need to learn how to use sdl :P
Title: Re: Dodgin' Diamond 2X
Post by: hoffa on January 30, 2013, 01:25:12 pm
ALRIGHTY. I've tracked down one major bottleneck in nSDL. It was quite obvious but I never thought it would be such a slow-down. Calling any function that pumps the events (SDL_PollEvent(), SDL_GetKeyState(), whatever) seriously hurts performance in speed-critical code. Nothing can really be done about it, just don't use those functions where you need speed, instead stick to keyIsPressed() and whatnot (as most people have done so far in fact).

I changed all the in-game SDL event handling code to normal ndless-style key handling, and now the game jumped to nearly 60 FPS! It's a massive improvement. I was myself already quite impressed with what we had before, updating the whole screen and having multiple layers and everything, but I never expected that I could nearly double the framerate! *.*

Here's a video so you can see, it's much more of a shoot em up now (you can see the framerate in the last part of the video):



DOWNLOAD ATTACHED.
Title: Re: Dodgin' Diamond 2X (60 FPS)
Post by: ElementCoder on January 30, 2013, 01:54:49 pm
Wow that's awesome. I like the music feature :P I think my time to go learn C and SDL has come now :D
Title: Re: Dodgin' Diamond 2X (60 FPS)
Post by: MasterGeek on February 13, 2013, 09:35:48 pm
Am I supposed to be getting 60 FPS on a Ti-Nspire CX? I only seem to be getting about 48. I have the latest version (0.3.0).
Title: Re: Dodgin' Diamond 2X (60 FPS)
Post by: DJ Omnimaga on February 13, 2013, 10:12:32 pm
Did you use Nover first? I wouldn't be surprised if 60 FPS was in overclocked mode.

Also very nice looking, Hoffa :D
Title: Re: Dodgin' Diamond 2X (60 FPS)
Post by: MasterGeek on February 16, 2013, 03:57:15 pm
I would say that the 60 FPS is overclocked. I tried playing this game when my calculator was overclocked to 252 MHz for the CPU and 65 MHz for the AHB and I got around 57-59. When I opened the FPS meter at the start of the game ,it briefly spiked all the way up to 89 FPS.

Also, is it just me or does one of those screenshots show an FPS of 206? 0.0
Title: Re: Dodgin' Diamond 2X (60 FPS)
Post by: chickendude on February 17, 2013, 03:28:00 am
Very cool, i just loaded it up and i have to say i really suck, but it is super fun! The only thing, and maybe the original is that way too, is that it seems to take a long time to get from one edge of the screen to the other. Still, an amazing program (even if i did more collecting bullets than dodging diamonds ;)). Incredible work, hoffa! All of your projects i've seen so far have been really cool :)
Title: Re: Dodgin' Diamond 2X (60 FPS)
Post by: DJ Omnimaga on February 17, 2013, 03:36:00 am
From memory, FPS is innacurate in the Nspire emulator. I remember when Calc84maniac was working on his 3D engine he got something like 90 FPS, but in fact it ran much slower.