Gip-Gip Posted July 24, 2014 Author Share Posted July 24, 2014 Perhaps because it's spelled "pixel". Maybe not.. Nah it was a typo. Anyways came up with a game mechanic(for the demo) where you go through mazes(which are in random order) and try to avoid a entity that is going after you. Of course the source code will be released(with the tools used to make it) so you can make your own game, since the game I am making is only a tech-demo. Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted July 25, 2014 Author Share Posted July 25, 2014 (edited) If you have any better ideas for the engine, please post them!Current code(just what I have come up with so far) (I plan on doing this every weekday night, for improvement reasons) set romsize 16kSC set kernel DPC+ set kernel_options no_blank_lines set smartbranching on ; variables are given values here a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 60 : h = 60 : i = 60 j = 60 : k = 60 : l = 60 : m = 60 : n = 60 : o = 60 : p = 60 : q = 60 : r = 60 s = 60 : t = 60 : u = 60 : v = 60 : w = 0 : x = 0 : y = 0 : z = 0 COLUBK = $04 ; variables are defined here: dim playerRot = a dim castTime = b dim castRot = c dim gameState = d dim monsterFound = e dim monsterScale = f dim wallScale1 = g dim wallScale2 = h dim wallScale3 = i dim wallScale4 = j dim wallScale5 = k dim wallScale6 = l dim wallScale7 = m goto missilecast bank2 missilecast ; the raycast(or missilecast) if !gameState then goto gamemaps goto cast1d cast1 castTime = castTime + 1 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 3 then missile0x = missile0x - 1 if collision(missile0, playfield) || castTime > 50 then wallScale1 = wallScale1 - castTime if collision(missile0, playfield) || castTime > 50 then castTime = 0 if collision(missile0, playfield) || castTime > 50 then missile0x = player0x if collision(missile0, playfield) || castTime > 50 then missile0y = player0y if collision(missile0, playfield) || castTime > 50 then goto cast2 goto cast1 cast2 castTime = castTime + 1 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 0 then missile0x = missile0x - 1 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 1 then missile0y = missile0y - 1 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 2 then missile0x = missile0x + 1 if playerRot = 3 then missile0x = missile0x - 1 if playerRot = 3 then missile0y = missile0y + 1 if collision(missile0, playfield) || castTime > 50 then wallScale2 = wallScale2 - castTime if collision(missile0, playfield) || castTime > 50 then castTime = 0 if collision(missile0, playfield) || castTime > 50 then missile0x = player0x if collision(missile0, playfield) || castTime > 50 then missile0y = player0y if collision(missile0, playfield) || castTime > 50 then goto cast3 goto cast2 cast3 castTime = castTime + 1 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 0 then missile0x = missile0x - 2 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 1 then missile0y = missile0y - 2 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 2 then missile0x = missile0x + 2 if playerRot = 3 then missile0x = missile0x - 1 if playerRot = 3 then missile0y = missile0y + 2 if collision(missile0, playfield) || castTime > 50 then wallScale3 = wallScale3 - castTime if collision(missile0, playfield) || castTime > 50 then castTime = 0 if collision(missile0, playfield) || castTime > 50 then missile0x = player0x if collision(missile0, playfield) || castTime > 50 then missile0y = player0y if collision(missile0, playfield) || castTime > 50 then goto cast4 goto cast3 cast4 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 0 then missile0x = missile0x - 3 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 1 then missile0y = missile0y - 3 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 2 then missile0x = missile0x + 3 if playerRot = 3 then missile0x = missile0x - 1 if playerRot = 3 then missile0y = missile0y + 3 if collision(missile0, playfield) || castTime > 50 then wallScale4 = wallScale4 - castTime if collision(missile0, playfield) || castTime > 50 then castTime = 0 if collision(missile0, playfield) || castTime > 50 then missile0x = player0x if collision(missile0, playfield) || castTime > 50 then missile0y = player0y if collision(missile0, playfield) || castTime > 50 then goto cast4 goto cast5 bank3 render bank4 gamemaps gameState = (rand&1) + 1 if gameState = 1 then goto map1 if gameState = 2 then goto map2 map1 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X............XXXXXX............X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end player0: %11 %11 end player1: %11 %11 end COLUPF = $AF player0x = 20 player0y = 50 missile0x = player0x missile0y = player0y missile1x = player0x missile1y = player0y goto missilecast map2 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..XX..........XX..............X X..............................X X............XXXXXX............X X............XXXXXX............X X..............................X X..............XX..............X X..........................XX..X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end player0: %11 %11 end player1: %11 %11 end COLUPF = $34 player0x = 20 player0y = 50 missile0x = player0x missile0y = player0y missile1x = player0x missile1y = player0y goto missilecast Edited July 25, 2014 by Gip-Gip Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted July 25, 2014 Share Posted July 25, 2014 You're seriously still using the TIA collision registers to draw the 3D maze? Instead of just scanning the maze data directly? That's insane. That's the sort of idea you usually only see in obfuscated code contests. Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted July 26, 2014 Author Share Posted July 26, 2014 You're seriously still using the TIA collision registers to draw the 3D maze? Instead of just scanning the maze data directly? That's insane. That's the sort of idea you usually only see in obfuscated code contests. The only good reason I can come up with is that it helps save variables. But if you find a better way, please post a solution or start your own project(not meant to sound in a harsh way), because this is the best solution I could come up with that works with the limited ram. Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted July 26, 2014 Share Posted July 26, 2014 Why would you need to save variables? Walking the maze array would only require temp variables, and bB provides several of those. Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted July 26, 2014 Author Share Posted July 26, 2014 (edited) The 32x11 playfield is stored in 44 variables. If making an 8x8 map with individual variables that would take up(at the least) 64 variables, for less than a fourth of the size. Also, there are only 7 temporary variables, so that would be quite difficult to pull off. Edited July 26, 2014 by Gip-Gip Quote Link to comment Share on other sites More sharing options...
Kiwi Posted July 27, 2014 Share Posted July 27, 2014 If the table is constant state, can the table stay on ROM and you can use that as buffer and have more variables available for the raycaster.engine? Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted July 27, 2014 Share Posted July 27, 2014 I said walking the array, not storing the results. That's a fixed overhead, no matter what your playfield data generation algorithm, so I don't know why you're bringing it up. But since you brought it up, a first-person maze display would be an ideal case for a custom display kernel, since the display is vertically mirrored. But that's probably beyond the scope of this exercise. Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted July 31, 2014 Author Share Posted July 31, 2014 Sorry I haven't been posting things lately, just have been working on another project. I will try to get something out next week, but no guarantees. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted July 31, 2014 Share Posted July 31, 2014 You can dim the playfield vars as a one dimensional array I just noticed you got pixelated. Is it an actual screen capture? If yes, is it from a 2600 or 7800? Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted July 31, 2014 Share Posted July 31, 2014 I just noticed you got pixelated. Is it an actual screen capture? If yes, is it from a 2600 or 7800? theloon.png It's a 2600 ROM. I could make it NES too theloonnes.zip 1 Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted August 11, 2014 Author Share Posted August 11, 2014 Really disappointed in my progress lately, since I have been working on a different project and barely focusing on this. But, it is not canceled or anything, just in UNBELIEVABLY slow active development. I am going to post the code, but it has barely changed since the last one. set romsize 16kSC set kernel DPC+ set kernel_options no_blank_lines set smartbranching on ; variables are given values here a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 60 : h = 60 : i = 60 j = 60 : k = 60 : l = 60 : m = 60 : n = 60 : o = 60 : p = 60 : q = 60 : r = 60 s = 60 : t = 60 : u = 60 : v = 60 : w = 0 : x = 0 : y = 0 : z = 0 COLUBK = $04 ; variables are defined here: dim playerRot = a dim castTime = b dim castRot = c dim gameState = d dim monsterFound = e dim monsterScale = f dim wallScale1 = g dim wallScale2 = h dim wallScale3 = i dim wallScale4 = j dim wallScale5 = k dim wallScale6 = l dim wallScale7 = m dim wallScale8 = n dim wallScale9 = o dim wallScale10 = p dim wallScale11 = q dim wallScale12 = r dim wallScale13 = s dim wallScale14 = t dim wallScale15 = u dim wallScale16 = v goto missilecast bank2 missilecast ; the raycast(or missilecast) stage if !gameState then goto gamemaps goto cast1 cast1 castTime = castTime + 1 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 3 then missile0x = missile0x - 1 if collision(missile0, playfield) || castTime > 50 then wallScale1 = wallScale1 - castTime if wallScale1 != 60 then castTime = 0 if wallScale1 != 60 then missile0x = player0x if wallScale1 != 60 then missile0y = player0y if wallScale1 != 60 then goto cast2 goto cast1 cast2 castTime = castTime + 1 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 0 then missile0x = missile0x - 1 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 1 then missile0y = missile0y - 1 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 2 then missile0x = missile0x + 1 if playerRot = 3 then missile0x = missile0x - 1 if playerRot = 3 then missile0y = missile0y + 1 if collision(missile0, playfield) || castTime > 50 then wallScale2 = wallScale2 - castTime if wallScale2 != 60 then castTime = 0 if wallScale2 != 60 then missile0x = player0x if wallScale2 != 60 then missile0y = player0y if wallScale2 != 60 then goto cast3 goto cast2 cast3 castTime = castTime + 1 if playerRot = 0 then missile0y = missile0y - 1 if playerRot = 0 then missile0x = missile0x - 2 if playerRot = 1 then missile0x = missile0x + 1 if playerRot = 1 then missile0y = missile0y - 2 if playerRot = 2 then missile0y = missile0y + 1 if playerRot = 2 then missile0x = missile0x + 2 if playerRot = 3 then missile0x = missile0x - 1 if playerRot = 3 then missile0y = missile0y + 2 if collision(missile0, playfield) || castTime > 50 then wallScale3 = wallScale3 - castTime if wallScale3 != 60 then castTime = 0 if wallScale3 != 60 then missile0x = player0x if wallScale3 != 60 then missile0y = player0y if wallScale3 != 60 then goto cast4 goto cast3 bank3 render bank4 gamemaps gameState = (rand&1) + 1 if gameState = 1 then goto map1 if gameState = 2 then goto map2 map1 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X............XXXXXX............X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end player0: %11 %11 end player1: %11 %11 end COLUPF = $AF player0x = 20 player0y = 50 missile0x = player0x missile0y = player0y missile1x = player0x missile1y = player0y goto missilecast map2 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..XX..........XX..............X X..............................X X............XXXXXX............X X............XXXXXX............X X..............................X X..............XX..............X X..........................XX..X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end player0: %11 %11 end player1: %11 %11 end COLUPF = $34 player0x = 20 player0y = 50 missile0x = player0x missile0y = player0y missile1x = player0x missile1y = player0y goto missilecast Feel free to work on your own projects! Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 4, 2014 Author Share Posted September 4, 2014 Good news! Now that I have gotten most of the other stuff out of the way, I can focus (almost)full time on the raycaster! Bad news! My compiler is acting awkwardly Just stuff! I am bummed by the amount of activity of this thread. Seriously, you guys really could be doing a lot more other than looking at profile pictures and complaining about my terrible programming skills. Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 6, 2014 Author Share Posted September 6, 2014 compiler is broken again... have to rewrite all the code... Quote Link to comment Share on other sites More sharing options...
bogax Posted September 7, 2014 Share Posted September 7, 2014 Here's what i have done so far: set romsize 32kSC set kernel_options no_blank_lines vars player0x = 50 player0y = 44 a = 1 rem cast number b = 0 rem missile distance c = 0 rem player direction missile0x = player0x missile0y = player0y goto missilecast wallfound if a = 1 && b > 0 && b < 10 then var0 = d if a = 1 && b > 9 && b < 20 then var0 = e if a = 1 && b > 19 && b < 30 then var0 = f if a = 1 && b > 29 && b < 40 then var0 = g if a = 1 && b > 39 && b < 50 then var0 = h if a = 1 && b = 50 then var0 = i if a = 2 && b > 0 && b < 10 then var1 = d if a = 2 && b > 9 && b < 20 then var1 = e if a = 2 && b > 19 && b < 30 then var1 = f if a = 2 && b > 29 && b < 40 then var1 = g if a = 2 && b > 39 && b < 50 then var1 = h if a = 2 && b = 50 then var1 = i if a = 3 && b > 0 && b < 10 then var2 = d if a = 3 && b > 9 && b < 20 then var2 = e if a = 3 && b > 19 && b < 30 then var2 = f if a = 3 && b > 29 && b < 40 then var2 = g if a = 3 && b > 39 && b < 50 then var2 = h if a = 3 && b = 50 then var2 = i if a = 4 && b > 0 && b < 10 then var3 = d if a = 4 && b > 9 && b < 20 then var3 = e if a = 4 && b > 19 && b < 30 then var3 = f if a = 4 && b > 29 && b < 40 then var3 = g if a = 4 && b > 39 && b < 50 then var3 = h if a = 4 && b = 50 then var3 = i if a = 5 && b > 0 && b < 10 then var4 = d if a = 5 && b > 9 && b < 20 then var4 = e if a = 5 && b > 19 && b < 30 then var4 = f if a = 5 && b > 29 && b < 40 then var4 = g if a = 5 && b > 39 && b < 50 then var4 = h if a = 5 && b = 50 then var4 = i if a = 6 && b > 0 && b < 10 then var5 = d if a = 6 && b > 9 && b < 20 then var5 = e if a = 6 && b > 19 && b < 30 then var5 = f if a = 6 && b > 29 && b < 40 then var5 = g if a = 6 && b > 39 && b < 50 then var5 = h if a = 6 && b = 50 then var5 = i if a = 7 && b > 0 && b < 10 then var6 = d if a = 7 && b > 9 && b < 20 then var6 = e if a = 7 && b > 19 && b < 30 then var6 = f if a = 7 && b > 29 && b < 40 then var6 = g if a = 7 && b > 39 && b < 50 then var6 = h if a = 7 && b = 50 then var6 = i if a = 8 && b > 0 && b < 10 then var7 = d if a = 8 && b > 9 && b < 20 then var7 = e if a = 8 && b > 19 && b < 30 then var7 = f if a = 8 && b > 29 && b < 40 then var7 = g if a = 8 && b > 39 && b < 50 then var7 = h if a = 8 && b = 50 then var7 = i if a = 9 && b > 0 && b < 10 then var8 = d if a = 9 && b > 9 && b < 20 then var8 = e if a = 9 && b > 19 && b < 30 then var8 = f if a = 9 && b > 29 && b < 40 then var8 = g if a = 9 && b > 39 && b < 50 then var8 = h if a = 9 && b = 50 then var8 = i if a = 10 && b > 0 && b < 10 then var9 = d if a = 10 && b > 9 && b < 20 then var9 = e if a = 10 && b > 19 && b < 30 then var9 = f if a = 10 && b > 29 && b < 40 then var9 = g if a = 10 && b > 39 && b < 50 then var9 = h if a = 10 && b = 50 then var9 = i if a = 11 && b > 0 && b < 10 then var10 = d if a = 11 && b > 9 && b < 20 then var10 = e if a = 11 && b > 19 && b < 30 then var10 = f if a = 11 && b > 29 && b < 40 then var10 = g if a = 11 && b > 39 && b < 50 then var10 = h if a = 11 && b = 50 then var10 = i if a = 12 && b > 0 && b < 10 then var11 = d if a = 12 && b > 9 && b < 20 then var11 = e if a = 12 && b > 19 && b < 30 then var11 = f if a = 12 && b > 29 && b < 40 then var11 = g if a = 12 && b > 39 && b < 50 then var11 = h if a = 12 && b = 50 then var11 = i if a = 13 && b > 0 && b < 10 then var12 = d if a = 13 && b > 9 && b < 20 then var12 = e if a = 13 && b > 19 && b < 30 then var12 = f if a = 13 && b > 29 && b < 40 then var12 = g if a = 13 && b > 39 && b < 50 then var12 = h if a = 13 && b = 50 then var12 = i if a = 14 && b > 0 && b < 10 then var13 = d if a = 14 && b > 9 && b < 20 then var13 = e if a = 14 && b > 19 && b < 30 then var13 = f if a = 14 && b > 29 && b < 40 then var13 = g if a = 14 && b > 39 && b < 50 then var13 = h if a = 14 && b = 50 then var13 = i if a = 15 && b > 0 && b < 10 then var14 = d if a = 15 && b > 9 && b < 20 then var14 = e if a = 15 && b > 19 && b < 30 then var14 = f if a = 15 && b > 29 && b < 40 then var14 = g if a = 15 && b > 39 && b < 50 then var14 = h if a = 15 && b = 50 then var14 = i if a = 16 && b > 0 && b < 10 then var15 = d if a = 16 && b > 9 && b < 20 then var15 = e if a = 16 && b > 19 && b < 30 then var15 = f if a = 16 && b > 29 && b < 40 then var15 = g if a = 16 && b > 39 && b < 50 then var15 = h if a = 16 && b = 50 then var15 = i b = 0 missile0x = player0x missile0y = player0y goto missilecast castType1 if c = 1 then missile0x = missile0x = 0 rem if facing north if c = 1 then missile0y = missile0y - 1 if c = 2 then missile0x = missile0x + 1 rem if facing east if c = 2 then missile0y = missile0y = 0 if c = 3 then missile0x = missile0x = 0 rem if facing south if c = 3 then missile0y = missile0y + 1 if c = 4 then missile0x = missile0x - 1 rem if facing west if c = 4 then missile0y = missile0y = 0 goto missilecast castType2 if c = 1 then missile0x = missile0x - z rem if facing north if c = 1 then missile0y = missile0y - 1 if c = 2 then missile0x = missile0x + 1 rem if facing east if c = 2 then missile0y = missile0y - z if c = 3 then missile0x = missile0x + z rem if facing south if c = 3 then missile0y = missile0y + 1 if c = 4 then missile0x = missile0x - 1 rem if facing west if c = 4 then missile0y = missile0y + z goto missilecast missilecast playfield: rem the level XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end b = b + 1 z = a if z = 9 then z = -1 if z = 10 then z = -2 if z = 11 then z = -3 if z = 12 then z = -4 if z = 13 then z = -5 if z = 14 then z = -6 if z = 15 then z = -7 if z = 16 then z = -8 if a = 1 then goto castType1 if a > 1 then goto castType2 if collision(missile0, playfield) || b = 50 then goto wallfound if a > 16 then goto render goto missilecast variables d-i are wall heights and i have yet to define them variables var0-15 are used in the rendered playfield Please correct me on any mistakes i may have made! I rewrote your code to get rid of some of the cruft. set romsize 32kSC set kernel_options no_blank_lines vars player0x = 50 player0y = 44 rem a = cast number rem making a 0 based simplifies things slightly rem b = missile distance rem c = player direction rem putting assignemts to the same value continguously rem on the same line is faster and uses less ROM a = 0 : b = 0 : c = 0 missile0x = player0x missile0y = player0y goto missilecast wallfound dim b_ = temp1 rem b/10 by table look up rem the table only has entries for b = 0..50 rem I'd either use a multiple of a power of 2 rem or use some asm to divide by 10 b_ = div10[b] rem the cast number is now 0..15 rem 0 based is slightly simpler if you're rem not using 0 as a flag ie something like rem if !a then skip_all_that var0[a]=d[b_] b = 0 missile0x = player0x missile0y = player0y missilecast playfield: rem the level XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end b = b + 1 if 7 < a && a < 16 then z = 7 - a dim c_ = temp1 if a then c_ = c | 4 rem it depends on exactly what you're doing rem but on goto or on gosub are generally rem faster and less code if you've got more than rem 4 or 5 if clauses rem could be on goto if speed is more rem important than space on c_ gosub c00 c01 c02 c03 c10 c11 c12 c13 goto misslecast skip if collision(missile0, playfield) || b = 50 then goto wallfound rem at least in this bit you never get here unless rem a = 0 and a never gets set to 0 (?) rem ie making case number 0 based may mess this up rem you never get here unless a = 0 so you never goto render if a > 16 then goto render goto missilecast c00 missile0x = missile0x = 0 rem if facing north missile0y = missile0y - 1 return c01 missile0x + 1 rem if facing east missile0y = 0 return c02 missile0x = 0 rem if facing south missile0y + 1 return return c03 missile0x = missile0x - 1 rem if facing west missile0y = missile0y = 0 return c10 missile0x - z rem if facing north missile0y = missile0y - 1 return c11 missile0x = missile0x + 1 rem if facing east missile0y = missile0y - z return c12 missile0x = missile0x + z rem if facing south missile0y = missile0y + 1 return c13 missile0x = missile0x - 1 rem if facing west missile0y = missile0y + z return data div10 0,0,0,0,0,0,0,0,0,0 1,1,1,1,1,1,1,1,1,1 2,2,2,2,2,2,2,2,2,2 3,3,3,3,3,3,3,3,3,3 4,4,4,4,4,4,4,4,4,4 5 end 1 Quote Link to comment Share on other sites More sharing options...
iesposta Posted September 7, 2014 Share Posted September 7, 2014 Some problems. Does not compute: missile0x = missile0x = 0 missile0y + 1 There's no drawscreen command. The lines don't compile for me with the rem statements on the end. In bogax's example missilecast is misspelled. Colors aren't set: COLUPF COLUP0 Players are not defined. Heights are not defined. 1 Quote Link to comment Share on other sites More sharing options...
bogax Posted September 7, 2014 Share Posted September 7, 2014 Some problems. Does not compute: missile0x = missile0x = 0 missile0y + 1 There's no drawscreen command. The lines don't compile for me with the rem statements on the end. In bogax's example missilecast is misspelled. Colors aren't set: COLUPF COLUP0 Players are not defined. Heights are not defined. I don't think that particular bit of code was ever supposed to be compiled, at least that's the way I treated it It's just an example/illustration 1 Quote Link to comment Share on other sites More sharing options...
iesposta Posted September 7, 2014 Share Posted September 7, 2014 I don't think that particular bit of code was ever supposed to be compiled, at least that's the way I treated it It's just an example/illustration No problem. Gip-Gip said to point out any errors, and those error out. 1 Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 9, 2014 Author Share Posted September 9, 2014 Thank you for pointing those things out. While those things are true, they are nowere near being compleated. Also I have had many problems with the compiler and IDE which means I have not been able to debug it. I will most likely completely rewrite the program once I get everything back up and running to see if I can make anything more efficient. Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 9, 2014 Author Share Posted September 9, 2014 Also, bogax, thank you for taking the time to edit it! Quote Link to comment Share on other sites More sharing options...
bogax Posted September 9, 2014 Share Posted September 9, 2014 I goofed some cut and paste so here's a revised version. This will compile but of course that doesn't mean it makes any more sense For the weird assignments that iesposta pointed out I just changed the = to + like so missile0x = missile0x + 0 set romsize 32kSC set kernel_options no_blank_lines vars player0x = 50 player0y = 44 rem a = cast number rem making a 0 based simplifies things slightly rem b = missile distance rem c = player direction rem putting assignemts to the same value continguously rem on the same line is faster and uses less ROM a = 0 : b = 0 : c = 0 missile0x = player0x missile0y = player0y goto missilecast wallfound dim b_ = temp1 rem b/10 by table look up rem the table only has entries for b = 0..50 rem I'd either use a multiple of a power of 2 rem or use some asm to divide by 10 b_ = div10[b] rem the cast number is now 0..15 rem 0 based is slightly simpler if you're rem not using 0 as a flag ie something like rem if !a then skip_all_that var0[a]=d[b_] b = 0 missile0x = player0x missile0y = player0y missilecast playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end b = b + 1 if 7 < a && a < 16 then z = 7 - a dim c_ = temp1 if a then c_ = c | 4 rem it depends on exactly what you're doing rem but on goto or on gosub are generally rem faster and less code if you've got more than rem 4 or 5 if clauses rem could be on goto if speed is more rem important than space on c_ gosub c00 c01 c02 c03 c10 c11 c12 c13 goto missilecast skip if collision(missile0, playfield) || b = 50 then goto wallfound rem at least in this bit you never get here unless rem a = 0 and a never gets set to 0 (?) rem ie making case number 0 based may mess this up rem you never get here unless a = 0 so you never goto render if a > 16 then goto render goto missilecast c00 missile0x = missile0x + 0 : rem if facing north missile0y = missile0y - 1 return c01 missile0x = missile0x + 1 : rem if facing east missile0y = missile0y + 0 return c02 missile0x = missile0x + 0 : rem if facing south missile0y = missile0y + 1 return return c03 missile0x = missile0x - 1 : rem if facing west missile0y = missile0y + 0 return c10 missile0x = missile0x - z : rem if facing north missile0y = missile0y - 1 return c11 missile0x = missile0x + 1 : rem if facing east missile0y = missile0y - z return c12 missile0x = missile0x + z : rem if facing south missile0y = missile0y + 1 return c13 missile0x = missile0x - 1 : rem if facing west missile0y = missile0y + z return data div10 0,0,0,0,0,0,0,0,0,0 1,1,1,1,1,1,1,1,1,1 2,2,2,2,2,2,2,2,2,2 3,3,3,3,3,3,3,3,3,3 4,4,4,4,4,4,4,4,4,4 5 end render 1 Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 10, 2014 Author Share Posted September 10, 2014 (edited) OK, I have made a partially working single column Raycaster, can't seem to get it to get the player to move. Going to add more columns one I figure out a good way to make the missiles spread. Also, i'm having this one annoying bug where the wall size does not change, do you think you guys could find it because i'm having a hard time doing so. rem TIA-based raycaster v1 build 1 Gip-Gip 2014 set kernel DPC+ set smartbranching on set tv ntsc set kernel_options no_blank_lines startup rem Here is were variables are given values rem the compass scorecolor = 30 rem the player's rotation (4 directions) a = 0 rem the amount of frames to skip befor the player moves b = 0 rem variables c-u are used for rendering c = 17 rem v is used for deciding what level your on v = 0 rem w is used for telling time w = 0 rem x is used for telling how far away a wall is x = 0 rem the rest are currently unused rem now i name all the variables(other than y and z) so development is less confusing dim playerRot = a dim playerSpeed = b dim levelNum = v dim tick = w dim missileDistance = x dim ws01 = c dim ws02 = d dim ws03 = e dim ws04 = f dim ws05 = g dim ws06 = h dim ws07 = i dim ws08 = j dim ws09 = k dim ws10 = l dim ws11 = m dim ws12 = n dim ws13 = o dim ws14 = p dim ws15 = q dim ws16 = r dim ws17 = s dim ws18 = t dim ws19 = u goto randLevel rem now we enter the main game loop game if levelNum = 1 then gosub l1 if levelNum = 2 then gosub l2 gosub movement goto missileCast movement if joy0up then playerRot = 0 if joy0down then playerRot = 1 if joy0right then playerRot = 2 if joy0left then playerRot = 3 if joy0fire && playerRot = 0 then player0y = player0y - 1 if joy0fire && playerRot = 1 then player0y = player0y + 1 if joy0fire && playerRot = 2 then player0x = player0x + 1 if joy0fire && playerRot = 3 then player0x = player0x - 1 if collision(playfield, player0) && playerRot = 0 then player0y = player0y + 1 if collision(playfield, player0) && playerRot = 1 then player0y = player0y - 1 if collision(playfield, player0) && playerRot = 2 then player0x = player0x - 1 if collision(playfield, player0) && playerRot = 3 then player0x = player0x + 1 return randLevel levelNum = (rand&1) + 1 goto game l1 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X.X........................XXX.X X.X........................X.X.X X.X.....................XXXX.X.X X.XXX.........XX.............X.X X.X.....................XXXX.X.X X.X........................X.X.X X.X........................XXX.X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end COLUPF = 136 player0x = 116 player0y = 48 player0: %1111 %1111 %1111 %1111 end return l2 playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..X X..............................X XXX..........................XXX XXXX........................XXXX XXX..........................XXX X..............................X X..XXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end COLUPF = 26 player0x = 124 player0y = 80 player0: %1111 %1111 %1111 %1111 end return rem here variables are set for rendering missileCast missileDistance = 0 missile1x = player0x missile1y = player0y if playerRot = 0 then goto c01d0 if playerRot = 1 then goto c01d1 if playerRot = 2 then goto c01d2 if playerRot = 3 then goto c01d3 rem if the player is facing north... c01d0 missileDistance = missileDistance + 1 missile1y = missile1y - 1 if collision(playfield, missile1) || missileDistance = 16 then ws01 = ws01 - missileDistance if ws01 < 17 then missile1y = player0y if ws01 < 17 then missileDistance = 0 if ws01 < 17 then goto render goto c01d0 c01d1 missileDistance = missileDistance + 1 missile1y = missile1y + 1 if collision(playfield, missile1) || missileDistance = 16 then ws01 = ws01 - missileDistance if ws01 < 17 then missile1y = player0y if ws01 < 17 then missileDistance = 0 if ws01 < 17 then goto render goto c01d1 c01d2 missileDistance = missileDistance + 1 missile1y = missile1y + 1 if collision(playfield, missile1) || missileDistance = 16 then ws01 = ws01 - missileDistance if ws01 < 17 then missile1x = player0x if ws01 < 17 then missileDistance = 0 if ws01 < 17 then goto render goto c01d2 c01d3 missileDistance = missileDistance + 1 missile1x = missile1x - 1 if collision(playfield, missile1) || missileDistance = 16 then ws01 = ws01 - missileDistance if ws01 < 17 then missile1x = player0x if ws01 < 17 then missileDistance = 0 if ws01 < 17 then goto render goto c01d3 render playfield: ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ ................................ end if ws01 < 4 then pfpixel 16 0 on if ws01 < 4 then pfpixel 16 10 on if ws01 > 4 && ws01 < 9 then pfpixel 16 1 on if ws01 > 4 && ws01 < 9 then pfpixel 16 9 on if ws01 > 8 && ws01 < 13 then pfpixel 16 2 on if ws01 > 8 && ws01 < 13 then pfpixel 16 8 on if ws01 > 12 && ws01 < 17 then pfpixel 16 3 on if ws01 > 12 && ws01 < 17 then pfpixel 16 7 on if ws01 = 16 then pfpixel 16 4 on if ws01 = 16 then pfpixel 16 6 on ws01 = 17 drawscreen goto game Edited September 10, 2014 by Gip-Gip Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 12, 2014 Author Share Posted September 12, 2014 (edited) the code is getting a little too long, so you can just look at the text file. now the player can move, and is visible for debugging reasons. it seems the collision detection isn't working correctly, but it might just be me. Text file: https://dl.dropboxusercontent.com/u/102110774/2600DEV/RAYCASTER.txt So far it runs quite fast, but then again it doesn't work. Edited September 12, 2014 by Gip-Gip Quote Link to comment Share on other sites More sharing options...
Gip-Gip Posted September 13, 2014 Author Share Posted September 13, 2014 (edited) After further testing, if I removed the part in the rendering process where the playfield is cleared, the collision detection works just fine, and even the renderer seems to work a little. Edited September 13, 2014 by Gip-Gip Quote Link to comment Share on other sites More sharing options...
bogax Posted September 14, 2014 Share Posted September 14, 2014 (edited) After further testing, if I removed the part in the rendering process where the playfield is cleared, the collision detection works just fine, and even the renderer seems to work a little. I don't understand what you're doing so maybe this is non sequitor do you understand that the collision flags get set during drawscreen and will reflect the missile position at that time also c01d2 has missile1y = missile1y + 1 is that really what you wanted? In render ws01 = 4 is not in your test range(s) Edited September 14, 2014 by bogax 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.