Author Topic: So I am porting Quake to the Nspire...  (Read 48929 times)

0 Members and 2 Guests are viewing this topic.

Offline rwill

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +3/-0
    • View Profile
So I am porting Quake to the Nspire...
« on: June 15, 2014, 01:37:33 pm »
So with the recent release of ndless for 3.6 I have chosen to aquire a TI-Nspire CX and do some programming.

To get a feeling for the platform I have further chosen to port some first person shooter from 1996 and in nspire_emu it runs pretty well. However on my OS 3.6 Nspire CX CAS it first did not run at all and once I removed all printfs it ran but was kind of slow compared to nspire_emu. So I have some questions ..

1. Does it matter if I try to printf to the console ( serial port ? ) and there is no receiver connected ? From my program failure it appears so but I rather have the printfs() in so I can debug using nspire_emu. Are there other pitfalls that do not occur in nspire_emu but do on real hardware that can cause something like this ?

2. Either my Nspire ( hardware revision M ) is slower than normal Nspires or nspire_emu is faster than the actual hardware. As with porting some game most time is spent adapting to the new platform ( read optimizing ) I am wondering if nspire_emu is even cycle accurate or if I can only rely on benchmarks run on the real hardware.

So this is all that is going around in my head now.. I'll try to attach some photo to show my current progress.


PS: To skip my introduction in the introduction board I am the guy that did that Delsgolf FPS for the TI-89 last year.

*edit* Changed Title
« Last Edit: July 12, 2014, 06:10:51 am by rwill »

Offline kevinkore3

  • LV3 Member (Next: 100)
  • ***
  • Posts: 57
  • Rating: +0/-0
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #1 on: June 15, 2014, 02:08:39 pm »
From my experience, nspire_emu is a lot faster than the calculator, even at the same CPU frequency. It's not an accurate benchmark for performance (I wish it was).

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #2 on: June 15, 2014, 02:10:44 pm »
Are you using nGL for this, or some other libraries?
I am Bach.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #3 on: June 15, 2014, 02:19:23 pm »
Quote
1. Does it matter if I try to printf to the console ( serial port ? ) and there is no receiver connected ? From my program failure it appears so but I rather have the printfs() in so I can debug using nspire_emu. Are there other pitfalls that do not occur in nspire_emu but do on real hardware that can cause something like this ?
Don't call printf on real hardware, just use a macro like
Code: [Select]
#ifdef DEBUG
    #define debug(x, ...) printf(x, __VA_ARGS__)
#else
    #define debug(x, ...)
#endif
and only define DEBUG if you're using the emulator.
The HW waits for the data to be transmitted, nspire_emu doesn't wait and just emits it. This can cause a huge slowdown on HW.

Also, nspire_emu is a lot faster in some cases, but if you're doing heavy IO, such as memory access, it's roughly the same.

Offline rwill

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +3/-0
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #4 on: June 15, 2014, 02:25:20 pm »
Are you using nGL for this, or some other libraries?

I am using the original WinQuake sources as released by id software without any additional libraries.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #5 on: June 15, 2014, 03:14:25 pm »
Wow that does look good. And yeah, Nspire_emu is totally not accurate. Memory accesses for example are a lot faster than on real hardware among other things.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: So I am porting that first person shooter to the Nspire...
« Reply #6 on: June 15, 2014, 09:10:47 pm »
This looks very nice, especially with the diagonal parts of the walls/ceiling. Knowing the great work you did in Desgolf I can only assume that this Nspire FPS will be very solid. :D

Welcome to the forums by the way :)
Dream of Omnimaga

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: So I am porting that first person shooter to the Nspire...
« Reply #7 on: June 15, 2014, 10:35:06 pm »
This is looking awesome. Welcome to Omnimaga!
!peanuts

Ninja edit: Is that Quake? O.O
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: So I am porting that first person shooter to the Nspire...
« Reply #8 on: June 16, 2014, 09:23:42 am »
Is that Quake? O.O
My reaction exactly.
also.
!peanuts
I'm not a nerd but I pretend:

Offline Princetonlion.tibd

  • Members
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 790
  • Rating: +3/-4
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #9 on: June 16, 2014, 09:26:29 am »
!peanuts
And it's a FPS!

Offline rwill

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +3/-0
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #10 on: June 16, 2014, 03:58:34 pm »
This is looking awesome. Welcome to Omnimaga!

Ninja edit: Is that Quake? O.O

Yes it is Quake. I kind of overestimated the speed of the Nspire CX though so it will never run really fast i guess. TI calculators do not seem to follow Moore's law.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: So I am porting that first person shooter to the Nspire...
« Reply #11 on: June 16, 2014, 04:00:43 pm »
Indeed. In 1997, Z80 calcs had 96 KB of user RAM available. Now in 2014, they have fewer than 24 KB and cost as much. Granted, there is Flash, but still, it all comes back to XKCD #768. At least the HP Prime is a signifiant hardware:price ratio improvement, although there is still work to do and it cannot run ASM/C yet.
Dream of Omnimaga

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #12 on: June 17, 2014, 04:07:34 am »
Wow that's epic. O.O

Also the game welcome to Omni ! :D
!peanuts

Offline Roondak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 54
  • Rating: +4/-3
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #13 on: June 18, 2014, 05:35:43 pm »
Very impressive, can't wait to try this on my Nspire!

Offline rwill

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +3/-0
    • View Profile
Re: So I am porting that first person shooter to the Nspire...
« Reply #14 on: June 25, 2014, 04:10:26 pm »
-- Development Update --

Although I have run my fair share of tests it would be cool if some other people can test it and report any errors found. Like graphical errors or crashes.

So if someone wants to test it here is a current build + sources. You need a CX to run, non-color nspire wont work.

In addition to the quake binary for the nspire you need at least the shareware data file pak0.pak. This is kind of hard to get when not running MS-DOS and one wants to honor the license so I deliver instructions:

-- Begin of Instructions of how to get the Shareware pak0.pak --

Get the quake shareware release quake106.zip somewhere of the internet.
One place is here: ftp://ftp.netbsd.org/pub/pkgsrc/distfiles/quake106.zip

Inside the quake106.zip is a file called resource.1 - Extract it and rename it to resource.x

Get the LHa compression/uncompression utility. For Unix ask your packet manager. On windows this is somewhat hard but you can get a binary release here: http://gnuwin32.sourceforge.net/packages/lha.htm ( Binaries, the lha.exe inside the .zip is in /bin ). I read somewhere that the japanese Windows 7 gets it as an addon for the file explorer so you can also try that.

Move resource.x to a temporary directory and extract it. On windows you can do this with "lha x resource.x" if you moved lha.exe to the same temporary folder or lha.exe is in your $PATH. This hopefully creates a lot of obsolete files and a directory called "id1" which contains "pak0.pak"

You can also get Quake off Steam or so I heard.

-- End Of Instruction of how to get the Shareware pak0.pak --

MD5 Sums of the quake data files
pak0.pak 5906e5998fc3d896ddaf5e6a62e03abb
pak1.pak d76b3e5678f0b64ac74ce5e340e6a685 ( registered version )

On the calculator you need a directory structure like so:

quake/nquake.tns
quake/id1/pak0.pak.tns
quake/id1/pak1.pak.tns ( optional, if you bought Quake and got the pak1.pak file of the registered version put it there )


Then run nquake.tns