Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Matrefeytontias on January 03, 2013, 06:07:32 am

Title: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 03, 2013, 06:07:32 am
THIS POST IS OUTDATED !!! SEE THE LAST PAGE OF THE TOPIC INSTEAD.

Hey guys,

Since I'm back working on Mode 7, let's make a game out of that :P

For now the Mode7 perspective engine is done, and I wrote a masked sprite routine (for transparency), but that's all for now.

I'm actively working on it, so I'll post update regularly :)

Screenshots history (from newest to oldest) :

Spoiler For Gif support for maps, original Mute City 1 map from SNES F-Zero !:
(http://mattias.refeyton.fr/espace-ti/F-ZeroTrackSpire/1.gif)

Spoiler For Moved origin, acceleration/deceleration and sample map:
(http://mattias.refeyton.fr/espace-ti/mode7/nspire/mode7track1.gif)

Spoiler For Masked sprite:
(http://mattias.refeyton.fr/espace-ti/mode7/nspire/mode7groundSprite.gif)

Spoiler For Mode7 engine working !:
(http://mattias.refeyton.fr/espace-ti/mode7/nspire/mode7ground.gif)

Share comments :)

(if you want to test the program, both files must be in the same directory)
Title: Re: [C] F-Zero : trackSpire
Post by: ExtendeD on January 03, 2013, 07:22:37 am
Nice start :)
Title: Re: [C] F-Zero : trackSpire
Post by: TheNlightenedOne on January 03, 2013, 03:22:54 pm
That looks awesome. I might be able to create a track or two if you like.
Title: Re: [C] F-Zero : trackSpire
Post by: tr1p1ea on January 03, 2013, 05:29:06 pm
Have you looked at modding it to a tilemap? Or will you just be using pictures.
Title: Re: [C] F-Zero : trackSpire
Post by: squidgetx on January 03, 2013, 06:25:21 pm
Looks pretty awesome, though the perspective seems off a bit- lines seem to converge above the horizon :(
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 03, 2013, 06:36:03 pm
@TheNightenedOne yeah it can be helpful :) I'll first draw a sample for you to see over-looking of it.

@tr1p1ea I'll use full pictures for that.

@squidgetx yeah I know, but don't worry, I'm only in early testing stage :) I didn't really care of those details when I made the firsts builds of the engine.
Title: Re: [C] F-Zero : trackSpire
Post by: Spenceboy98 on January 03, 2013, 06:53:36 pm
Did you base this somewhat off of the tunnel program?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 03, 2013, 06:57:27 pm
Nope, not at all :P in fact it has nothing to do with this program. It's something completely different of the tunnel.
Title: Re: [C] F-Zero : trackSpire
Post by: Spenceboy98 on January 03, 2013, 06:58:18 pm
Nope, not at all :P in fact it has nothing to do with this program. It's something completely different of the tunnel.

But you used the same texture from the website? :P
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 03, 2013, 07:04:58 pm
It was the only texture I could think of at this moment ;D but don't worry, there will be better tracks than this one :P
Title: Re: [C] F-Zero : trackSpire
Post by: Spenceboy98 on January 03, 2013, 07:14:14 pm
Too bad I don't have an Nspire. :P
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 03, 2013, 10:56:24 pm
This looks very nice. I wonder if on a real calc the framerate is as smooth as this raycaster for Ndless 1.0? http://ourl.ca/64510
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 04, 2013, 05:17:57 am
Well, I let people who have an Nspire test :P (I can't have mine, so I'll test my game a few months later)

Also, big update !

Camera placement is now resolved, the ship is at the origin - this result in a much better gameplay. I drew a sample map to test the engine (and be sure that it works), and I made the movements smooth, like if you actually were in the ship :)

I don't have collisions at all, so you can make your way outside the map - but I don't think it's safe for your calc ...

See the first post for the screenshot ;)

