Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Yeong on February 16, 2012, 09:28:25 pm

Title: ASCII World
Post by: Yeong on February 16, 2012, 09:28:25 pm
First of all, screenshot.

(http://img.removedfromgame.com/imgs/acworld.gif)

I started this because I have to wait for my other calc to be returned and I was bored. :D
This is the pure TI-BASIC rpg game (maybe I might use xcopy later)
So far I made the inn, walking, and bit of status stuff.
Title: Re: ASCII World
Post by: chattahippie on February 16, 2012, 10:42:33 pm
This looks amazing! :D
Honestly, when you talked to the innkeeper, I was expecting that awesome battle scene to appear :P
Title: Re: ASCII World
Post by: Yeong on February 16, 2012, 10:43:37 pm
lol :P
The talking engine will change later to one that looks like the intro scene. :)
Title: Re: ASCII World
Post by: DJ Omnimaga on February 16, 2012, 10:46:56 pm
Seems nice, although the speed seems a bit slow by ASCII standard (the usual walking engine with no moving enemies runs at about 6-8 FPS in ASCII on a 84+ and with stuff moving around 1.5 to 3 FPS. You might need to put the events somewhere out of the main loop and only go through them when an event tile is detected while walking. (kinda like in Illusiat 13)
Title: Re: ASCII World
Post by: chattahippie on February 16, 2012, 10:46:57 pm
Ooh, that would be cool, but I do like how simple it is now
Title: Re: ASCII World
Post by: aeTIos on February 17, 2012, 03:47:24 am
@DJ (http://imgs.xkcd.com/comics/(.png)
Looks nice Yeong
Title: Re: ASCII World
Post by: AngelFish on February 17, 2012, 03:48:29 am
Like DJ mentioned, the tilemapping seems a bit slow. Blakpilar and I played around with tilemappers awhile back and here's what we managed to get.

Spoiler For Spoiler:
Mine: Very fast map refresh (~0.1 seconds) and reasonably memory efficient, but slows down the farther along you go in the map. And yes that is an item collection system I'm showing in there. The refresh is fast enough to actually scroll.
(http://img.removedfromgame.com/imgs/BASICtilemap)

Blakpilar's: insanely fast movement, but very slow to change the map and uses more memory to store the map.
(http://tibasicdev.wikidot.com/local--files/forum:thread/Example.gif)

I can't speak for blak, but I'm willing to help if you want to make it faster :)
Title: Re: ASCII World
Post by: TIfanx1999 on February 17, 2012, 05:18:05 am
Looks nice Yeong. I caught a spelling error, Stelth should be spelled Stealth.
Title: Re: ASCII World
Post by: DJ Omnimaga on February 17, 2012, 09:35:02 am
@DJ (http://imgs.xkcd.com/comics/(.png)
Looks nice Yeong
I always forget to close parenthesizes in english O.O
Title: Re: ASCII World
Post by: Yeong on February 17, 2012, 04:45:19 pm
well, this is what it does during the loop:
-set character temporately
-walking engine(a program that contains displaying sprite and getkey stuff
-collision detection
-event trigger
Title: Re: ASCII World
Post by: DJ Omnimaga on February 17, 2012, 04:52:23 pm
Ok, what I usually do personally for collision detection is make sure in the game there is only one or two tile you can walk on (for example, stairs and blank tiles). Then make sure every event tile is solid. If the character tries to walk on a solid tile, it either exits the entire walking loop or launch a sub-program (preferably the former) to check what kind of tile you just hit. If it's not an event, then it goes back in the walking loop, otherwise it checks what event needs to be launched. In any case, anything involving solid tiles occurs outside the walking loop. That speeds walking up considering, but only as long as you don't have like 5-6 tiles you can walk on. I did something similar in Reuben Quest and Illusiat 13. The only downside is that when you try to walk on a solid tile, there's a small delay before you can move again.
Title: Re: ASCII World
Post by: Yeong on February 17, 2012, 04:57:07 pm
this is how I handle collision detection:
I store 3 chars in Str2 that is walkable and store all map in Str1.
and I check if the tile I move next is walkable or not.
Title: Re: ASCII World
Post by: Spyro543 on February 17, 2012, 07:22:54 pm
@DJ (http://imgs.xkcd.com/comics/(.png)
Looks nice Yeong
I always forget to close parenthesizes in english O.O
Too much TI-BASIC programming? :P
Anyways, I always love seeing new TI-BASIC projects pop up because it is a great language, if you use it correctly.
Title: Re: ASCII World
Post by: DJ Omnimaga on February 17, 2012, 07:45:40 pm
I agree. In the past (and even today sometimes) I noticed that some people quickly judged it only based on the majority of the programs on ticalc.org. X.x

In some cases BASIC programming can almost be an art lol (although I guess it's true in ASM and other languages too)
Title: Re: ASCII World
Post by: Yeong on February 18, 2012, 09:58:32 am

Code: [Select]
::"TOWN CODE
:Lbl T1
:0→∟ADATA(80
:"XXXXXXXXXXXXXXXXX  [OOO]        X [OOOOO]       X  11I11        X  11M11     000X    0       0  X    0       0  X    000000000  →Str1
:" 0M→Str2
:Output(1,1,Str1
:prgmθWALK
:If U=16 and θ=26:Then:1→U:Goto T2:End
:If V=8 and θ=34:Then:1→V:Goto T3:End
:If U=6 and V=5:Then:7→V:8→U:Goto I1:End
:Goto T1

Code: [Select]
::"WALKING ENGINE
:3→Z:prgmθTRT
:Output(V,U,Ans
:DelVar θRepeat θ:getKey→θ:End
:16V-16+U+16(θ=34 and V≠8)-16(θ=25 and V≠1)+(θ=26 and U≠16)-(θ=24 and U≠1→T
:DelVar B
:sub(Str1,T,1
:If Ans=sub(Str2,1,1) or Ans=sub(Str2,2,1) or Ans=sub(Str2,3,1
:Then
:U+(θ=26 and U≠16)-(θ=24 and U≠1→U
:V+(θ=34 and V≠8)-(θ=25 and V≠1→V
:End
:If θ=31:prgmθMENU
:If θ=45:Then:U→∟ADATA(78:V→∟ADATA(79:ClrHome:AxesOn:FnOn :ZStandard:Stop:End

Code: [Select]
::" PART OF PRGM TRT
:If Z=3:Then
:"iθπ
:sub(Ans,∟ADATA(5)+1,1
:End


These are my main loop / walking code.
Can you see any way to make this faster?
Title: Re: ASCII World
Post by: chattahippie on February 18, 2012, 12:29:15 pm
For the
Code: [Select]
U+(θ=26 and U≠16)-(θ=24 and U≠1→U
you can change it to
Code: [Select]
min(16,max(1,U+(θ=26)-(θ=24→U
and likewise for V.

I am not sure if it will go faster, but it is smaller :)
Title: Re: ASCII World
Post by: Yeong on February 18, 2012, 12:30:52 pm
ah. that's a smart way. :D
I'll implement it. Thanks XD
Title: Re: ASCII World
Post by: DJ Omnimaga on February 19, 2012, 02:48:21 am
There doesn't seem to be a bit speed difference, but yeah you save a few bytes.
Title: Re: ASCII World
Post by: jsj795 on February 19, 2012, 04:04:05 am

Code: [Select]
::"TOWN CODE
:Lbl T1
:0→∟ADATA(80
:"XXXXXXXXXXXXXXXXX  [OOO]        X [OOOOO]       X  11I11        X  11M11     000X    0       0  X    0       0  X    000000000  →Str1
:" 0M→Str2
:Output(1,1,Str1
:prgmθWALK
:If U=16 and θ=26:Then:1→U:Goto T2:End
:If V=8 and θ=34:Then:1→V:Goto T3:End
:If U=6 and V=5:Then:7→V:8→U:Goto I1:End
:Goto T1

Code: [Select]
::"WALKING ENGINE
:3→Z:prgmθTRT
:Output(V,U,Ans
:DelVar θRepeat θ:getKey→θ:End
:16V-16+U+16(θ=34 and V≠8)-16(θ=25 and V≠1)+(θ=26 and U≠16)-(θ=24 and U≠1→T
:DelVar B
:sub(Str1,T,1
:If Ans=sub(Str2,1,1) or Ans=sub(Str2,2,1) or Ans=sub(Str2,3,1
:Then
:U+(θ=26 and U≠16)-(θ=24 and U≠1→U
:V+(θ=34 and V≠8)-(θ=25 and V≠1→V
:End
:If θ=31:prgmθMENU
:If θ=45:Then:U→∟ADATA(78:V→∟ADATA(79:ClrHome:AxesOn:FnOn :ZStandard:Stop:End

Code: [Select]
::" PART OF PRGM TRT
:If Z=3:Then
:"iθπ
:sub(Ans,∟ADATA(5)+1,1
:End


These are my main loop / walking code.
Can you see any way to make this faster?


First of all, be careful of the Goto within the If:Then:End block, cuz it might cause the memory leak.
Also, after one key-press, it seems to go through the map initialization again in the main loop although there's no need for it.

Try this:


::"TOWN CODE
:Lbl T1
:DelVar E /This is for the event. You can choose whatever variable/
:0→∟ADATA(80
:"XXXXXXXXXXXXXXXXX  [OOO]        X [OOOOO]       X  11I11        X  11M11     000X    0       0  X    0       0  X    000000000  →Str1
:" 0M→Str2
:Output(1,1,Str1
:prgmθWALK
:If U=16 and θ=26:Then:1→U:Goto T2:End
:If V=8 and θ=34:Then:1→V:Goto T3:End
:If U=6 and V=5:Then:7→V:8→U:Goto I1:End

:If E=1:Goto T2
:If E=2:Goto T3
:If E=3:Goto I1
:Goto T1


::"WALKING ENGINE
:Repeat E or max(θ={31, 45
:3→Z:prgmθTRT
:Output(V,U,Ans
:DelVar θRepeat Ans:getKey→θ:End
:16V-16+U+16(θ=34 and V≠8)-16(θ=25 and V≠1)+(θ=26 and U≠16)-(θ=24 and U≠1→T
:DelVar B
:sub(Str1,T,1
:If Ans=sub(Str2,1,1) or Ans=sub(Str2,2,1) or Ans=sub(Str2,3,1
:Then
:min(16,max(1,U+(θ=26)-(θ=24→U
:min(8,max(1,V+(θ=34)-(θ=25→V
:End
:If U=16 and θ=26:1→E
:If V=8 and θ=34:2→E
:If U=6 and V=5:3→E
:End
:If θ=31:prgmθMENU
:If θ=45:Then:U→∟ADATA(78:V→∟ADATA(79:ClrHome:AxesOn:FnOn :ZStandard:Stop:End

Title: Re: ASCII World
Post by: Yeong on April 05, 2012, 08:46:55 pm
bump. :D

Well, I decided to modify this so it can be fit for TI-Concours.

The moving will be different like Riviera style, but the storyline won't change. :)
Title: Re: ASCII World
Post by: DJ Omnimaga on April 07, 2012, 10:48:13 pm
Good luck and I can't wait to play it :)