Jump to content
IGNORED

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


ultima

Recommended Posts


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

Link to comment
Share on other sites


A couple more things.


First I didn't really mention it 'cause it doesn't really pertain

to tables

If eg you take the room 2 branch and fall through you go on and

spend another 150 cycles or so testing a bunch of rooms you already

know you're not in.


Second the 180 cycles v 77 + 50 is worst case and only if you change rooms

If you ran through that code every frame and changed rooms three times

a second that would still only be 5% of the time

If you fall through after, say, the two x position tests then break even

is at about 5 room tests.


The table code always (potentially) does four tests (not counting the room test)

Only a few of the string of if tests do that many.
Link to comment
Share on other sites

  • 1 month later...

I worry that I may have inadvertently been discouraging as well. Overcycling was a bit noticeable in spots when I tried it on real hardware, but nothing that makes it unplayable. You have created a pretty awesome game. Put me down for a cart, too, if you choose to publish it.

Link to comment
Share on other sites

  • 3 weeks later...

So does that mean that he found a way to fix it?

Yes I figured out some branch controls to run it without nearly as many cycles. The problem did not really matter on the flashback portable but on real Atari hardware it was making the screen jitter.

Link to comment
Share on other sites

  • 1 month later...

Great game. It has a quite enjoyable experience. Have you considered selling it in cartridges?

Thanks for playing glad you enjoyed it. I guess I've thought about putting it on a cartridge but I'm not sure it's up to par with the amazing work of the people who program in .asm programming.

Link to comment
Share on other sites

Bugfix

- fixed Fire Demon bug where leaving the fight left a fireball (ball pixel) on screen that would kill the player

- adjusted the color of water illumination down a couple notches

- fixed a inventory graphic

- wrote up some general instructions that explain gameplay and a color map of the overworld

 

new version in first post

  • Like 5
Link to comment
Share on other sites

Thanks for playing glad you enjoyed it. I guess I've thought about putting it on a cartridge but I'm not sure it's up to par with the amazing work of the people who program in .asm programming.

 

This is an awesome game. Congratulations to you.

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

I'm wasting my time trying to fix this so I'm just going to kill it here. Maybe I'll start a new project. Maybe I won't.

 

Just downloaded the final update.

This game is beautiful. Not sure what you have left to fix if anything, but at this point you are looking at the exit door of the project. Tidy up any loose ends and put it on a cart!

Good job man. Love the game.

  • Like 1
Link to comment
Share on other sites

changelog no more updates unless a bug is found

-ice cavern redesign
-enemy ai change
-new shortcut added
-arrows off screen bugfix
-title track music added ending
-added a cheat code
-secret true ending boss battle (survive whole game in 1 life)

 

 

Many thanks to those of you who have played this time and time again hope you enjoy this version :)

  • Like 6
Link to comment
Share on other sites

I'm playing Sword of Sutrt [Final beta] on the MiSTer FPGA Atari 2600 core. Everything in the game so far works great except this Red room I'm stuck in.

Can anyone else confirm this as a bug or maybe an incompatibility with the MiSTer FPGA Atari 2600 core?

ROM: 8-23-18


Edited by NML32
Link to comment
Share on other sites

 

I'm playing Sword of Sutrt [Final beta] on the MiSTer FPGA Atari 2600 core. Everything in the game so far works great except this Red room I'm stuck in.

Can anyone else confirm this as a bug or maybe an incompatibility with the MiSTer FPGA Atari 2600 core?

ROM: 8-23-18

https://youtu.be/_r14jrWai-4

Yeah I got that today on the portable i'll put that on the fix asap list

 

There is also a problem using reset once the cheat code is entered

 

2 so far thanks

  • Like 1
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...