jchase1970
Members-
Posts
356 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Gallery
Events
Store
Community Map
Everything posted by jchase1970
-
Two test programs one number array, one string array. they both fill a 24x32 array with a random number and then access the array and fill the screen. 5 CALL CLEAR 10 DIM MAZE(24,32) 20 FOR X=1 TO 32 30 FOR Y=1 TO 24 40 MAZE(Y,X)=INT(RND*50)+33 50 NEXT Y 60 NEXT X 70 FOR X=1 TO 32 80 FOR Y=1 TO 24 90 CALL HCHAR(Y,X,MAZE(Y,X)) 100 NEXT Y 110 NEXT X 5 CALL CLEAR 10 DIM MAZE$(24,32) 20 FOR X=1 TO 32 30 FOR Y=1 TO 24 40 MAZE$(Y,X)=CHR$(INT(RND*50)+33) 50 NEXT Y 60 NEXT X 70 FOR X=1 TO 32 80 FOR Y=1 TO 24 90 CALL HCHAR(Y,X,ASC(MAZE$(Y,X))) 100 NEXT Y 110 NEXT X The Number array is noticeably faster then the string array. Must have something to do with the internal structure of array. Maybe a string array still allocates the same bytes per unit as the number array. Or maybe the string to number conversion affect it this much, but in single strings they don't slow it down. Interesting test anyway.
-
As I mentioned in the other thread (plotting a dungeon), BASIC stores arrays in VDP RAM, so it does not matter if you implement the "array" using DIM or with GCHAR, both are going to cause VRAM access. Using a numeric array will cause more storage (8 bytes per subscript to store the floating point value), and thus reading a minimum of 8-bytes per array subscript, vs. reading back a single byte via GCHAR. However, that single byte that is read from VRAM via GCHAR is still going to held in an 8-byte numeric variable, and BASIC will do internal conversion to integers as necessary based on certain operations. The more I think about it, using strings, or a string array, might turn out to be the fastest way to do the maze storage in stock BASIC or XB. Matthew well I know from experience that string storage is much faster but I never thought about string arrays. The word array always triggered in my mind slow storage from past programs. but I bet a string array would just assign a byte per unit. you know sometimes you get something in you mind that blocks you from seeing other options. I'll test this later.
-
The 1st program compiled using Wilhems Basic Compiler. With out over drive on it makes a maze in about 30 sec. CMAZE.zip
-
Crap game competition: My Pet Glacier
jchase1970 replied to InfernalKeith's topic in TI-99/4A Development
this great, I always want a pet glacier but could never bear the cold weather, now I can stay toasty warm next to my computer and have me pet right besides me! -
Just hype, it's not done yet. Thought I would finish it today but played with maze and my Bocc game. I've had a hard time working on this program. It's been hard to sit down and work at it. Maybe after I work i the morning I can get some finishing stuff done.
-
It works, just wait longer. Run the last 2 side by side in 2 classic99 windows in OD. They should finish about the same time. Sometimes it's slower then other depending on the number of junctions to backtrack on.
-
Well lets go though it Owen, 10 CALL CLEAR :: CALL COLOR(1,2,16):: CALL SCREEN(2) 100 RANDOMIZE 120 CALL CHAR(33,"FFFFFFFFFFFFFFFF") 130 CALL HCHAR(1,1,33,768) Nothing here so far, colors and wall character 140 Y=INT(RND*15)+5 :: X=1 150 LD=2 155 CALL HCHAR(Y,X,32) 156 X=X+1 I cheated abit here and picked a start point only on the left side of the map. The rnd*15+5 is just to hold it in abit from the corners. LD is var for last direction, we are starting on left moving right. 1 up 2 right 3 down 4 left. Draw the entrance tile then move right 1 space for the maze algo to take off. At the end you'll see another to locate the entrance or exits after the map is drawn. This could have been left out here and done later. 160 CALL HCHAR(Y,X,32) 170 U=0 :: R=0 :: D=0 :: L=0 180 IF U+R+D+L=4 THEN 580 This is the start of the algo loop. Draw the tile. Then set up some vars to test for if we are done randomly picking directions. A check to see if all 4 possible directions have been tried or not. During the process it will check a tile in a direction and if it's bad it will mark that direction with a 1 then jump back to 180 check to see if all 4 directions have been tired or not. Once it is happy with a choice it jumps back to 160 and draws it and resets the 4 var. 190 ND=INT(RND*4)+1 200 NX=X :: NY=Y 210 IF (ND=1)*(U=0)THEN NY=NY-1 :: GOTO 260 220 IF (ND=2)*(R=0)THEN NX=NX+1 :: GOTO 330 230 IF (ND=3)*(D=0)THEN NY=NY+1 :: GOTO 400 240 IF (ND=4)*(L=0)THEN NX=NX-1 :: GOTO 470 250 GOTO 190 Picks a random direction to try, I could have made it faster here because it randomly picks until it tries all 4 direction and that means it may try the same directions many times before it tries them all. Would it have made a big difference? maybe since when you watch it you can see it take longer to move sometimes. So how would be the best way to do it? Maybe put all 4 directions in a list and shuffle it? Still alot of extra swapping stuff around, might be saving time just to use it up elsewhere. 260 IF NY<2 THEN 320 270 CALL GCHAR(NY,NX,S):: IF S=32 THEN 320 280 IF NY-1>0 THEN CALL GCHAR(NY-1,NX,S):: IF S=32 THEN 320 290 IF NX+1<33 THEN CALL GCHAR(NY,NX+1,S):: IF S=32 THEN 320 300 IF NX-1>0 THEN CALL GCHAR(NY,NX-1,S):: IF S=32 THEN 320 310 GOTO 540 320 U=1 :: GOTO 180 The first of 4 directional checks. AAAAA AAAAA XAA AAAAA AAAAA ok you see the 2 blank squares, that is you path cutting into the A's. The X is the spot you are checking to see if you can move to. You have to first check that spot and see if it's a wall or not. Then you have to check each other side of it and make sure no paths are next to where you want to go. AAA A AA A XAA AAAAA AAAAA See if a path is touching the spot you want to go you would connect 2 paths by going there. Not a bad thing if that's something you want but it's a different algo and not a normal "perfect" maze algo. hint...works good for dungeons. 540 IF ND=LD THEN X=NX :: Y=NY :: GOTO 160 550 XS$=XS$&CHR$(X):: YS$=YS$&CHR$(Y):: DS$=DS$&CHR$(LD) 560 X=NX :: Y=NY :: LD=ND 570 GOTO 160 If there is a direction change store it. I'm using strings here because strings are the fastest way to store fluctuating lists in basic. And they are fast but limited to bytes. Something I learned when doing WORMWARS was using x$ and y$ to store the worm info was twice as fast as using a 2d array. And the seg$ function is powerful since you can alter the string in anyway you want. TI basic has no functions to alter an array list. ie if you want to remove a list item in the middle and collapse it down, there's no easy way. with a string it is easy with SEG$. 580 IF LEN(XS$)=0 THEN 630 590 X=ASC(SEG$(XS$,LEN(XS$),1)):: XS$=SEG$(XS$,1,LEN(XS$)-1) 600 Y=ASC(SEG$(YS$,LEN(YS$),1)):: YS$=SEG$(YS$,1,LEN(YS$)-1) 610 LD=ASC(SEG$(DS$,LEN(DS$),1)):: DS$=SEG$(DS$,1,LEN(DS$)-1) 620 GOTO 170 If we check all 4 directions we go to the stack and find out last junction. Reset our vars and move forward from there until we can't move again. This is why it's call the Backtracker. We go forward till we can't go again then back up to another place to go a different direction. Line 580 checks to see if we have anything on the stack, if we don't we have backed all the way to the beginning and therefore are done. 630 Y=INT(RND*20)+2 640 CALL GCHAR(Y,31,S) 650 IF S=33 THEN 630 660 CALL HCHAR(Y,32,32) This finds a exit spot. simply look for a edge path and carve out a spot next to it. same thing could be done to make a start point to. As well as alternate endings if you wanted.
-
Here is my take on the Recursive Backtracker algo for mazes. What's different? Well a true RB will remember every maze path square. I only remember when the maze makes a turn in direction. I'm not sure my way is any faster but this way requires less memory stack. This first program uses CALL GCHAR and doesn't store the maze so all math is done by reading the screen for info. Here's a compiled version of the 1st listing CMAZE.zip This program stores all the info in a 2d array but still draws it as it goes along. And lastly, this program computes the maze in memory in an array and then when done draws the map from memory. Now TI Basic causes a person to step back and think because what you might expect to be normal and true is sometimes wrong. One would think reading the screen for info would be the slowest way to do this. But when running this examples you will see just the opposite. In fact it is quite a bit faster. I believe the reason why is this. When we use CALL GCHAR the computer reads 1 byte of VDP memory and stores it in a variable. Now since all variables in basic are floating point you might think this would be a double word operation but it's not, just a single byte. Arrays on the other had are one sizes fits all. So they are all double word for floating point storage and therefore every access is copying 4 bytes of memory. Anyway that is my reasoning for it.
-
Just keep on herding those puns my way. Maybe I can coral them all before the next Crap Game is announced.
-
Great Games INC. is proud to announce their next stunning simulation on the TI-99/4a home computer. Pet Cow Simulator. Yes the after the great success of our launch title, Traffic Light Operator Simulator, we were afraid that it just wasn't possible for future releases to live up to that kind of standards. But not only have we matched Traffic Light Operator Simulator stunning game play we have surpassed it in a new graphical standard that has been unseen in graphical quality on the TI-99/4a in our past games. In Pet Cow Simulator you have the tough responsibility of taking care of your very own cow, a dream for everyones childhood for sure! You have to feed the cow when she's hungry and clean up after the cow too. Sounds like no easy task right? Well we have included multiple play options a easy mode where the game runs in real time beacuse if you have 24hrs to play and the cow sleeps 8 of those hrs, then the remaining 16hrs is alot less stressfull to get the cow feed on time and cleaned up after. But you say you like a challenge! Well have we got that for you. Other options include a fast clock, where we compress 4hrs of real time into just 1 hr. you think feeding the cow every 2 hrs is tough, just wait till you have to feed her every 1/2hr. Ah man can it get anymore exciting? I'm here to tell you it can! Pick the insane fast clock and watch a hr of the cows life fly by in only 60 seconds. That right only 60 seconds. That means you have to feed the cow every 2 minutes. I know you may think this is impossible but after months of training you will be able to keep the fast pace. Other special effects are a true day/night simulation. You interact with the cow during the day and she sleeps during the night. Now after the crushing response from Traffic Light Operator Simulator we have had to upgrade our modems for 180bps to 300bps and added a new line just for downloading, log in to 1-900-PAYS-NOW and have the cost of the game automatically billed to your telephone, normal per minute fee still apply. If you are a new user, our registration process has been streamed line and only takes 15-30 minutes. Then just a quick 1hr download and you're playing with your very own cow! Because of the difficulty in taking care of a cow we are also setting up a tip line. Just TEXT cow to *4242 and you can receive a hint on taking care of your cow. 99cents per text fee added to your cell phone bill for your convenience. Dream of watching your very own cow sleeping sound for 8hrs no more, ORDER NOW!
-
Classic 99 Suggestions.... Make this a thread? :)
jchase1970 replied to unhuman's topic in TI-99/4A Development
Since I am now about to get the ProPlay gamepad out, I'l like to be able to use my usb game pad and map the buttons on it to joyst 2 for The TI. It's would make it better for anyone that wanted to design a game with the 4 button gamepad support. specifically what the pad does is use both joysticks in one pad using joystick 2 return values for the extra buttons on the pad, joyst1 on game pad up -- up down -- down right -- right left -- left button -- A button joyst2 up -- B button right -- C button button -- Start button -
Just found a funny TI bumper sticker...
jchase1970 replied to InfernalKeith's topic in TI-99/4A Development
Just got a scary big box full of controller yesterday, that I need to start converting, ahhhh......... well like I said that's for after Thanksgiving. -
http://www.youtube.com/watch?v=NkwJ-g0iJ6w
-
Just found a funny TI bumper sticker...
jchase1970 replied to InfernalKeith's topic in TI-99/4A Development
Man that so 80's, I use the PROPLAY game pad, the only new game controller designed for the TI in 20 years. -
Just found a funny TI bumper sticker...
jchase1970 replied to InfernalKeith's topic in TI-99/4A Development
They were designed to malfunction, it makes playing games with them more challenging. Really, how easy would TI Invaders be if it shoot a bullet everytime you wanted it to. -
In this case, making a maze or map, Think of the array as nothing more then a piece if graph paper. Or the character spaces on the screen. dim maze(24,32) A maze that fits full screen on the TI 24 tall and 32 wide. Next think of several pieces of graph paper in a book, that's a 3 diminsional array. dim maze(24,32,10) 10 pages, or screens that are set to TI fullscreen size. Now if you pre generate those 10 pages of mazes you are storing 10 pages in memory. so to display page 1 you have this for x=1 to 32 for y=1 to 24 if maze(y,x,1)=1 then call hchar(y,x,33) next y next x the 1 in the maze(y,x,1) point to page 1 then character 33 would be a wall tile the array will be full of walls and floors walls are 1 floors are 0 no need to have a if then for floors Because we only have 2 options draw or not draw, the floor is there by not drawing.
-
My source for my mazes I included in the file is basically the same thing Jamis Buck and is in a hybrid basic format. What he calls SPARSENESS I made a function call DILUTE and that function is used after the maze is made, because that alters a maze, nothing to do with creating it. The actual function to generate the maze could be converted to TI basic really easily. Function generate_map(xsize,ysize,straightness) SizeX = xsize SizeY = ysize Open = 2 NotOpen = 3 AllChecked = SizeX*SizeY LastDirection = Rand(0,3) North = Open South = Open East = Open West = Open TimeUp = False Function is like declaring a SUB in TI, the rest here is just predefining variables. ;make map array fill with walls Dim map(SizeX-1,SizeY-1) For x=0 To SizeX-1 For y=0 To SizeY-1 Map(x,y) = Wall Next Next next is just making an array to hold the maze and setting it to all walls. At the beginning of the file I define wall=4 and flr=5 Repeat Moved = False NumFailedMoves = 0 ChangeDirection = True this is the beginning of the loop to repeat the algorithm need a couple of flags reset. ;check strightness factor ;otherwise random percent chance If Rand(1,100) < straightness Then ChangeDirection = False Dir = LastDirection EndIf here is a check for how straight the maze will be, it's nothing more then pick a random number between 1 and 100 and compare it to the straigthness factor using a IF THEN Repeat ;pick a direction to move at random If ChangeDirection = True Then Dir = Rand(0,3) LastDirection = Dir EndIf ChangeDirection = True Select Dir ;north Case 0 If North = Open Then Moved = True CurrentY = CurrentY - 1 EndIf ;south Case 1 If South = Open Then Moved = True CurrentY = CurrentY + 1 EndIf ;east Case 2 If East = Open Then Moved = True CurrentX = CurrentX + 1 EndIf ;West Case 3 If West = Open Then Moved = True CurrentX = CurrentX - 1 EndIf End Select Until Moved = True SELECT and CASE is the same as ON GOTO here I pick 1 of 4 directions and see if it's ok to move to ECT... The maze is created in a 2d array and when it needs to be shown it as simple as For x=0 To SizeX-1 For y=0 To SizeY-1 If map(x,y) = Wall Then Rect x*10,y*10,10,10,1 Next Next 2 nested FOR NEXT loops reading the array line by line and drawing a box when there is a wall Looking at it now I see several things I can do to make it better, but that is true with all programs. I included the code for you to look at hoping you would see it is just basic without line numbers and easy to fallow along with. You could add line numbers and put in TIBasic commands and this would work on the TI with only minor changes
-
Here's a sub to draw a random horizontal path, I'll leave it to you to make a vertical path one and put it into the program. I did add it to the program and it looks nice except the original path connecting logic needs to be fixed because it can draw lines connecting 2 points from 2 of the 6 set points and therefor can draw a line over where a line is, for ex the top left point can try to connect to the bottom left point but when it plots paths from the bottom left it's doesn't know if a path already exist to the top left point and may choose to make one even if one is already there. 1 CALL CHAR(34,"108004200108A002") 7 Y=INT(RND*24)+1 8 CALL CLEAR 10 CALL HLINE(1,Y,31) 20 GOTO 7 300 sub hline(x,y,l) 301 py=y::px=x rem plot beginning and end 305 call hchar(y,x,34,1)::call hchar(y,x+l,34,1) rem go up or down and plot 307 M=INT(RND*3)::IF M=2 THEN M=0::GOTO 309 308 IF M=0 THEN M=-1 ELSE M=1 REM NOW CHECK FOR IN RANGE 309 IF ABS(PY+M-Y)<INT(L/2) THEN 312 REM IF OUT HIGH THEN LOWER 310 IF PY+M-Y<0 THEN M=1::GOTO 312 311 IF PY+M-Y>0 THEN M=-1 rem check for in INbounds 312 IF PY+M<1 THEN M=1 :: GOTO 314 313 IF PY+M>24 THEN M=-1 314 PY=PY+M rem plot 320 call hchar(py,px,34,1) rem move right 1 330 px=px+1 331 l=l-1 rem plot 332 call hchar(py,px,34,1) rem l>0 ? then move right again 340 if l=1 then 350 341 px=px+1 342 l=l-1 rem plot 343 call hchar(py,px,34,1) 344 if l>1 then 307 rem connect vertically 350 if abs(py-y)=0 then 370 360 if py>y then call vchar(y,px,34,2) else call vchar(py,px,34,2) 370 subend
-
Here is something else I was working on on the PC last year. It's the random world map generator. I tried several ways of making random worlds, this is the fastest I could get to work. It's uses a fractal method. Press the spacebar to make another map and esc to exit. I wanted to make a fully randomly generated world, I have tables made to generate hobbles,villages,towns,cites, random dungeons. All kinds of stuff, but it all became way to much for a one man team to do. fract landscape.zip
-
I'm not sure how the original Rouge was but I think I read somewhere it was a one way trip down. I do know that not every game of Rouge is winnable. Everything is randomly generated, that includes weapons,potions,monsters, so the game can spawn high level monsters to soon and you can't kill them, you may never find the right potions or weapons or armor you need to beat the dragon at the end. But that was the appealing thing about it. Not if you beat it but how far into the dungeon you could get.
-
Rouge is a test to reach the bottom of a 100 level dungeon. The PC version was in 80 column mode and I believe it stored the whole map per each level as it created it in memory. But again I'm not sure how to do this on the TI with only 16k to work with. I'm just rattling some stuff off here as I work though some of the math... method 1 Simplest way to store map as an array of bytes after it is created but way to much memory usage. 80x23 map size 1840 bytes per level. 184k per the 100 levels. of course the ti screen would be 32x23 or 736 bytes, but still huge for 100 levels method 2 store room info location x,y 2 bytes size x,y 2 bytes has it been revealed 1 byte 5 bytes per room time 9 possible rooms 45 bytes Hallways ?????? each hallway section has 3 bytes x,y, has it been revealed? if limit total hallway segments to 256/3 or 85 then you could use 1 string of 256 bytes to store the info. 85 total hallways segments is doable on the smaller TI screen. so total memory needed per level is 256+45, 301 bytes per level So that is one way. If TI had Bit variables you could store the 'has it been revealed' flag in a single bit. which would save around 50 bytes per level. So I'm still not sure how to go about this. Of course the easiest way would be a one way dungeon where you can't go back to levels you already were on. But that wouldn't be Rouge as in Rouge you need to go back levels to go to shops and increase XP by fighting the randomly generated monsters again. But this would be a option so you wouldn't have to store the levels.
-
Original Rogue maps are very much like what I gave you for the TI. Rouge maps are a map of 9 possible rooms always in the same 9 spots. As mine used only 6 possible rooms. In Rogue they generate the map for the level when you enter the level. Then as you move around you explore it and discover the map. I was working on a TI-Rouge but never finished the map structure on it. It's still on the back burner of something I want to do. My problem I had was finding a good way to store the info per level of what was explored and visible. It easy to pop the rooms onto a stack and store a flag if it has been explored yet or not, but I never came up with a good method for the hallways since each step into a hallway reveals just 1 more step.
-
I didn't have to draw the start path 1st because of how I designed it, see post above. Since I know my 6 intersections that all need to be connected and with it know those points I know where I can come into or exit from the maze. It's kinda like the one I made on the pc except it scans the map array for a floor spot and then builds a room for it. This way is faster for the TI since I don't scan for anything, I know my possible places. But it fallows that method in building a room on a path rather then linking rooms with paths. Also, Your welcome, It was fun to come up with it glad you asked. John
-
Here's how I went about it, I picked 6 spots for rooms to appear around. That gave me 10 paths to those 6 possible rooms which are also the path intersections. I then randomly picked paths for each intersection to connect to another intersection. remembering if they link to intersection 1 or not. I then gave each room a random possibility of 50% to be there or not. so you may have no rooms or you may have 6 rooms or anything in between. The math for room placements randomly offsets the room location 0 to +-2 places. This lets the rooms be out of alignment and look less like they are tied to the 6 locations. The last thing was to pick exit locations. A few easy changes can do alot, you can make it like maze man and generate a series of mazes but storing the random seed value for each maze. Then knowing how you want these to connect you can have it not randomly put the start and exit paths in but use a calculation to have them in a linking pattern. Like wise it would be easy to add random stairs at the intersections for linking levels in a 3d fashion. These stairs would have to be stored somehow so a matching stairs is on the maze it leads to. An array would be the easiest thing to do this with. I had a few errors so be sure and use the bug fixes in the second post. I Ran it with the fixes and it looks almost right. I had 1 dungeon pop up with the far right 2 intersections not accessible, I think I know why, but not to worried about it now. Think I'm going to go get some sleep
-
paste these lines in to not see the maze make but to just have it pop up. 20 call char(34,"8888FF222222FF88") 240 call char(34,"108004200108A002") 245 for l=1 to 400::next l 250 goto 20 here also is my development pad with the comments to help understand it bug fix 6 dim room(6) 70 for i=1 to 6::room(i)=0::next i 80 if e=1 or e=3 then call hchar(7,16,34,12)::if room(2)=1 then room(3)=1 86 if e=1 or e=4 or e=5 then call hchar(18,6,34,12)::if room(4)=1 then room(5)=1
