Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: ajorians on June 28, 2013, 09:39:08 pm

Title: nTileWorld (a Chips Challenge port)
Post by: ajorians on June 28, 2013, 09:39:08 pm
Hey Guys,

Tile World is an open source reimplementation of Chips Challenge.  I have been working on porting it to the Nspire calculator.  It is playable!  So download the attachment and add it to your calculator.  It can be added to any folder; and then you need the 3 subfolders (with content) relative to the main program.  It'll make sense one you download this.

I did try it on a non-CX Nspire and it looked rather good!  I am not a good player of this game; so what I could use from all of you is to try the game.  I beat several of the levels; but let me know if they are all beatable!

Some differences are: I made it so you can advance/go back to previous level using the 'n' and 'p' keys without needing to beat the prior levels or typing in a password.  You can restart a level by pressing the 'r' key.  I don't have keeping track of completed levels.  And it isn't finished so there may be more as I keep working on it.

I do have some bugs that I know of.  But let me know if you find a bug.  I know when choosing the level it sometimes says the wrong ruleset for a levelset.  And pressing escape on the level selector doesn't exit; but just choose a levelset and then press escape and it'll exit.  And I know about the text display issues.  I'll do some bug fixing soon! :)

But all in all I think it game is coming out amazing!  So let me know what you think!

And have a great day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on June 28, 2013, 10:46:18 pm
I'm in the process of porting this same exact game and was going to finish it in a few days.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on June 29, 2013, 08:24:28 am
I'm in the process of porting this same exact game and was going to finish it in a few days.

I didn't know; but please keep working on yours!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Sorunome on June 29, 2013, 08:25:41 am
wow, that's looking great! :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: TIfanx1999 on June 29, 2013, 09:19:38 am
Looks nice. What language is this done in?
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on June 29, 2013, 11:59:15 am
I'm in the process of porting this same exact game and was going to finish it in a few days.

I guess we could put together the code of both of our versions, after I finish.

Looks nice. What language is this done in?

It's in C and uses SDL.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: DJ Omnimaga on June 29, 2013, 01:03:36 pm
Wow this looks great! Glad this game is finally arriving on the Nspire. However, make sure to state that it's Chips Challenge in the title on ticalc.org, else people who are seeking for a clone of that game will miss out.  :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: AlexisVieira on June 29, 2013, 02:29:56 pm
Good work :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on June 29, 2013, 04:44:07 pm
Hi Guys!

Legimet: Go ahead and use any code modifications I made!  I added a preprocessor define: NSPIRE_BUILD that I put in the code A LOT!  I also put in another one called USE_NSPIRE_FONT that when defined will use nSDL_DrawString.  I did that because then I wouldn't need the external file font.bmp.tns.  I #ifdef out so much because I didn't realize all that Tile World had.  I've been replacing the function 'exit'; which is why I have a bug when pressing Escape on the levelset menu (but I'll fix it)!

Oh and by the way one "bug" that I do want to fix is if you don't have a certain external files (or not in the correct subfolder) I think I crash; but I'd like to make an error message instead! :)

DJ Omnimaga: If you think it is best to called it Chips Challenge I will.  Because I used some one's source code I figured I shouldn't rename the port of their project.  BTW, the original title for Chips Challenge was Tile World.

Thanks for liking it!  And have a terrific day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on June 29, 2013, 05:05:51 pm
I'm trying to work on drawing the text, because nSDL_DrawString doesn't support multiline text
And I'm using ifdefs for it, because the font engine built in to Tile World makes it crash for some reason.

EDIT: No need to use NSPIRE_BUILD, _TINSPIRE is built in to nspire-gcc ;)
Also, my version gives an error message if you don't have a certain file (using show_msgbox in libndls)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: DJ Omnimaga on July 01, 2013, 04:17:02 am
Well I think both titles would be fine. Just maybe call it nTileWorld officially, but in the ticalc.org title field write the same thing as this topic name :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: hoffa on July 01, 2013, 06:20:30 am
I'm trying to work on drawing the text, because nSDL_DrawString doesn't support multiline text
And I'm using ifdefs for it, because the font engine built in to Tile World makes it crash for some reason.