Downloads of the current version : Executable (http://mattias.refeyton.fr/espace-ti/mode7/nspire/mode7.tns) and sample map (http://mattias.refeyton.fr/espace-ti/mode7/nspire/muteCity.bmp.tns) (beware, this latest is 1MB, I really need to implement PNG reading).
Title: Re: Re: [C] F-Zero : trackSpire
Post by: TheNlightenedOne on January 04, 2013, 09:27:38 am
Can we have a screenie of the new update?
EDIT: Never mind, its in the first post
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 04, 2013, 10:38:23 pm
Darn this looks nice! O.O Now it just needs a background like in the original game that scrolls when you turn around. Seems quite fast too. As for the resolution it seems perfect for this kind of game and speed, although if you ever decide to go with large textures I wonder if this would take a lot of memory compared to your F-Zero SNES style screenshot?
Title: Re: [C] F-Zero : trackSpire
Post by: squidgetx on January 04, 2013, 10:43:00 pm
That's looking pretty awesome! Is it possible to run it at a higher resolution, or does it slow down too much?
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 04, 2013, 10:54:01 pm
I think it might actually slow it down a lot (about 4 times slower), but one thing he could do is have the first 1/3 of the screen show up at max vertical resolution and the rest remains pixelated as it is. Vertical resolution should remain the same, though.

However, from the 1 MB Mute City file, I think for mode 7 he's actually displaying a giant bitmap rather than a tilemap. I wonder if a real tilemap + map engine would be faster than displaying a giant tiled pic?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 04, 2013, 11:08:34 pm
@squidgetx in the screenshot I draw pixels 2 by 2, because drawing each pixel make the game so slow that it's unplayable (yeah DJ_O, 4 times slower).

For now I use a giant raw bitmap as a map, because I can just pick up a pixel and display it - the color has the exact good format.

What I planned is to encode each pixel of the map with 4 bits (instead of 3 bytes with the actual map). The main idea is that a pixel can either be a colour or a pixel of a texture. This difference is set using the actual value of the pixel. What I planned is :

If the 4-bits value of the pixel is lesser than 4, fill it with the corresponding colour of a 4 colours-palette.

If it's from 4 to 15 inclusive, then display it as a pixel of the corresponding texture loaded from a 12 textures array.


This should divide the size of the maps at least by 6 - and the original SNES Mute City map will still be more than 2Mb O.O
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 04, 2013, 11:09:44 pm
Do you plan to switch to tilemaps using 16x16 tiles to form it? Because that might make collision detection easier then.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 04, 2013, 11:14:29 pm
I don't think so, because the shape of the track doesn't seem to fit for a tilemap - it has too many curves and stuffs.

And for collision, I noticed that a colour that was in a certain part of the map (by part, understand the road, the plasma balls on each side etc) was not in any other. So to make collision detection, I can just test the area of the ship and see if it contains a certain colour or not. And I still can use the 4-bits identifier of the pixel to detect collision - faster than accessing the scren.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 04, 2013, 11:19:01 pm
Ah ok I see. If you can use the color you're talking about for collision that is fine, though. In case you are worried that cars going too fast might skip over that color, then you can maybe make that color a bit wider maybe if it doesn't destroy the map look.

Just make sure the game doesn't end up too big, though. Maybe a PNG -> BMP decompression routine or something?
Title: Re: [C] F-Zero : trackSpire
Post by: fb39ca4 on January 07, 2013, 06:05:24 pm
What method are you using to render the mode 7 effect? Also, you should consider implementing mipmaps, it will reduce the noise you see in the distance.

http://en.wikipedia.org/wiki/Mipmap
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 07, 2013, 07:57:44 pm
the shape of the track doesn't seem to fit for a tilemap - it has too many curves and stuffs.
Actually one thing: the original SNES F-Zero used 8x8 tiles for the tracks. I doubt collision detection and curves were as complex as they look like, considering the limited SNES hardware. Basically any tile that is less than half a block/road side is flagged as road tile, while everything else is flagged as solid tile.

(http://pages.infinit.net/voxel/FZ-AllTiles9A_9B.png)

The above are the tiles for Mute City 1. To cut down on the amount of tiles you could also simply eliminate those complex curves entirely. I doubt they're really that necessary anyway when you already have 45° angle blocks.

But if you manage good compression from big images, then I guess they can be used as well. You could also easily modify them to have stuff not seen in the SNES F-Zero too.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 08, 2013, 09:25:55 am
@t0xic_kitt3n since I want to save space, I prefer keep the display as it is (which I consider not that bad).

@DJ_O with hoffa's recent port of SDL_image, a map like the original SNES Mute City (14MB in raw bitmap) will only take 500KB once converted in gif and reduced from 6880*3488 to 3440*1744 (and I'll make it to keep a good display).
Title: Re: [C] F-Zero : trackSpire
Post by: ElementCoder on January 08, 2013, 10:25:37 am
Wow looking good there! Those were some good times :) Too bad I just upgraded to OS 3.2 so I can't test it atm :(
Title: Re: [C] F-Zero : trackSpire
Post by: Lionel Debroux on January 08, 2013, 10:36:50 am
Matref: using tilemap definitions + tile images to encode tracks, as mentioned by DJ_O, could save a bit of space over pre-rendered images (and might help with collision detection) :)
It's just a slightly different tradeoff: the permanent memory consumption (space taken in the FS) would probably be lower; the runtime memory consumption would be roughly the same; the setup time (generating the track's image) would be a bit higher, though it's not very time-consuming to blit a bunch of aligned images.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 08, 2013, 10:39:00 am
@ElementCoder : thanks :) I would recommend to wait a bit before test it though ;)

@Lionel Debroux : I can't blit a bunch of aligned images, I need to transform and blit separately each pixel of them. And I'm way too lazy to design all the tiles and re-design (again) all the maps :P (jk, I'll certainly do that, but later)
Title: Re: [C] F-Zero : trackSpire
Post by: Lionel Debroux on January 08, 2013, 10:55:03 am
Quote
I can't blit a bunch of aligned images, I need to transform and blit separately each pixel of them
And precisely, for generating each pixel of the large image (pixels which you will, indeed, later transform and draw separately), you could use tilemap definitions + tile images ;)

Quote
And I'm way too lazy to design all the tiles and re-design (again) all the maps :P (jk, I'll certainly do that, but later)
OK.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 08, 2013, 11:00:16 am
Quote
I can't blit a bunch of aligned images, I need to transform and blit separately each pixel of them
And precisely, for generating each pixel of the large image (pixels which you will, indeed, later transform and draw separately), you could use tilemap definitions + tile images ;)

