Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: lkj on February 12, 2012, 02:28:45 pm

Title: Line Runner for Nspire
Post by: lkj on February 12, 2012, 02:28:45 pm
I'm writing a clone of the iphone game Line Runner. It works but I'll need to implement and improve a lot of things, for example better graphics. The CX isn't supported yet because I don't have one to test and I didn't have time to read everything about how to use the ndless functions for this.

Does anyone know why the nspire emulator gets a totally different speed if I use idle()? And even more different if I let the fast timer run? On calc it's too fast and on emulator it's so slow you can't play.

newest version (http://www.omnimaga.org/index.php?action=dlattach;topic=12607.0;attach=13144)
Title: Re: Line Runner for Nspire
Post by: lkj on February 12, 2012, 05:21:06 pm
Now it should work on the CX, but I'm not sure. Am I right that I can't use the emulator to emulate a cx without boot1?

Has anyone got an idea how to make the game blur less on screens of classic nspires?

Here's also the source:
Title: Re: Line Runner for Nspire
Post by: DJ Omnimaga on February 12, 2012, 05:50:49 pm
The only way to make it blur less on the old Nspires is to reduce the framerate to under 15 fps. There,s no way to remove the blur itself and framerate has to be reduced to keep the game playable.

I should give this a try to see if it works.
Title: Re: Line Runner for Nspire
Post by: lkj on February 13, 2012, 01:02:02 am
I'll try to reduce the framerate when I have time.

I forgot to write what the controls are: left for jump, right for the other thing (don't know the word).
Title: Re: Line Runner for Nspire
Post by: Lionel Debroux on February 13, 2012, 02:08:25 am
Quote
Am I right that I can't use the emulator to emulate a cx without boot1?
Right, TI found it smart to make the CX (and probably CM) series' boot2 not entirely executable after decompression.
Title: Re: Line Runner for Nspire
Post by: ExtendeD on February 13, 2012, 08:16:17 am
lkj, you should post an animated screen shot to promote your program.

Does anyone know why the nspire emulator gets a totally different speed if I use idle()? And even more different if I let the fast timer run? On calc it's too fast and on emulator it's so slow you can't play.

idle() puts the CPU into idle mode until the next interrupt. If you change to timer's frequency, idle()'s execution time will change.
But with throttle mode on, the experience should be the same on nspire_emu and on real hardware. Maybe you should post the source code if you want someone to review the code to check what could be wrong.
Title: Re: Line Runner for Nspire
Post by: Nick on February 13, 2012, 01:24:30 pm
it's not finished right? it only shows 3 blocks to jump over, and 1 to get under... then there's nothing

oh, and there's an error each time i exit the program, here's a pic: (cx cas)
(http://img.removedfromgame.com/imgs/lineError1.jpg)

and maybe it might be more useful to use up and down instread of left and right, it will be more intuïtive..
Title: Re: Line Runner for Nspire
Post by: jwalker on February 13, 2012, 04:21:38 pm
ill have to try this soon... 200th post!
Title: Re: Line Runner for Nspire
Post by: lkj on February 13, 2012, 04:45:07 pm
Ok, new version:
idle() puts the CPU into idle mode until the next interrupt. If you change to timer's frequency, idle()'s execution time will change.
But with throttle mode on, the experience should be the same on nspire_emu and on real hardware. Maybe you should post the source code if you want someone to review the code to check what could be wrong.

It was the same experience with throttle mode off, else it was far too slow. I think now it's better, but I can't test it on my calc because the batteries are empty. Is it a good idea to use set_cpu_speed(CPU_SPEED_90MHZ) to slow it down (I restore it at the end)?

The source code is included in the zip file. But it's not very well commented.

Do I have to use lcd_incolor() at the end if I have lcd_ingray() at the beginning?

Edit: It should be less blurry now since I skip half of the frames on monochrome nspires.
Title: Re: Line Runner for Nspire
Post by: calc84maniac on February 13, 2012, 07:38:43 pm
Hmm, shouldn't set_cpu_speed be deprecated on the CX or something since the values used and the method of setting are different? The set_cpu_speed is probably what causes weird problems upon exit (because CPU speed changes on the CX, unless done in a specific way, only take effect after the program exits)
Title: Re: Line Runner for Nspire
Post by: DJ Omnimaga on February 13, 2012, 08:13:42 pm
Wow the exit glitch was quite scary O.O (see video attached to post below). The game seems kinda nice so far, though. More speed like in The Impossible Game (I lost) would be nice, though.
Title: Re: Line Runner for Nspire
Post by: ExtendeD on February 14, 2012, 03:55:12 am
Do I have to use lcd_incolor() at the end if I have lcd_ingray() at the beginning?

No, it's not really needed.

Hmm, shouldn't set_cpu_speed be deprecated on the CX or something since the values used and the method of setting are different?

It's indeed deprecated.
Title: Re: Line Runner for Nspire
Post by: lkj on February 14, 2012, 05:41:33 pm
I think I've fixed everything except the blur in this new version:
- removed set_cpu_speed()
- removed direct use of timers
- changed rolling again
- faster, more difficult
- getting faster when you reach certain points
Title: Re: Line Runner for Nspire
Post by: hellninjas on February 15, 2012, 03:33:14 pm
Woa This will be very cool!/me downloads
Title: Re: Line Runner for Nspire
Post by: DJ Omnimaga on February 15, 2012, 11:46:01 pm
I don,t think you can do anything about the blur. Blame TI for that.

I wonder if you will add variable platform heights, with hills and stuff, along with holes?
Title: Re: Line Runner for Nspire
Post by: lkj on February 19, 2012, 07:11:12 am
Should I make the framerate constant or should I leave it as it is, sometimes 50 fps and sometimes 62?
Title: Re: Line Runner for Nspire
Post by: runeazn on February 19, 2012, 07:13:18 am
depends if it screws the physics.
Title: Re: Line Runner for Nspire
Post by: lkj on February 19, 2012, 07:47:28 am
I just noticed it would be much more difficult than I thought, so I'll leave it as it is.

I wonder if you will add variable platform heights, with hills and stuff, along with holes?

I think I'll first add animations, since I would have to rewrite almost everything to implement your suggestions.
Title: Re: Line Runner for Nspire
Post by: TIfanx1999 on February 19, 2012, 09:54:24 am
No need for two separate posts so close together, so I combined them. :) For future reference, you can use the "modify" button if you just have a quick thought to add.
Title: Re: Line Runner for Nspire
Post by: lkj on February 20, 2012, 04:14:19 pm
Sorry, I didn't notice I doubleposted.

I read that just moving the screen for scrolling and only drawing the new pixels would be faster than redrawing everything, but would I have to memcpy every line or is there a faster way?
Title: Re: Line Runner for Nspire
Post by: ExtendeD on February 20, 2012, 04:48:58 pm
It's the good way, but use memov instead of memcpy.
Title: Re: Line Runner for Nspire
Post by: lkj on February 21, 2012, 04:53:51 pm
Am I right that I need two buffers for this, one for everything that I want to display and one for the parts of the screen that get shifted.
Title: Re: Line Runner for Nspire
Post by: lkj on February 23, 2012, 11:33:03 am
I implemented the memmove scrolling and it's a bit slower, I think because it needs two buffers and has to copy both every frame :(
The old method got 1800 fps and the new one only 1450 in the emulator.

Edit: by only copying the needed parts of the buffer I get 1600 fps
Title: Re: Line Runner for Nspire
Post by: lkj on May 20, 2012, 03:12:48 pm
After some months without calc programming I finally returned and continued this project  ;D

It now has an animated stick figure, but for now only when running (because I'm not very talented and slow in drawing). It probably rather looks like a walking figure than like a running one :-\

And I created a moving screenshot with Jonius7's tutorial (http://ourl.ca/6943) ;)
Title: Re: Line Runner for Nspire
Post by: DJ Omnimaga on May 20, 2012, 03:22:38 pm
Glad to see this progressing again. :)
Title: Re: Line Runner for Nspire
Post by: AzNg0d1030 on May 20, 2012, 05:19:27 pm
Wow looks really nice! I'm going to try it out right now
Title: Re: Line Runner for Nspire
Post by: lkj on July 05, 2012, 01:15:34 pm
This will probably be the last update on this project because it's more or less complete and I'm more interested in new ideas.
I don't remember everything I've changed, but the most important thing is that it now generates a different level every time you run it.
Title: Re: Line Runner for Nspire
Post by: apcalc on July 05, 2012, 09:25:22 pm
Nice little project!  Good work! :)
Title: Re: Line Runner for Nspire
Post by: cyanophycean314 on July 05, 2012, 10:30:32 pm
Nice job.  :)