EDIT: No need to use NSPIRE_BUILD, _TINSPIRE is built in to nspire-gcc ;)
Also, my version gives an error message if you don't have a certain file (using show_msgbox in libndls)
Actually you can just use the '\n' character in your string for a new line. There was a nSDL_DrawStringInRect() function before but it was just unnecessarily complexifying the code with minimal benefits.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on July 01, 2013, 06:50:56 am
I'm trying to work on drawing the text, because nSDL_DrawString doesn't support multiline text
And I'm using ifdefs for it, because the font engine built in to Tile World makes it crash for some reason.

EDIT: No need to use NSPIRE_BUILD, _TINSPIRE is built in to nspire-gcc ;)
Also, my version gives an error message if you don't have a certain file (using show_msgbox in libndls)

Oh yeah; I forgot about _TINSPIRE!  I'm excited to see your version!  Are you using bFLT?  I kept using the traditional loader for no good reason (other than I am comfortable with it).  Which meant I hit an issue with the creaturepoolend variable and instead of using nl_relocdata I was seeing if I could do without that variable.

Have a great day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 01, 2013, 12:31:27 pm
Hoffa, I'll see if I can put '\n' in the text.

I'm using bFLT, no need for nl_relocdata. And the old linker is now considered the "legacy" linker. You should use nspire-ld-bflt.

EDIT: Almost done, I think. I'll finish tomorrow, hopefully.

EDIT 2: Now it works on the Lynx ruleset but crashes on the MS ruleset. Also I have to add nSDL font support.

EDIT 3: Crashes here:
Code: [Select]
((creature**)creaturepoolend)[0] = cr;Hmm, the creaturepoolend issue has nothing to do with the legacy format, because I'm having that issue with bFLT. It's probably an OS issue, I guess

EDIT 4: The creaturepool stuff really does seem to be unnecessary, it's not used in any function except resetcreaturepool(), freecreaturepool(), allocatecreature(), and shutdown(). And I didn't understand why the creatures have to be added to the creaturepool So I just removed that stuff. :) Now mine works perfectly, except I'm using tworld's font support instead of nSDL's, and the bitmaps are screwed up. I'll fix that soon.

EDIT 5: Attaching zip file of what I have so far.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: DJ Omnimaga on July 03, 2013, 11:25:07 pm
When I have some time, I'll give both versions a try. Thanks for posting this :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 04, 2013, 06:38:35 pm
Another version, this time with nSDL font support. :)

Set the font from rc.tns. By default it is NSDL_FONT_TINYTYPE.
The data files you need to send (in the dir of tworld.tns) are in datafiles.zip. atiles.bmp.tns is screwed up, it will fallback to tiles.bmp.tns. I'll fix it later.
And no compiler warnings anymore :)

ajorians: Do you know why some of the magenta remains in some tiles when displayed (in my version)? I'll look at your code and see if I can fix it.

EDIT: I think it's a problem with the bitmap. And I released a new version, which fixed a memory leak, added keyboard shortcuts, and edited the help.

EDIT 2: Updated the tiles.bmp.tns file, as ajorians described below.

EDIT 3: Added .tns extension to save files (so you can see them in the document browser and remove them easily).
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on July 06, 2013, 08:27:53 am
Hi Legimet,

I finally got a chance to try out your TileWorld!  Nice!

I used a the Gimp to edit the images.  I think I did see magenta when I didn't have interpolation set to None.  Which I think makes sense because an interpolation is great for photos and the like but with sprites I didn't want it to blend a magenta pixel with another pixel.  Hope that helps!

Keep working on this I am liking how it looks!