Yeah I know that, but now that I think of it, using tiles is slower than parsing a whole map, because in addition of the initial operations that applies to a large map you'll have to find, load and apply calculations to pixels of different tiles (things that you don't have to do with a single image). Of course it saves size, but make the program slower. I think I'm better with a single image per map (that doesn't mean I can't change my mind tho, if I optimize my program to go fast enough maybe I'll have both speed and lightness).
Title: Re: [C] F-Zero : trackSpire
Post by: Nick on January 08, 2013, 12:15:30 pm
I think I'm better with a single image per map (that doesn't mean I can't change my mind tho, if I optimize my program to go fast enough maybe I'll have both speed and lightness).
So you mean like a different image for every track? won't that be a lot of wasted space? And you'll need an additional array/structure that overlays the track on the image, which could go wrong if there's some misplacing of the overlapping.
Title: Re: [C] F-Zero : trackSpire
Post by: Hayleia on January 08, 2013, 12:34:59 pm
Quote
I can't blit a bunch of aligned images, I need to transform and blit separately each pixel of them
And precisely, for generating each pixel of the large image (pixels which you will, indeed, later transform and draw separately), you could use tilemap definitions + tile images ;)

Yeah I know that, but now that I think of it, using tiles is slower than parsing a whole map, because in addition of the initial operations that applies to a large map you'll have to find, load and apply calculations to pixels of different tiles (things that you don't have to do with a single image). Of course it saves size, but make the program slower. I think I'm better with a single image per map (that doesn't mean I can't change my mind tho, if I optimize my program to go fast enough maybe I'll have both speed and lightness).
Can't you store maps as tilemaps, then, at the beginning of the game, draw the wjole map to a certain buffer and you'll only have to deal with one big image ?
Title: Re: [C] F-Zero : trackSpire
Post by: Lionel Debroux on January 08, 2013, 12:40:41 pm
That's indeed exactly what I'm suggesting :)
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 08, 2013, 12:53:25 pm
Not that I can't do that, but I also want users to be able to create, load and play with their own maps, so hard-coding maps isn't a solution. But for the draw-to-a-buffer thing, I could do that but that takes even more space than a single image map (tilemap + tiles + buffer, instead of only map).
Title: Re: [C] F-Zero : trackSpire
Post by: Lionel Debroux on January 08, 2013, 01:01:12 pm
Quote
I also want users to be able to create, load and play with their own maps, so hard-coding maps isn't a solution.
Hard-coded, but editable, maps in external files ?

Quote
But for the draw-to-a-buffer thing, I could do that but that takes even more space than a single image map (tilemap + tiles + buffer, instead of only map).
Yup, it temporarily raises the peak RAM consumption, so as to permanently reduce the storage consumption.
Title: Re: [C] F-Zero : trackSpire
Post by: lkj on January 08, 2013, 01:41:44 pm
Quote
Quote
But for the draw-to-a-buffer thing, I could do that but that takes even more space than a single image map (tilemap + tiles + buffer, instead of only map).
Yup, it temporarily raises the peak RAM consumption, so as to permanently reduce the storage consumption.
And the little bit more RAM consumption shouldn't be a big issue, having less storage space for files/other games is much worse.
Title: Re: [C] F-Zero : trackSpire
Post by: fb39ca4 on January 08, 2013, 07:02:20 pm
Not that I can't do that, but I also want users to be able to create, load and play with their own maps, so hard-coding maps isn't a solution. But for the draw-to-a-buffer thing, I could do that but that takes even more space than a single image map (tilemap + tiles + buffer, instead of only map).
Are you concerned about file size or RAM usage? The buffer could be dynamically allocated if the former.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 09, 2013, 03:16:51 am
If you go for images and re-use F-Zero maps, was the color you talked about for collision detection the black surrounding roads? Because if it's the case, then you might want to change it from a different black tone than the one in the circle tiles along the road, so no collision detection weirdness such as getting stuck inside those balls occur.
Title: Re: [C] F-Zero : trackSpire
Post by: Alex on January 09, 2013, 07:01:12 am
Good job matref ;-)
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 09, 2013, 12:20:14 pm
In fact I'll go with tilemaps. The whole image can't even be entirely loaded, it's 800K in gif format but 42MB in raw format D:

So I'll recode the display engine. Updates coming soon ;)
Title: Re: [C] F-Zero : trackSpire
Post by: Augs on January 09, 2013, 03:05:19 pm
Is tile mapping when you have an array and you draw textures according to the array?
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 09, 2013, 03:12:22 pm
In fact I'll go with tilemaps. The whole image can't even be entirely loaded, it's 800K in gif format but 42MB in raw format D:

So I'll recode the display engine. Updates coming soon ;)
That sucks, but yeah if you can go with tilemaps hopefully this should make things easier memory-wise in the end (and possibly allow a non-CX version). The only other solution is to only load needed parts of the image at a time but that would be decompressing every frame, which might be slow.

