Author Topic: nFrotz—Endless adventure games on the TI-Nspire!  (Read 13928 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55821
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #15 on: May 08, 2013, 02:49:30 pm »
Welcome to the forums by the way! :) What Nspire model did you get?
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline joeym

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 19
  • Rating: +0/-0
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #16 on: May 08, 2013, 11:33:02 pm »
I am happy to be here. I own the TI-nSpire CAS CX.

Back when I was in college, many many years ago the TI-85 was brand new. I had to buy it for my Calculus 1 class. Then I got the TI-92 and shortly after I bought the module that you had to install in order to make it a 92+. Then I got a TI-89 and then a TI-89t.

I still use my 89t a lot at work. For games and for calculations :)

Offline DJ Omnimaga

  • Now active at https://codewalr.us
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55821
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #17 on: May 09, 2013, 07:31:17 am »
Oh nice collection. :D I got a TI-85 and 92 myself, but they were bought in 2009. (I started doing calc stuff on the TI-83+ in 2001). Sadly the 68K series aren't popular here except in university and I think they're even less in United States since the CAS is banned from some tests.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF


Bandcamp|Reverbnation|Facebook|Youtube|Twitter

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #18 on: May 29, 2013, 08:24:53 am »
(reading and replying to posts after the weeks of broken e-mail notifications which caused me to miss lots of topic updates)

We'll try to have a look in the next few days.

Yeah, the silly CAS ban has always made the TI-68k series far less popular than the allowed, but less powerful, TI-Z80 series.

As you'll have found, Joey, the Nspire's programmability is lower than that of the TI-68k series.
« Last Edit: May 29, 2013, 08:29:58 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline catastropher

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +11/-0
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #19 on: May 29, 2013, 01:16:26 pm »
I've actually been working on the code for nFrotz recently. I've added support for games made with the programming language Inform (which previously caused it to crash) and have made it compatible with zblorb files (though for now it ignores any picture data, or anything else besides the zcode for that matter).

I have, however, had some trouble with Nspire I/O. It seems that it doesn't like white, because whenever I try to use it, Nspire I/O prints in gray instead. Does anyone have any idea why this is happening?

Edit: here is a screenshot of a simple test I wrote in Inform 7.



Notice that the background is gray. If I keep the background white, the result is this:



No matter what I do, I can't get the background of the text to be white. The console is created with this code:

Code: [Select]
nio_InitConsole (&console, 54, 30, 0, 0, 15, 0);
As I understand it, 0 is black and 15 is white, so I'm not quite sure exactly why it comes out gray. I suspect there may be a bug in Nspire I/O. Either way, if you'd like to test nFrotz in its current state, download the latest build here (apologies, I would attach it, but I don't have 40 posts yet) => http://goo.gl/P4LDm. For those who are curious, it can run .z1, .z2, .z3, .z4, .z5, .z6, .z7, .z8, and .zblorb files.

To run a game, follow these steps:
  • Rename the file you want to run as filename.z.tns
  • Send the renamed file and nFrotz.tns to your Nspire
  • Run nFrotz to install the .z extension (requires a version of ndless that supports extensions)
  • Run the game file and enjoy!

Many thanks to hoffa for starting the project. If you find any bugs, please email me at mww12 AT zips DOT uakron DOT edu.
« Last Edit: May 30, 2013, 01:13:43 am by catastropher »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #20 on: May 30, 2013, 02:04:18 am »
Interesting :)

catastropher, are you using the latest Ndless SDK revision ?
compu, any idea ?

Having the complete source code might help us debugging your program.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #21 on: May 30, 2013, 03:46:17 am »
The background beging gray instead of white on classic Nspires is a bug of Nspire I/O. Try downloading the latest revision (link in my sig)

Offline catastropher

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +11/-0
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #22 on: May 30, 2013, 01:39:54 pm »
Ah, thank you very much, guys! Using the latest revision did the trick. I did, however, find another unfixed bug in Nspire I/O. It seems that nio_cursor_draw() doesn't take into account the offset of the console position, so if the offset is anything other than 0, the cursor is drawn in the wrong place.