Have a great day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 06, 2013, 03:52:28 pm
Thanks, I figured it was something to do with the pixel averaging, but I didn't know how to fix this in GIMP. I updated the tiles.bmp.tns file above.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 08, 2013, 11:29:09 pm
I made atiles.bmp.tns! This means that you can use animated tiles:
(http://img.omnimaga.org/test-1.gif)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: tr1p1ea on July 09, 2013, 12:32:21 am
Looking awesome!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Hayleia on July 09, 2013, 03:23:22 am
Looking awesome!
I completely agree with the above sentence.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Streetwalrus on July 09, 2013, 06:10:19 am
Eyup that looks pretty good. Too bad I don't have my Nspire to test right now. D:
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on July 09, 2013, 06:53:55 am
Yay!  Looks really good!  When I get a chance; I'll download all of the levelsets from here: http://www.pillowpc2001.net/levels/name.htm

That page states: "There are currently 550 level sets on the list, containing about 23708 levels"

I'm excited to play this! :)  Good work!

Also have a great day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Sorunome on July 09, 2013, 11:40:04 am
Wait, how many official levels are there? O.O
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on July 09, 2013, 11:54:10 am
Hi Sorunome,

I got introduced to Chips Challenge in MS's Best of Windows Entertainment Package which has 149 levels.  But you can swap out the CHIPS.DAT file and it'll play those levels instead.  Tile World allow you to choose the level set and now there are many, many user created level sets!

Hope that helps answer your question.  Here is a wikipedia link: http://en.wikipedia.org/wiki/Chip%27s_Challenge

Have a great day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Sorunome on July 09, 2013, 12:08:00 pm
Ok, cool, thank you!
That sure are a ton of levels O.O
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 09, 2013, 01:11:40 pm
You can put level sets (which, by convention, have an extension of .dat(.tns)) into the sets directory and they should show up. Alternatively, you can put them into the data directory and use configuration files (http://www.muppetlabs.com/~breadbox/software/tworld/tworld.html#12) (usually .dac(.tns)) in the sets directory. If you have chips.dat.tns, CCLP2.dat.tns, or CCLP3.dat.tns, you can put them directly into data, since there are already .dac files for those.
ajorians, thanks for the page with level sets, and for letting me use your code! :)

EDIT: ajorians' version at the beginning of this thread has CCLP2.dat included, so if you installed it, you already have CCLP2.dat.tns.
EDIT 2: My zip in the next post now has CCLP2 and CCLP3 included. :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 12, 2013, 08:42:12 pm
The new zip has CCLP2 and CCLP3 included, and changes unslist.txt.tns to add .tns extensions to the file names. CCLP3 supports both the Lynx and MS rulesets. Also, the squares with the keys and boots that you pick up on the right now fits on the screen. And now all the tns files are in files.zip and the source code is in tworld.zip. You do not need to send the CCLP2 and CCLP3 directories to your calculator. These are only included because both of these level sets say that you can distribute them only if you keep all the files intact.

EDIT: Minor update. Shouldn't change any functionality, but changes help text to say that you can exit Tile World by pressing Esc.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 18, 2013, 11:13:38 pm
OK, I fixed some display issues and listing of the solution files when pressing Ctrl-S.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 27, 2013, 10:02:53 pm
A few days ago, I was playing for a long time, and it said out of memory. Then I quit and started it again and it said out of memory right when I started it.
The main memory leak was in mslogic.c, where it wasn't freeing the creatures properly. There was also one in fileopen if a file didn't open.
So, today, I fixed the memory leaks! :)

EDIT: Fixed a small issue.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: DJ Omnimaga on July 27, 2013, 11:00:33 pm
I just saw the new screenshot. It really looks great. I should really try this ASAP. I played the 84+ version before (which includes all levels, although the 83+ one is split in 3 parts since they don't fit) and I enjoyed that game.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on July 28, 2013, 08:47:37 am
Now it looks like that screenshot except everything fits on the screen :P
(assuming you use NSDL_FONT_TINYTYPE)

(http://img.ourl.ca/tworld1.gif)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Sorunome on July 28, 2013, 11:30:21 am
Aren't those sprites different from the original ones?
And if yes, why don't you use those?
Looking good anyways ;)
Title: Re: Re: nTileWorld (a Chips Challenge port)
Post by: DJ Omnimaga on July 28, 2013, 02:00:38 pm
Those look nice as well. They look more NES-like actually.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on August 07, 2013, 11:32:17 am
Well, Chip's Challenge isn't freely distributable, so I can't use the tiles that come with it ;) (And I don't have a copy of it)
The README says that you can extract the bitmap from the Chip's Challenge exe with a resource editor and use it in Tile World (but you'll have to halve the dimensions so it fits on the TI-Nspire screen)