Is tile mapping when you have an array and you draw textures according to the array?
Yep, you have numbers in an array and each number corresponds to a specific tile. Generally the good way to do it is to group all wall tiles together and the floor tiles together, with the event tiles in the middle.
Title: Re: [C] F-Zero : trackSpire
Post by: Augs on January 09, 2013, 04:39:10 pm
Having tiles that are "hit tiles" would mean that every turn would have to be blocky. Unless tiles are very small.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 09, 2013, 04:43:20 pm
It depends. I doubt SNES collision detection was even this complex. If a tile is half floor and half wall (eg if the wall is left of the tile) it is probably treated as a floor tile on the SNES. Othwerwise they most likely use pixel-test detection, since road edges are black and black isn't used anywhere else in F-Zero maps.
Title: Re: [C] F-Zero : trackSpire
Post by: Augs on January 09, 2013, 04:59:41 pm
If a half floor/half wall tile were treated like a floor tile then it would mean that half of the tile is treated incorrectly.
Title: Re: [C] F-Zero : trackSpire
Post by: Nick on January 09, 2013, 05:01:32 pm
If a half floor/half wall tile were treated like a floor tile then it would mean that half of the tile is treated incorrectly.
Wow, that is one clever remark..
The SNES was not a computing wonder, it is normal that things were as minimized as possible, it's that way, or none at all
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 09, 2013, 05:04:41 pm
I'll just go with pixel testing, I want to have a respectable accurance with collisions.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 09, 2013, 05:08:16 pm
Yeah that's what I mean NIck. The SNES processor isn't even as fast as the TI-83+, let alone the 84+. Collision detection checks are even scrapped sometimes to gain speed, such as when Mario jumps backwards in a corner just below ceiling blocks when crouching, which, as a result, can let you go through walls.

And in most RPGs on the NES/SNES, if you see a tree or bush, you can't even walk right next to it sometimes if the tree doesn't take the entire tile size. Add to that the games where you can't walk behind walls such as Final Fantasy IV. Of course on a Nspire he has more processing power for a game like F-Zero but doing collision detection by tile as complex as it should be would be a shitload of work, with about 128+ if/then/else blocks.

What I suggest is pixel-test for walls, but tile collision for dashes, finish line and jumps.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 09, 2013, 05:13:46 pm
Yeah, I think that's the best way to do this because walls can be one or a half of a tile, when the finish line, dashes, jumps and power regenerators are always a full single tile.
Title: Re: [C] F-Zero : trackSpire
Post by: hoffa on January 09, 2013, 05:15:28 pm
I'll just go with pixel testing, I want to have a respectable accurance with collisions.
I'm not sure if that's a good idea, as pixel operations are never (on any platform) very fast; it could give quite a blow to performance. But what do I know, doing mode7 already involves a lot of per-pixel stuff and it doesn't seem to be that slow.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 09, 2013, 05:25:41 pm
To render the scene, my Mode7 engine does
Code: [Select]
setPixel(screen,x,y, getPixel(bitmap, textureX % IMG_W, textureY % IMG_H));... Plus some more calculations 14325 times. I don't think that testing 44*16 additional pixels will change anything to the speed :P (moreover, the Mode7 engine uses floats - I'll optimise it later, and the detection engine will be restricted to ints).
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 09, 2013, 05:33:23 pm
I'll just go with pixel testing, I want to have a respectable accurance with collisions.
I'm not sure if that's a good idea, as pixel operations are never (on any platform) very fast
Except in some cases on the 83+ (in Axe and TI-BASIC). In TI-BASIC there isn't much difference over using matrices, but in Axe if you need accuracy it's the fastest way.
Title: Re: [C] F-Zero : trackSpire
Post by: hoffa on January 09, 2013, 05:43:54 pm
To render the scene, my Mode7 engine does
Code: [Select]
setPixel(screen,x,y, getPixel(bitmap, textureX % IMG_W, textureY % IMG_H));... Plus some more calculations 14325 times. I don't think that testing 44*16 additional pixels will change anything to the speed :P (moreover, the Mode7 engine uses floats - I'll optimise it later, and the detection engine will be restricted to ints).
Alrighty then. In the next nSDL release there'll be optimized versions of get/setpixel functions (as much as they can be optimized) included. You should definitely tell every single one of the floats to fuck off, as IIRC the CPU doesn't even handle floating point operations, so it's all done using integers, meaning slow as hell.

I'll just go with pixel testing, I want to have a respectable accurance with collisions.
I'm not sure if that's a good idea, as pixel operations are never (on any platform) very fast
Except in some cases on the 83+ (in Axe and TI-BASIC). In TI-BASIC there isn't much difference over using matrices, but in Axe if you need accuracy it's the fastest way.
Yes, but when you have a massive 96x64 resolution...  :ninja:
Title: Re: [C] F-Zero : trackSpire
Post by: fb39ca4 on January 09, 2013, 08:30:21 pm
Why not have a separate collision texture? The Nspire has the RAM to do it. With that you could even have multiple types of surfaces, for example normal track, off-track but still traversable regions that slow you down, and speed boosting surfaces.
Title: Re: [C] F-Zero : trackSpire
Post by: tr1p1ea on January 09, 2013, 08:49:47 pm
If you wanted to save space you could still use a 'tilemap' for the collision component of the track. Its never drawn but each component of the track (each 16x16 segment or whatever size you want to use) would correspond to a 'tile' in the tilemap that you can index to see if there is a collision or not.

You could save space even further by storing multiple 'collision tiles' per byte, 2-bits per collision tile would give you 4 possibilities (walkable, medium, slow, collision).

Then again i would still recommend a tilemap for the tracks especially if you have lots of repeating features. Otherwise you are going to be wasting a lot of space.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 13, 2013, 01:19:16 pm
Update !

Thanks to hoffa for his help with the nSDL and the port of SDL_image to Nspire, now I can use the original tracks from the first F-Zero as gif files (so 800KB instead of 42MB !!!) !

(https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT50K7T1tvBJEMAyXN_rrNSpn1KKWHxwXc2e8YMDEeRqJJoydHCRw)

As ever, new screenshot in the first post :) but this time I didn't attached the tns since it's so little progress.

Now I'll work on collision detection, I have enough of going through the walls :P

