Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: JoeyBelgier on November 02, 2009, 08:19:48 am

Title: Basic FPS Wolfenstein
Post by: JoeyBelgier on November 02, 2009, 08:19:48 am
Ehrm so yeah, I just might make a game :P
I mean, I've been here for 4 months now, and I havn't contributed something of my own yet so..
OK, this might take a while ( maybe never gets finished either) c'z this would still be my first full program.
The only thing I have atm is a spash screen, don't get too excited, it's just 2 pictures changing in a loop, and a ClrDraw everytime x.x
But hey, let me nub mah own way  8)

(http://img59.imageshack.us/img59/9591/cstlgifn.gif) (http://img59.imageshack.us/i/cstlgifn.gif/)
actually, It does look a tiny little bit better on a real calc <_<

EDIT; YES I run it from MirageOS, Hell no it ain't asm/hybrid/whutever
just putted ::"Wolfenstein on the first line of code, things just look cooler when you open them from MirageOS  ;D
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 02, 2009, 01:31:58 pm
Looks nice, I can't wait until you have some more stuff, though, such as gameplay screenshot. Will you do it all text or will it be ASCII or graphical?
Title: Re: Basic FPS Wolfenstein
Post by: JoeyBelgier on November 02, 2009, 01:41:45 pm
Well, I'm going to make a First Person Shooter, so all graphical I'm afraid :P
I'm still looking at codes of other games first tho, I don't get a **** of how they use matrices to create maps, neither how they read 'em
I think it'l be a wire-enviroment, with pic-objects.
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 02, 2009, 04:11:09 pm
Ah ok I was not sure yet since before you wanted to make text games, I can't wait to see what you will come up with. Feel free to ask questions if you need help. TI-BASIC Developper or TI-Freakware tutorials can also be useful (altough the later is mostly for 2D games)
Title: Re: Basic FPS Wolfenstein
Post by: JoeyBelgier on November 02, 2009, 04:51:50 pm
yh, there appear to be no tut's on this <_<
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 02, 2009, 08:07:03 pm
Usually, for BASIC fpses, it was nearly essential to use a matrix, altough it was possible to use strings at the huge cost of speed.

Basically, in a basic FPS, you had a variable for the direction you faced, one for your X pos and one for Y pos (another for Z position if your dungeons had multiple floors and ladders). If the direction var equalled 0 for example, the program displayed the appropriate tile for the northern path (a open passage or a wall), one for the western path (either a passage or a wall) and one for east. rotating right would increment the direction var value by 1 (then loops back to 0 if it was equal to 4), or vice versa. When facing east, it displayed the north path to the left of screen, the eastern part in the middle and the southern path to the right. And so on. Eventually I might write a small code for such thing.
Title: Re: Basic FPS Wolfenstein
Post by: jsj795 on November 02, 2009, 08:35:00 pm
Wow... I don't wanna even think about making the pics for them... I am really horrible drawer :D
Especially on calc

I hope to see more progress in this, Necro!
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 02, 2009, 09:03:36 pm
Oh, usually we just use lines to startup. However, some people use pics for walls and doors
Title: Re: Basic FPS Wolfenstein
Post by: mapar007 on November 03, 2009, 02:15:54 am
You could use list as a 3D matrix.

EDIT: or even 2D, what's the issue?
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 03, 2009, 02:55:21 am
Are lists faster to grab data from? (knowing  you would need to do a bit more maths like instead of [A](A,B) you would need to do L1(16A+B-16) or something like that? Plus I think with lists, there would barely be any size difference
Title: Re: Basic FPS Wolfenstein
Post by: JoeyBelgier on November 03, 2009, 06:06:22 am
I'm afraid pictures will be the easy part :p
also level making can't be too hard once the engine is done.

Anywho for today: I have once week of vacation (started this weekend), so today I'm going to use some of that time to learn some mathematics. I'm going to look at the matrices thing later this day.

Q: DJ, you said how it works but, I thought i'd also have to check 2tiles and 3tiles further to the north? no?
Might have misunderstood yr post tho but I dunno x.x
Title: Re: Basic FPS Wolfenstein
Post by: simplethinker on November 03, 2009, 08:53:35 am
Are lists faster to grab data from? (knowing  you would need to do a bit more maths like instead of [A](A,B) you would need to do L1(16A+B-16) or something like that? Plus I think with lists, there would barely be any size difference
I just tested it (16000 reads of a 20x20 matrix/list) and reading from a matrix was 12% faster than from a list.  The matrix was also one byte smaller than the list.
Title: Re: Basic FPS Wolfenstein
Post by: jsj795 on November 03, 2009, 09:56:04 am
It does make sense that matrix is faster... Grabbing a number from the last number of the list will take time searching for it, while matrix will skip the whole rows/columns until it reaches the number...
Title: Re: Basic FPS Wolfenstein
Post by: Builderboy on November 03, 2009, 10:21:30 am
Actualy, since Matrixes and Lists have fixed size, the only difference should be the difference in data type.

 If you make a 999 dimension List and access the very first element, it will take the same amount of time as accessing the 999'th element.  The lengths of each element are fixed, so the data is Random Access. (at least according to my tests) Strings on the other hand, sometimes have 1 byte tokens and sometimes have 2 byte tokens, so the TiOS is forced to search through the entire string for the one you want, which is one of the reasons strings are so slow.

Its interesting why Matrixes would be faster than a list, because in calculator memory, a matrix would be stored exactly the same as a list (calculators don't have 2d memory XD) so there must be some other thing that is giving the speed difference.
Title: Re: Basic FPS Wolfenstein
Post by: jsj795 on November 03, 2009, 03:36:02 pm
Oh... hmmm may be the calculation to get the number from list, like L1(16A+B), and such???
Title: Re: Basic FPS Wolfenstein
Post by: simplethinker on November 03, 2009, 03:43:19 pm
Its interesting why Matrixes would be faster than a list, because in calculator memory, a matrix would be stored exactly the same as a list (calculators don't have 2d memory XD) so there must be some other thing that is giving the speed difference.
You're forgetting the extra overhead of calculating the element's position in the list ;)  [A](A,B) compared to L1(20A+B)

*You are correct about them being stored the same in memory, and since every element is of the same type (and thus same number of bytes per entry) access time is (nearly) identical.
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 04, 2009, 12:11:10 am
For  a few years, I always wondered why many basic programmers suggested people to avoid using matrices for tilemaps and always use lists instead. I never understood why lists were so much better than matrices. I know about being able to name them however you want, but the names just make the code even larger
Title: Re: Basic FPS Wolfenstein
Post by: Builderboy on November 04, 2009, 12:35:07 am
Perhaps because when you store them in programs as raw recalled value they take up less space?  I guess they both have their tradeoffs, but they aren't really that different after all :D
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 04, 2009, 01:12:33 am
Oh, maybe that. Matrices are sure large inside a program compared to a list due to all [ and ] chars
Title: Re: Basic FPS Wolfenstein
Post by: Builderboy on November 04, 2009, 10:20:55 am
indeed.  I remember when I made My original xLib Trapped, I had 25 raw matrices that were 12x8 inside my program.  I think the entire program was 13000 bytes or something XD
Title: Re: Basic FPS Wolfenstein
Post by: jsj795 on November 04, 2009, 10:36:39 am
Hmmmm... considering that... Should I hardcode the maps in list and convert it into matrix???
Or keep the matrix???
Title: Re: Basic FPS Wolfenstein
Post by: simplethinker on November 06, 2009, 12:27:54 pm
Hmmmm... considering that... Should I hardcode the maps in list and convert it into matrix???
Or keep the matrix???
If the tilemaps will contain only integers, you could use this (http://www.omnimaga.org/index.php?action=downloads;sa=view;down=305) </shameless_plug>
Title: Re: Basic FPS Wolfenstein
Post by: jsj795 on November 06, 2009, 02:37:10 pm
I didn't try the program yet, but I did it myself and the change was so~~~ slow..... -_-
Unless your program instantaneously changes str to mat, I think I'm just gonna have to live with hardcoded matrix :'(
Title: Re: Basic FPS Wolfenstein
Post by: simplethinker on November 06, 2009, 08:34:54 pm
Unless your program instantaneously changes str to mat, I think I'm just gonna have to live with hardcoded matrix :'(
Well, it's in Asm and it takes about a quarter second to convert a 2048 byte string into a 32x32 matrix on my 84+SE :)
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 07, 2009, 12:45:37 am
It might be the whole Asm( command issue. Have you guys ever tried ROL3? That should give you an idea of how slow "Asm(" can get when you have many sub-programs and low RAM.
Title: Re: Basic FPS Wolfenstein
Post by: simplethinker on November 07, 2009, 10:12:03 am
It might be the whole Asm( command issue. Have you guys ever tried ROL3? That should give you an idea of how slow "Asm(" can get when you have many sub-programs and low RAM.
I think he was talking about his attempt at doing it in Basic:
Quote from: jsj795
I didn't try the program yet, but I did it myself...
Title: Re: Basic FPS Wolfenstein
Post by: jsj795 on November 07, 2009, 01:19:15 pm
Yeah... I did it with BASIC, because I want my game to be 100% BASIC, except probably XCOPY, because I need to go over the RAM limit :)
Thanks for suggesting anyway~
Title: Re: Basic FPS Wolfenstein
Post by: DJ Omnimaga on November 07, 2009, 01:30:16 pm
aaah ok