The tiles that I'm using are just the ones included in Tile World (resized), which are public domain.
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Sorunome on August 07, 2013, 11:52:56 am
Oh, ok, makes sence.
Sometimes all this copywrite stuff just sucks x.x
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Streetwalrus on August 08, 2013, 02:21:14 pm
A readme would be much apreciated because I'm a bit confused with how to install it. :/
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on October 31, 2013, 03:02:11 pm
Hey Guys,

I've been taking care of some personal stuff and I think I might be able to get some free time to work on calculator stuff :)

Anyhoo, I downloaded a lot of level sets from http://www.pillowpc2001.net/levels/ and gave them the .tns extension and some other things.  You can grab that here: https://drive.google.com/file/d/0B4Qw8dBkod2qTDU3c0lKQ0liOUk/edit?usp=sharing (it was just over 4MB so I couldn't attach it).  In it is 294 level sets.  After I added them all to my calculator (close to 10MB) tworld starts up however it took about 20 seconds.  So if you were to transfer some of them to your calculator transfer a reasonable amount as 20 seconds is a tad high.  There is no guarantee that every level set will be beatable or even work at all.  In my limited testing every one I started seemed fine.

I didn't add the ruleset line which is something you can add for Tile World so let me know what you think of that.  The screenshot only has a small subsection of the levels.  I think it is fairly self-explanatory how to add these levels; copy the files you want from the 'data' directory to the 'data' directory for tworld and the same named file from the 'sets' directory to the 'sets' directory for tworld.  Holler if you need assistance.

Have a great day!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: Legimet on October 31, 2013, 10:08:42 pm
Thanks ajorians! :)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: SpiroH on November 01, 2013, 03:47:45 am
I've been taking care of some personal stuff and I think I might be able to get some free time to work on calculator stuff :)
Hope it wasn't anything too serious. Nice to hear you are back. Have good programming ideas and projects we'll appreciate them.;)
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on November 01, 2013, 08:56:51 am
Legimet: Actually thank you!  I've been using your version you posted and I like it.

SpiroH: Oh it was good things; nothing bad.  Also I'll be alright if it were otherwise -- I manage. :)

I hope to have today be a programming day!

Talk to you all soon!
Title: Re: nTileWorld (a Chips Challenge port)
Post by: ajorians on January 10, 2015, 08:50:53 pm
Hey Guys,

I worked on this program just a tad today.  Basically I was just having fun; but maybe some of this might be useful to some of you!

I compiled it again but with the latest Ndless SDK so it is a Zehn binary.

You already can set the level file's extension, .dac, to open with this program.  I don't know if anybody did.  So I made it so on first run it'll add it for you.  This way if you have lots of levels you can just run the level set information file instead of finding it in the menu.

But as you know having lots of files will slow down your calculator.  So I finally made it so you can have multiple level-sets in a single file.  So take a look at the screenshot below with lots of "files".  There are a whopping 295 level-sets in that list and the level data adds up to 8.9MB.  Had all those been separate files you'd have 2x295 files on your calculator because there are two files per level set (level data and set information file).

To combine many level sets into one can be done manually.  With the level data files you can just cat the files.  And in the set information file I added "filestart=###" where the number is the byte offset into the file.  Doing it manually can be tedious if you have more than 2 level-sets so I attached a small C file that would grab all the level data sets you have from a subdirectory and pack the level sets.  I have it so that packing program also turns off passwords so you could press Ctrl + N and Ctrl + P to go to the next and previous levels.  I've been finding that a lot of these levels are quite hard!

Attached is the calculator executable and the source.

Hope you find this interesting! :)  And have a great day!