Also, do you think I should lower the camera a bit or is it ok like it is ?
Title: Re: [C] F-Zero : trackSpire
Post by: ElementCoder on January 13, 2013, 01:26:44 pm
Where's the screenshot? I only see the 3 I've already seen :p? I think the camera is fine like this, maybe a tiny little bit lower.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 13, 2013, 01:33:36 pm
Do you know the time it takes to shoot a 4MB-large screenshot, convert it from avi to gif and then upload it ? :P

Anyway, you can see it now :)
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on January 13, 2013, 02:12:09 pm
I agree with tr1p1ea, tile-based maps would much more efficient (overall size and ease to check collision/recovery area/starting line/etc...).

And if you only want to handle a big image for your mode 7 engine, you can still generate it before starting races.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 14, 2013, 01:55:16 pm
Will you get rid of the huge black area on the left side of the road when the race starts?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on February 02, 2013, 12:02:33 pm
Bump,

Since I've got some free time recently, I dig in this project again : it's not dead, be sure of that, but I'm having a really hard time trying to make the engine work with integers instead of floats. The accuracy is the main problem I think, so I came to the conclusion that I needed somewhat fixed-point calculations routines. Since I'm bad at maths in fact (experience I don't have), I only can search on the web or ask for it. So if someone wants to help me with that ...
Title: Re: [C] F-Zero : trackSpire
Post by: hoffa on February 02, 2013, 12:59:34 pm
I'd actually suggest you use t0xic_kitt3n's mode7 engine that I modified for 8-bit nSDL. It's been optimized to hell, uses tiles and is easily configurable and uses the native rendering resolution. http://ourl.ca/18123/337001 (http://ourl.ca/18123/337001)
Title: Re: [C] F-Zero : trackSpire
Post by: Dapianokid on March 23, 2013, 01:52:30 pm
This looks like old Sonic CD minigames :)
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on March 23, 2013, 04:03:28 pm
Any updates, by the way?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 23, 2013, 04:20:58 pm
It's such a coincidence, I started working on it again today ;D I'm in the process of modifying the code to use with t0xic_kitt3n and hoffa' engine.

I've also discovered the worst part of programming : converting a giant 6800*3600 bitmap to a 1024*512 tilemap manually x.x
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on March 23, 2013, 04:30:19 pm
Pixel by Pixel?? O.O

That must be long >.<. Is it because it screws up when being downsized?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 23, 2013, 04:41:38 pm
In fact, I have a giant bitmap, a set of 256 16*16 tiles which happens to correspond to the bitmap, but not the tilemap itself x.x

To clarify things, I have the tileset, the final image composed by the tiles of the tileset, but not the order the tiles have to be put in to generate the image (and this is what I want, since the engine uses that).
Title: Re: [C] F-Zero : trackSpire
Post by: Dapianokid on March 23, 2013, 06:27:51 pm
I can help, I have LOTS of free time?
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on March 24, 2013, 06:21:39 am
Can't you find those datas online ?

Or you could automatise the conversion, I'm sure I can make a program that scan the image for tiles and generates the datas as you want (something like the inverse of what I've done there : http://ourl.ca/12441/341898 ), it don't looks that hard.

I would just need the map image, the tile list and the output format.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 24, 2013, 06:42:33 am
If you could do that, I'd be awesome :D

What I want is a C 2D array of numbers from 0 to 255, with an horizontal scanline.

I attached what I have. Though, I think that the tiles are 2 times bigger that what they should be :/
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on March 24, 2013, 07:03:24 am
Ok, but I think there's a background image (the city ?) for the paralax effect, so how will you handle this ? Do you want to use a transparent tile right now (if so, which one ?), or include the city in the map image (if so, I'll have to add its tiles in the tileset) ?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 24, 2013, 07:06:21 am
Oh yeah, never mind the city, put a transparency byte which will be 0xff.

And btw, the map and the tiles are a bit different for one thing : all of the black you can see at the outside borders of the map are actually grey on the tileset (they are the tiles of the middle of the tileset).
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on March 24, 2013, 11:12:06 am
Ok here it is : http://www.mirari.fr/yVxE (made using PureBasic (http://www.purebasic.com/french/))

A few things : the tile $ff isn't transparent (it's the wave-thing) so for the background I've used the tile $9a (the blank tile). The converter check if the colors are exactly the same to assume which tile it is, so you may have to modify the tileset later (for other maps) : I've already changed some colors, but not all.

There are two programs : "tiles.exe" reorganize the tileset (easier to use/include) and "map converter.exe" well, it's self-explaining :)

Both works by drag and drop things on it (the unorganized tileset image and the map image).

It just takes a minute or two depending of the size of the map.

The map image you've posted earlier was sized down so I've used this one : http://www.snesmaps.com/maps/F-Zero/F-ZeroMapSelect.html

And I wasn't really sure how you declare a byte field in C (is it possible to make line breaks ?), so you'll see if the output format is what you expected, else I can change it.

By the way, I think you could gain a lot of bytes by using some compression (and then uncompressing the map image on the nspire before races). I can easily add this feature to the program, or even make a map editor when you project will need it.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 24, 2013, 11:18:50 am
I think there's a problem with your "map converter.exe", it keeps saying that I pass no parameters to it ... I tried both D&D and command line, it keeps not working.