I have, however, fixed the bug and have tested it for all of the different cursor types. compu, where would you like me to send my revised cursor.c?

Edit: ok here are the revised nio_cursor_draw() and nio_cursor_erase():

Code: [Select]
void nio_cursor_draw(nio_console* c)
{
unsigned short color = c->color[c->cursor_y*c->max_x+c->cursor_x];

unsigned char foreground_color = color;

// The starting position of where to draw the cursor
const unsigned short cursor_x_start = c->offset_x + c->cursor_x*NIO_CHAR_WIDTH;
const unsigned short cursor_y_start = c->offset_y + (c->cursor_y*NIO_CHAR_HEIGHT) + NIO_CHAR_HEIGHT;

if((c->drawing_enabled) && (c->cursor_enabled)) {
if (!((c->cursor_type >= 0) && (c->cursor_type <= 4))) {
// Set the cursor type to a valid one
c->cursor_type = 0;
}

int i, j;

if (c->cursor_type == 0) {
// Draw a box for the cursor
for(i = 0; i < NIO_CHAR_WIDTH; i++)
{
for(j = NIO_CHAR_HEIGHT; j > 0; j--)
{
nio_pixel_set(cursor_x_start+i,cursor_y_start-j, foreground_color);
}
}
} else if (c->cursor_type == 1) {
// Draw a horizontal underline (underscore) for the cursor

// Sanity check for cursor_line_width
if (!((c->cursor_line_width > 0) && (c->cursor_line_width <= NIO_CHAR_HEIGHT))) {
// Set the cursor width to 1 (regular cursor width)
c->cursor_line_width = 1;
}

// Draw it!
for(i = 0; i < NIO_CHAR_WIDTH; i++)
{
//for(j = NIO_CHAR_HEIGHT; j > (NIO_CHAR_HEIGHT - c->cursor_line_width); j--)
for(j = 0; j < c->cursor_line_width; j++)
{
nio_pixel_set(cursor_x_start+i,cursor_y_start-j-1, foreground_color);
}
}
} else if (c->cursor_type == 2) {
// Draw a vertical bar for the cursor

// Sanity check for cursor_line_width
if (!((c->cursor_line_width > 0) && (c->cursor_line_width <= NIO_CHAR_WIDTH))) {
// Set the cursor width to 1 (regular cursor width)
c->cursor_line_width = 1;
}

// Draw it!
for(i = 0; i < c->cursor_line_width; i++) {
for(j = NIO_CHAR_HEIGHT; j > 0; j--)
{
nio_pixel_set(cursor_x_start+i,cursor_y_start-j, foreground_color);
}
}
} else if (c->cursor_type == 3 || c->cursor_type == 4) {
// Draw a custom cursor
// This uses pretty much the same code as the regular character drawing

unsigned char background_color = color >> 8;

// Sanity check to make sure the user defined something for the character
if (c->cursor_custom_data == NULL) {
// Set the cursor to a full cursor
int p;
for(p = 0; p <= 5; p++)
c->cursor_custom_data[p] = 0xFF;
}

// Draw it!
int pixelOn;
for(i = 0; i < NIO_CHAR_WIDTH; i++)
{
for(j = NIO_CHAR_HEIGHT; j > 0; j--)
{
pixelOn = c->cursor_custom_data[i] << j;
pixelOn = pixelOn & 0x80 ;
if (pixelOn) nio_pixel_set(cursor_x_start+i,cursor_y_start-j,foreground_color);
else if(!pixelOn) nio_pixel_set(cursor_x_start+i,cursor_y_start-j,background_color);
}
}
}
}
}

