Jump to content
IGNORED

Sword of Surtr [COMPLETE](formerly Sword of Iffrit)


ultima

Recommended Posts

This is awesome. I had recently started programming for the Atari. My skill level might not be up there yet but seeing all of your updates and improvements over the years is encouraging and makes me want to finish my game. It also makes me really want to buy this game once completed and hopefully on a cart.

  • Like 2
Link to comment
Share on other sites

After killing a large serpent I was trapped in the wall.

 

I was afraid of that. I can add a small video to move the player to a safe zone so this won't happen. It will go in the next update.

 

 

 

***update is in first post

-fixed player (if serpent is killed and your standing to far toward the bottom player will automatically move out of the way)

-revised A.I. (exploiting the fire demon AI to make enemys spaz out was throwing the scanline count out by 1)

Edited by ultima
  • Like 2
Link to comment
Share on other sites

I am wondering if the double entry on the inventory bar is specific to your FPGA implementation, since I'm not seeing it in Stella or on hardware. I also noticed that there are horizontal lines in the left of the screen (HMOVE bars) which don't appear in Stella or on hardware. To me, this would make me wonder if what you are using doesn't treat an early HMOVE (used to hide those video artifacts) the same way as the hardware or Stella does - which could throw off the timing for the inventory bar, and cause a duplicate like that. Just a thought.

Link to comment
Share on other sites

I am wondering if the double entry on the inventory bar is specific to your FPGA implementation, since I'm not seeing it in Stella or on hardware. I also noticed that there are horizontal lines in the left of the screen (HMOVE bars) which don't appear in Stella or on hardware. To me, this would make me wonder if what you are using doesn't treat an early HMOVE (used to hide those video artifacts) the same way as the hardware or Stella does - which could throw off the timing for the inventory bar, and cause a duplicate like that. Just a thought.

you're probably correct. If I run the AFP version on the FPGA I don't see the double inventory.

Link to comment
Share on other sites

Two bugs: One hit freeze enemy and double entry on inventory bar.

 

Sorry I forgot to remove my personal debug menu that's why the enemy freeze. I put rev2 on the first post. the double score is what Karl mentioned if you use the right rom it should fix the issue (one is for a console and the one with the score fix is for the portable(AFP))

 

Edited by ultima
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

 