Also, the datas should be in this format :
Code: [Select]
uint8 muteCityTileMap[mapHeight][mapWidth] = {
  { first row of tiles },
  { second row },
...
  {last row}
};
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on March 24, 2013, 11:58:10 am
I've changed the format : http://www.mirari.fr/yVxE

What OS are you using ? Windows ?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 24, 2013, 12:01:54 pm
Yeah I'm using Windows, if it wasn't the case I couldn't have ran *.exe files. And it keeps saying "Aucun paramètre spécifié".

Btw, I'm poking you on OmnomIRC since ten minutes .__.
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on March 24, 2013, 12:06:12 pm
Yeah but you could have used wine :P

Anyway, it's weird because it's working here on windows xp... I'm trying to fix that now, but if you want I can make a request form.

At least are the included datas what you wanted ?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 24, 2013, 12:07:02 pm
Oh wait nvm, I was trying to pass 2 parameters, that's why it didn't work <_<

Anyway, seems ok, I'll try to implement it, thanks a lot :)
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on March 24, 2013, 02:25:21 pm
Ok, but I think there's a background image (the city ?) for the paralax effect, so how will you handle this ? Do you want to use a transparent tile right now (if so, which one ?), or include the city in the map image (if so, I'll have to add its tiles in the tileset) ?
Nah that was implemented in the GBA versions of F-Zero. The SNES game had no parralax effect for the city background image.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on March 25, 2013, 01:06:20 pm
If someone wants to help me, I'm in big trouble D: http://ourl.ca/18582
Title: Re: [C] F-Zero : trackSpire
Post by: Augs on June 08, 2013, 03:20:55 pm
Is this project dead?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on June 08, 2013, 05:03:35 pm
It is. I didn't plan to work on it anymore, but who knows.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on June 08, 2013, 11:31:52 pm
Mode 7 definitively seems incredibly hard, because very few projects like such succeeded unless they were by calc84maniac x.x
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 08, 2013, 10:40:21 am
Necro bump,

I finally decided to go in the F-Zero directory, press Ctrl+A then Del. I restarted everything from scratch without replicating many errors I made, including using floats. Now the engine runs incredibly faster than the last version at maximal resolution (1*1), where the previous engine used quartered resolution (2*2). Also, this new version projects variable-size tilemaps instead of bitmaps.

I'll soon post a screenshot.

EDIT : here you go.

(http://mattias.refeyton.fr/espace-ti/F-Zero/rewrite1.gif)

Don't worry, both the quality and speed are not nearly as bad on-calc. You can try it if you want. You'll need F-Zero.tns and textures.tga.tns in the same directory, w/e it is. For now you can't do much : use the clickpad/touchpad to move around. Everything that is black means it's outside the tilemap.
Title: Re: [C] F-Zero : trackSpire
Post by: TheMachine02 on December 08, 2013, 01:07:10 pm
seem pretty good , precision and speed are great  :D
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 08, 2013, 01:20:08 pm
Darn that is pretty good. Glad you revived this as well. :) If you make an F-Zero game, will it use tilemaps like above rather than a very large picture this time and will they be zoomed out 2x like in previous version to stay true to the SNES version?
Title: Re: [C] F-Zero : trackSpire
Post by: Sorunome on December 08, 2013, 01:30:06 pm
This is looking awesome :D
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 08, 2013, 01:42:28 pm
DJ_O well the original SNES game uses a tilemap, not a bitmap :P and I don't think resolution is quartered either - though I may be wrong since I last played it a long time ago.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 08, 2013, 04:49:31 pm
Ok I was asking, since the original F-Zero Trackspire used a bitmap. :P

And I think the resolution was a bit small, since every mode 7 game on the SNES are kinda pixelated.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 21, 2013, 12:57:03 pm
Update !

You can now load and project external maps, that you will have previously generated with the newly-written map editor ;D

I also implemented collision detection !

Click here for 4MB animated gif ! (http://mattias.refeyton.fr/espace-ti/F-Zero/externalLevelsAndMapE.gif) (which is, of course, laggier and uglier than the on-calc version)
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 21, 2013, 01:36:23 pm
Very nice! You should maybe post two screenshots next time, soon, because I lost patience then opened your GIF in VirtualDub to skip the 2 minutes long map editor showcase and see actual gameplay. :P

Also glad that you now use maps, since the game levels will be much smaller. :)

Also one trick to make screenshots smoother is to set nspire_emu to run at 10% speed then using a video editor to speed it back up to 100% while setting the final frame rate to 30 FPS. It results in an ultra massive GIF file, though. :P
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 21, 2013, 02:35:04 pm
Yeah but I wanted to show how you could edit maps :P
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 21, 2013, 02:54:12 pm
Indeed, but http://ourl.ca/6245 :P
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 21, 2013, 03:25:59 pm
That doesn't count, it's a real feature that I just added <_<
Title: Re: [C] F-Zero : trackSpire
Post by: Hayleia on December 21, 2013, 03:57:11 pm
True, but I still agree that the screenshot was very long and repetitive at the beginning. Of course seeing the editor in action is great, but just show 10 seconds of it on an almost finished map then show the movement on it during ten seconds too :)

Nice progress anyway :D
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 21, 2013, 04:02:55 pm
Nah I still think showing the editor is fine. I just mean that it's best to show 2 screenies, one showing only the editor and the other the gameplay. Else, some people might not bother watching more than 30 seconds and miss the entire gameplay sequence, and thus, the project gain less attention. D:
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 21, 2013, 04:04:33 pm
I won't show the editor anymore until I implement custom save - in a while - anyway.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 23, 2013, 09:06:26 am
By the way, if you guys are interested into testing what's available, you can download it here (http://tiplanet.org/forum/archives_voir.php?id=24746) :)
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 23, 2013, 12:38:35 pm
Ok thanks, I'll see if I can update my Ndless copy soon. :)