Code: [Select]
void nio_cursor_erase(nio_console* c)
{
unsigned short color = c->color[c->cursor_y*c->max_x+c->cursor_x];

char background_color = color >> 8;

// The starting position of where to draw the cursor
const unsigned short cursor_x_start = c->offset_x + c->cursor_x*NIO_CHAR_WIDTH;
const unsigned short cursor_y_start = c->offset_y + (c->cursor_y*NIO_CHAR_HEIGHT) + NIO_CHAR_HEIGHT;

// Draw a box for the cursor
if((c->drawing_enabled) && (c->cursor_enabled)) {
int i, j;
for(i = 0; i < NIO_CHAR_WIDTH; i++)
{
for(j = NIO_CHAR_HEIGHT; j > 0; j--)
{
nio_pixel_set(cursor_x_start+i,cursor_y_start-j, background_color);
}
}
nio_csl_drawchar(c,c->cursor_x,c->cursor_y);
}
}
« Last Edit: May 30, 2013, 02:08:33 pm by catastropher »

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #23 on: May 30, 2013, 01:49:12 pm »
Even if you cannot attach files here yet, you could post the diff in this topic, or send compu a PM :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #24 on: May 30, 2013, 03:55:08 pm »
Thanks catastropher :)
I will integrate your changes as soon as possible (probably tomorrow :P)
btw, I am in the progress of changing the Nspire I/O repository from SVN to Git.
Any new changes will be made to https://github.com/compujuckel/nspire-io instead of the nspforge repo (I'll make a separate post about this once I release a major update or something)

Offline Artorias of the Abyss

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +1/-0
  • "And we shall engage in jolly co-operation!"
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #25 on: June 09, 2013, 08:24:50 pm »
Hell yeah, thanks man. Zork is the shit. It's nice to have a handheld version of it.

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #26 on: June 09, 2013, 08:45:06 pm »
Thanks catastropher :)
I will integrate your changes as soon as possible (probably tomorrow :P)
btw, I am in the progress of changing the Nspire I/O repository from SVN to Git.
Any new changes will be made to https://github.com/compujuckel/nspire-io instead of the nspforge repo (I'll make a separate post about this once I release a major update or something)
You switched to Git? Nice. Feel free to give me access to your repo, my GitHub username is juju2143 and I'll check it out as soon as I'll get my hands on my Prizm (my bro have it atm).

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline catastropher

  • LV2 Member (Next: 40)
  • **
  • Posts: 30
  • Rating: +11/-0
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #27 on: June 10, 2013, 09:46:15 am »
I've been hacking away at the source code for a few weeks now, and I'm happy to say that I'll be releasing nFrotz v1.0 sometime in the next few days! I just need to get the source code cleaned up and a few last minute things ironed out. Oh, and I'd better write the readme too! When I get home, I'll take some screenshots and post them. The new features are:

  • Working status bar at the top (as opposed to just printing it out)
  • Invertable console colors (black on white, or white on black)
  • Built-in file browser that scans the whole calculator for .z files, so no need to navigate to where the game file is. You can also still launch games from My Documents.
  • Better file saving which is compatible with all game files. It stores save games in the nFrotz folder (assuming it exists)
  • Storing of command entries, so you can use the arrow keys to select a previous input
  • Perfect compatibility with .z1, .z2, .z3, .z4, .z5, .z7, and .z8 files, with experimental support for .z6 and .zblorb files.
  • Compatibility with games made with the Inform programming language
  • A whole bunch of unnecessary, yet cool, particle effects (explosions, self assembly, and a black hole effect).

Do you have any last minute features that you'd like me to add? Lemme know!

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #28 on: June 10, 2013, 11:38:55 am »
You switched to Git? Nice. Feel free to give me access to your repo, my GitHub username is juju2143 and I'll check it out as soon as I'll get my hands on my Prizm (my bro have it atm).
Done ;)

catastropher: That sounds really awesome :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nFrotz—Endless adventure games on the TI-Nspire!
« Reply #29 on: June 10, 2013, 01:56:45 pm »
Indeed :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.