Here I've done some code with tables
First is 22 of your if statements (put in to a more tabular form)
then the same thing with tables.
Each if statement takes a minimum of 7 cycles so if you fall through
all 22 that by it self takes 154 cycles.
If the if statements represent 1/3 of the possible rooms and the
rooms come up at random (they probably don't) 2/3 of the time you'll
spend 154 cycles just to decide you don't want to do anything.
If you do take the if statement then on average you'll do half of them
or about 77 cycles (again if the rooms are random which they probably aren't)
plus the 50 cycles or so that it takes for the rest it.
In the case of the tables it does a look up to decide if it needs to do
anything, that takes about nine cycles (versus 154).
The rest of the table code takes 180 cycles or so (versus the 77 + 50)
But that's all sort of worst case. It might be faster it might not.
I don't think it would be much worse.
It takes about 1/3 the ROM
Of course, it's not tested but it does compile.
 
   set romsize 32k
   set optimization noinlinedata
 
   dim _Room = r
   dim _Bit5_Frozen = f
 
 bank 2
 
dispatch2
 
 
 
 bank 3
 
dispatch3
DS7
 
mk1
 
   if _Room =  2 && player1x >  72 && player1x <  85 &&                  player1y < 55 then _Room = 46 :                  player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS46 bank5  ; 01  1
   if _Room =  4 && player1x >  66 && player1x <  86 && player1y > 45 && player1y < 55 then _Room = 42 : player1x = 117 : player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS42 bank5  ; 02  0
   if _Room =  5 && player1x > 108 && player1x < 118 &&                  player1y < 65 then _Room = 39 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS39 bank4  ; 03 10
   if _Room =  6 && player1x >  44 && player1x <  56 &&                  player1y < 71 then _Room = 27 : player1x =  78 : player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS27 bank4  ; 04  3
   if _Room =  7 && player1x > 114 && player1x < 134 &&                  player1y < 25 then _Room = 37 :                  player1y = 18 : _Bit5_Frozen{5} = 0 : goto DS37 bank4  ; 05  8
   if _Room =  8 && player1x >  62 && player1x <  77 && player1y > 52 && player1y < 62 then _Room = 40 : player1x =  21 : player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS40 bank4  ; 06 11
   if _Room =  9 && player1x >  49 && player1x <  70 &&                  player1y < 24 then _Room = 66 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS66 bank5  ; 07  7 
   if _Room = 10 && player1x >  80 && player1x <  91 && player1y > 55 && player1y < 63 then _Room = 31 : player1x =  77 : player1y = 77 : _Bit5_Frozen{5} = 0 : goto DS31 bank4  ; 08  4
   if _Room = 13 && player1x >  46 && player1x <  66 && player1y > 40 && player1y < 46 then _Room = 37 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS37 bank4  ; 09  8
   if _Room = 15 && player1x >  87 && player1x <  96 && player1y > 60 && player1y < 77 then _Room = 25 : player1x =  78 :                 _Bit5_Frozen{5} = 0 : goto DS25 bank4  ; 10  1
   if _Room = 18 && player1x >  99 && player1x < 113 && player1y > 40 && player1y < 47 then _Room = 38 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS38 bank4  ; 11  9
   if _Room = 19 && player1x >  51 && player1x <  64 &&                  player1y < 63 then _Room = 26 : player1x =  78 : player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS26 bank4  ; 12  2
   if _Room = 24 && player1x >  58 && player1x <  78 &&                  player1y < 62 then _Room = 32 : player1x =  46 : player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS32 bank4  ; 13  5
   if _Room = 32 && player1x >  88 && player1x < 104 &&                  player1y < 31 then _Room = 34 :                  player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS34 bank4  ; 14  6
   if _Room = 35 && player1x >  96 && player1x < 106 &&                  player1y < 62 then _Room = 36 :                  player1y = 85 : _Bit5_Frozen{5} = 0 : goto DS36 bank4  ; 15  7
   if _Room = 37 && player1x > 124 && player1x < 134 && player1y > 28                  then _Room =  7 :                  player1y = 34 : _Bit5_Frozen{5} = 0 : goto  DS7 bank3  ; 16
   if _Room = 41 &&                                                      player1y < 55 then _Room = 56 : player1x =  25 : player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS56 bank5  ; 17  5
   if _Room = 47 && player1x >  32 && player1x <  52 &&                  player1y < 47 then _Room = 48 :                  player1y = 75 : _Bit5_Frozen{5} = 0 : goto DS48 bank5  ; 18  2
   if _Room = 51 && player1x > 114 && player1x < 134 &&                  player1y < 47 then _Room = 50 :                  player1y = 75 : _Bit5_Frozen{5} = 0 : goto DS50 bank5  ; 19  3
   if _Room = 52 && player1x >  71 && player1x <  90 &&                  player1y < 47 then _Room = 51 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS51 bank5  ; 20  4
   if _Room = 54 && player1x >  77 && player1x <  90 &&                  player1y < 40 then _Room = 64 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS64 bank5  ; 21  6 
   if _Room = 59 && player1x >  84 && player1x < 101 && player1y > 59 && player1y < 76 then _Room = 23 :                  player1y = 84 : _Bit5_Frozen{5} = 0 : goto DS23 bank4  ; 22  0
 
 
 
mk2
 
   dim  room_index = temp1
   dim target_bank = temp2
   dim   DS_target = temp3
 
   if !ridat[_Room] then skip
   room_index = ridat[_Room]-1 
 
   if player1x < P1xlo[room_index]  || player1x > P1xhi[room_index] then skip
   if player1y < P1ylo[room_index]  || player1y > P1yhi[room_index] then skip
 
   _Bit5_Frozen{5} = 0 
   if newxdat[room_index] then player1x = newxdat[room_index]
   if newydat[room_index] then player1y = newydat[room_index]
   _Room  = new_room[room_index]
   DS_target = DStdat[room_index]
   target_bank = tbnkdat[room_index]
 
   on target_bank goto bnk3 bnk4 bnk5 bnk6
 
skip
 
 
bnk3 goto dispatch3
bnk4 goto dispatch4 bank4
bnk5 goto dispatch5 bank5
bnk6 goto dispatch6 bank6
 
 
  ; 00   01   02   03   04   05   06   07   08   09   10   11   12   13   14   15   16   17   18   19   20   21
 
   data newydat
    85,  85,  84,  85,  18,  85,  84,  77,  84,   0,  84,  85,  85,  85,  85,  34, 84,  75,  75,  84,  84,  84
end
 
   data newxdat
     0, 117,   0,  78,   0,  21,   0,  77,   0,  78,   0,  78,  46,   0,   0,   0,  25,   0,   0,   0,   0,   0
end
 
   data P1xlo
    73,  67, 109,  45, 115,  63,  50,  81,  47,  88, 100,  52,  59,  89,  97, 125,   0,  33, 115,  72,  78,  85
end
 
   data P1xhi
    84,  85, 117,  55, 133,  76,  69,  90,  65,  95, 112,  63,  77, 103, 105, 133, 255, 51, 133,  89,  89, 100
end
 
   data P1ylo
   255,  46, 255, 255, 255,  53, 255,  56,  41,  61,  41, 255, 255, 255, 255,  29, 255, 255, 255, 255, 255,  60
end
 
   data P1yhi
    54,  54,  64,  70,  24,  61,  23,  62,  45,  76,  46,  62,  61,  30,  61,   0,  54,  46,  46,  46,  39,  75
end
 
   data new_room
    46,  42,  39,  27,  37,  40,  66,  31,  37,  25,  38,  26,  32,  34,  36,   7,  56,  48,  50,  51,  64,  23
end
 
   data DStdat
     1,   0,  10,   3,   8,  11,   7,   4,   8,   1,   9,   2,   5,   6,   7,   0,   5,   2,   3,   4,   6,   0
end
 
   data tbnkdat
     3,   3,   2,   2,   2,   2,   3,   2,   2,   2,   2,   2,   2,   2,   2,   1,   3,   3,   3,   3,   3,   2
end
 
   data ridat
     0,   0,   1,   0,   2,   3,   4,   5,   6,   7,   8,   0,   0,   9,   0,  10
     0,   0,  11,  12,   0,   0,   0,   0,  13,   0,   0,   0,   0,   0,   0,   0
    14,   0,   0,  15,   0,  16,   0,   0,   0,  17,   0,   0,   0,   0,   0,  18
     0,   0,   0,  19,  20,   0,  21,   0,   0,   0,   0,  22,   0,   0,   0,   0
end 
 
mk3
 
 
 
 bank 4
 
dispatch4 on DS_target goto DS23 DS25 DS26 DS27 DS31 DS32 DS34 DS36 DS37 DS38 DS39 DS40 DS37
 
DS23
DS25
DS26
DS27
DS31
DS32
DS34
DS36
DS37
DS38
DS39
DS40
 
 
 bank 5
 
dispatch5  on DS_target goto DS42 DS46 DS48 DS50 DS51 DS56 DS64 DS66
 
DS42
DS46
DS48
DS50
DS51
DS56
DS64
DS66
 
 
 
 bank 6
 
dispatch6
 
 
  asm
  echo (.mk2 - .mk1)d
  echo (.mk3 - .mk2)d
end
 

***here is an explaination of the above code to understand it better. Should put this as a reply in the sword of surtr thread in case anyone else is interested.

It's been a few months so I may not remember everything
I spread out your if statements and put them in a more tabular form to make it easier to see the correspondence to the tables (the data statements)
The tables are setup for rooms 0..59
There are 22 if statements and they are very similar. Each if statements corresponds to a particular room.
You do 22 if tests to decide that you don't need to do any if tests ;) and that's roughly 2/3 of the time (or at least for 2/3 of the possible rooms, not necessarily the same thing)
Better to just look it up in a table of flags. Thats the ridat table. A zero flag means no if tests
The 22 if statements are very similar so they get replaced by a single set of if statements that get passed parameters selected according to the room number
The parameter tables could be indexed by the room number but then they'd be 2/3 empty (2/3 of the rooms dont need any parameters)
So there's an entry in the parameter tables for each if statement
and which set of parameters is looked up is in the ridat table according to the room (ie indexed by the room number)
So the ridat is a set of flags. If the flag is 0 then no if statement. If the flag <>0 then it's the index into the parameter tables for that room (ridat = room index data)
For speed and simplicity the no if test flag value is 0 but the parameter tables are 0 based so the value in the ridat table is the index + 1
There's a comment to the right of each if statement with two numbers. The first number is the value of that if statement's index into the parameter tables + 1
You could in principle get by with a bit for each flag ie 8 bytes instead of 60, but you'd still need to look up the index to the parameters
That means that it is the ridat table that is basically 2/3 empty but not the parameter tables (you could think of it as a simple form of data compression).
(actually more than 2/3 'cause you only need 5 bits for the flag/index data so even the bytes that are used are about 1/3 empty)
You might be able to use that space for other stuff
The if statements are similar but there are empty spots in the parameters tables (P1xlo, P1xhi, P1ylo, P1yhi) corresponding to tests not in the if statements
Since the if predicate clauses are ANDed, and for a Boolean x && TRUE = x , those spots in the table have to always test true
Except that I reversed the sense of the if statements so that they're ORed so that instead of always doing something if this AND that AND theOther are TRUE, you skip it if this OR that OR theOther is FALSE
(Don't know if you actually tryed the code but if you do, best make sure I didn't screw that up ;) )
There are also assignments made in the if statments (ie _Room, player1x, player1y), but not all of the if statments
In the parameters (newxdat, newydat, new_room) a 0 means no assignment and a value<>0 gets assigned
Bank switches take a lot of code so I parameterized them and reduced it to four actual bank switches in the code.
That took four table look ups, two in to the parameter tables to get the indexes (tbnkdat, DStdat) into the tables implicit in the on goto statements (the other two table look ups are the on goto statements themselves)
there's only ~20 or so possibilities so the parameter look ups could be fit in to one table/byte but the DSxx labels go up to DS68 or something, so I left room
if I recall correctly the second number in the comments with the if statement is the index for the in bank dispatch on goto, ie DStdat/DStarget

 

 

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...
On 4/18/2020 at 10:02 AM, WizardBone said:

I was searching for your game for awhile until I realized you renamed it! lol
Is it finally done? :D I remember loving the project a couple years ago. 

Sorry for the late reply but yeah for better or worse this was the final. Although looking at it with fresh eyes I think I could have done a better job. 

Link to comment
Share on other sites

On ‎10‎/‎16‎/‎2020 at 12:13 AM, ultima said:

Sorry for the late reply but yeah for better or worse this was the final. Although looking at it with fresh eyes I think I could have done a better job. 

I used to feel that way about essays and short stories that I would write when I was younger.  Perfectionism is a harsh mistress, she eats away at you bit by bit until there is nothing left.  :skull:  It took awhile, but I eventually learned how to let it go.

 

I was wondering though, have you considered making a 7800 version of this game like @Revontuli did with Dragon's Descent?  It might make for an interesting opportunity for you to exorcise some of those "demons of regret" that are plaguing you at the moment.  :evil:

 

  • Like 4
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...