Btw F-Zero came out in 1990, not 1992. ;)
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 23, 2013, 12:39:50 pm
On TI-Planet I said 90 in Japan and 92 in Europe.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 23, 2013, 12:43:36 pm
Oh ok, yeah it came out earlier in Japan and North America. I was refering to the file description, tho :P

Quote
Programme de démo de F-Zero TrackSpire, clone du F-Zero de 1992 sur SNES pour TI-Nspire ! Au menu, affichage pseudo-3D, courses externes avec éditeur de maps, toussa ! Pour l'instant, l'affichage 3D fonctionne très bien, les collisions avec les murs et l'éditeur de maps aussi, sauf que les deux ne gèrent que des maps 32*24 tiles pour l'instant. Et une seule map, toujours la même, F-Zero.tilemap.tns.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 23, 2013, 12:48:52 pm
Well, I thought that since we (in France) had it in 92, it was legit to say it came out in 92.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 27, 2013, 05:24:33 am
Bumpity bump,

The game now projects 256*192 maps :D don't come and say maps are too small now, that makes 4096 * 3072 pixels (16*16 tiles) in a 48kb file. :P

Since maps are now huge, I added a small popup in the ME to jump to a tile given its XY coordinates.

(http://img.ourl.ca/popupDemo.png)

(I heard your prayers, fixed PNG for today :P)
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 30, 2013, 12:54:23 pm
But but... 8192x8192 maps are better. Just kidding :P, 256x192 is pretty fine IMHO.

By the way, are backgrounds now supported and scrolling around like the original game? Also, when hitting walls, will the floor change color like in the SNES game? Also will Death Wind effects be supported?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 30, 2013, 01:05:06 pm
There is nothing such as backgrounds for now, but they are planned. Tiles translation is something easy enough to implement but I don't think I'll use it (I'll flash the ship when it takes damages instead). I don't know what is Death Wind.

For now I'm working on having a tilemap to test things on :P so if someone wants to create me a real 256*192 map, download all the attached files, put them in the same directory on your Nspire-anything, and run F-ZeroME.tns.

Move the cursor with the (click|touch)pad, place a tile with [enter], go to next/previous tile with [ +]/[-], open the goto popup with [g] and exit with [esc]. The tilemap is automatically saved to F-Zero.tilemap.tns on exit. When you're done, just send me this very file.
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on December 30, 2013, 01:49:47 pm
Death Wind is a race track in the SNES F-Zero. Your car keeps getting pushed in a certain direction due to strong winds, adding to the difficulty.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on December 30, 2013, 01:51:03 pm
Yeah that can be done easily. Not sure if I will include it though, because it wouldn't be fair to not include it as an option in the map editor, and I don't want such options to be accessible.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 10, 2014, 02:34:48 pm
Bumpity bump,

Big bunch of updates ! :D


(http://mattias.refeyton.fr/espace-ti/F-Zero/timerLapsCheckPoints.gif)

Don't worry, it's fast and good-looking on-calc, my PC is just not changing from being shit.
Title: Re: [C] F-Zero : trackSpire
Post by: Sorunome on January 10, 2014, 02:59:45 pm
That is looking pretty awesome O.O
Suggestion, on some turns cars sometimes leave those blacklines behind on the road..... ;)
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 10, 2014, 03:12:25 pm
Yes, but this is a levitating racing ship :P I planned to add the shadow there is on the SNES version, so it'll be more obvious.
Title: Re: [C] F-Zero : trackSpire
Post by: Sorunome on January 10, 2014, 03:33:29 pm
oh, didn't notice that >.</me facehoofs
Title: Re: [C] F-Zero : trackSpire
Post by: Eiyeron on January 16, 2014, 03:17:42 pm
Can the mode7 be taken out from the F-Zero in an independant lib?
Title: Re: [C] F-Zero : trackSpire
Post by: fb39ca4 on January 16, 2014, 03:22:14 pm
I don't believe this game is using it, but I made a mode 7 engine a while ago, and Hoffa added nSDL and color support.
http://ourl.ca/18123;msg=282877
Title: Re: [C] F-Zero : trackSpire
Post by: Eiyeron on January 16, 2014, 03:24:28 pm
No, it' not for me, or more, not for the moment.
Hmmm, what if I redo this background thing here?[/font]
Title: Re: [C] F-Zero : trackSpire
Post by: chickendude on January 16, 2014, 03:28:30 pm
That looks amazing :O
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 16, 2014, 04:13:45 pm
Can the mode7 be taken out from the F-Zero in an independant lib?
Yeah sure, I'm writing the game with that in mind. It also offers 24.8 fixed-points routines and tilemap loading from files.

I don't believe this game is using it, but I made a mode 7 engine a while ago, and Hoffa added nSDL and color support.
http://ourl.ca/18123;msg=282877
The reason why I didn't use it is that it requires fixed-size tilemaps (too small for my needs) and is very rigid. Mine allows for custom width and height and dynamic tilesets and tilemaps.

No, it' not for me, or more, not for the moment.
Hmmm, what if I redo this background thing here?
What background are you talking about ?

That looks amazing :O
Thanks ;D

Also, I added custom starting blocks :) not really worth a screenshot though.

I really need an actual map right now. What I want to do is have the original maps from the SNES version converted using the tilemap editor I wrote, so if anyone wants to give it a try, let me know and I'll post some binaries via PM (when I'll have a PC).
Title: Re: [C] F-Zero : trackSpire
Post by: DJ Omnimaga on January 18, 2014, 12:25:51 am
Looks very nice! Do you plan to use custom fonts like, for example, the original SNES F-Zero fonts?
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 18, 2014, 03:35:49 am
I could add that yes, but not that soon, it's a long boring task :P
Title: Re: [C] F-Zero : trackSpire
Post by: chickendude on January 18, 2014, 04:07:08 am
I wouldn't mind helping convert some maps for you, though i'm on Linux. Unless the 'binaries' are for the nSpire, as i don't have mine with me at the moment.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 18, 2014, 04:26:09 am
Yes, it's Nspire binaries. It's a small  map editor I wrote.
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on January 18, 2014, 05:25:26 am
The converter (http://ourl.ca/18072/342597) I wrote you don't fit your needs, now ?

What's the new format ? I guess I can change it easily.
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 18, 2014, 05:27:30 am
You can't use a program to automatically convert original maps to TrackSpire format, because I use a very limited number of tiles to make coding easier (16 actually, instead of 256 originally). So everything has to be done by hand.
Title: Re: [C] F-Zero : trackSpire
Post by: Hayleia on January 18, 2014, 05:52:20 am
Maybe the converter could include some sort of table that would assign a tile among the 16 ones you support to every 256 original tiles ?
Title: Re: [C] F-Zero : trackSpire
Post by: Keoni29 on January 18, 2014, 05:54:46 am
Can you animate the vehicle's floating animation as well as the afterburners?
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on January 18, 2014, 05:59:00 am
Ok but why adding much more tiles would make it harder to code ? You could just check the tile on which is the player and compare it to a list of "walkable tiles" (or "non-walkable" if they are fewer), and then check if it's a special tile (acceleration, brake, finish line...).
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 18, 2014, 06:08:48 am
Maybe the converter could include some sort of table that would assign a tile among the 16 ones you support to every 256 original tiles ?
Rather the contrary I think :P assign several of the 256 tiles to one if the 16 tiles. And I don't do that because I've never found any real aligned map nor the real tileset.

Can you animate the vehicle's floating animation as well as the afterburners?
Yep, that's planned.

Ok but why adding much more tiles would make it harder to code ? You could just check the tile on which is the player and compare it to a list of "walkable tiles" (or "non-walkable" if they are fewer), and then check if it's a special tile (acceleration, brake, finish line...).

It's mainly because I'm lazy to draw them and that it would be very complicated to make a map on my editor with many many tiles.
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on January 18, 2014, 06:37:43 am
Rather the contrary I think :P assign several of the 256 tiles to one if the 16 tiles. And I don't do that because I've never found any real aligned map nor the real tileset.

I can do that but there will be some things useless after the conversion, for example originally the borders of the tracks are made of 4 tiles... And by the way, the original tileset is already included with the converter and the maps are available here : http://www.snesmaps.com/maps/F-Zero/F-ZeroMapSelect.html .

It's mainly because I'm lazy to draw them and that it would be very complicated to make a map on my editor with many many tiles.

How that "draw them" ? Just use the ripped ones. And for the editor, I guess you can sort the tiles etc...
Title: Re: [C] F-Zero : trackSpire
Post by: Matrefeytontias on January 18, 2014, 06:40:39 am
Rather the contrary I think :P assign several of the 256 tiles to one if the 16 tiles. And I don't do that because I've never found any real aligned map nor the real tileset.

I can do that but there will be some things useless after the conversion, for example originally the borders of the tracks are made of 4 tiles... And by the way, the original tileset is already included with the converter and the maps are available here : http://www.snesmaps.com/maps/F-Zero/F-ZeroMapSelect.html .
I use them, but I meant, they are not perfectly aligned (IIRC their size isn't even a multiple of 8 ).

If you feel like doing a converter, well, please do, it'll help me a lot. The format is just a plain tilemap with no header.
Title: Re: [C] F-Zero : trackSpire
Post by: nikitouzz on January 18, 2014, 06:58:05 am
En faite il y a un truc qui ne va pas dans ton programme c'est l'angle de vu du terrain qui n'est pas assez haut et trop penché !

I can't say this in english sorry !
Title: Re: [C] F-Zero : trackSpire
Post by: Hayleia on January 18, 2014, 06:59:21 am
Maybe the converter could include some sort of table that would assign a tile among the 16 ones you support to every 256 original tiles ?
Rather the contrary I think :P assign several of the 256 tiles to one if the 16 tiles.
Well that's the same as what I said: to each of the 256, you assign one of the 16. I just thought it was more logical that way because you basically needed a LUT but assigning several tiles to one can't be done with a LUT.

And I don't do that because I've never found any real aligned map nor the real tileset.
Ah yeah, that's more of a problem :P.
Title: Re: [C] F-Zero : trackSpire
Post by: deeph on January 18, 2014, 06:59:36 am
They are aligned (http://www.snesmaps.com/maps/F-Zero/F-ZeroMap01MuteCity1.html : 6880*3488).

If you don't plan adding more tiles then I just need your current tileset for the converter.