Author Topic: Side Project #2: DUNGEON  (Read 26384 times)

0 Members and 2 Guests are viewing this topic.

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #15 on: May 07, 2009, 06:05:19 pm »
Its an 84+SE ROM
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Side Project #2: DUNGEON
« Reply #16 on: May 07, 2009, 06:07:45 pm »
ah that's why, what code are you using to display the map? I've been playing around with dual-layer sprite maps but I can't get them to load quickly.
/e

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #17 on: May 07, 2009, 06:13:22 pm »
Hmm hold on a sec, I'll post the code.

Code: [Select]
2->A
Repeat A=10
Text(-1,8A-16,0,sub(Str1,14A-12,12
StorePic 1
Text(-1,8A-16,0,sub(Str2,14A-12,12
RecallPic 1
A+1->A
End

I have A set to 2 instead of 1 because I have a blank border around my map, which makes it MUCH easier/faster to do movement between screens, so I have to start at the 2nd "row" of the string instead of the first.
« Last Edit: May 07, 2009, 06:16:45 pm by trevmeister66 »
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Side Project #2: DUNGEON
« Reply #18 on: May 07, 2009, 06:36:32 pm »
so you use a string as a map, hmm, this is what I did, it's kind of slow
Code: [Select]
:ClrDraw
:For(A,0,60,7)
:For(B,0,94,5)
:If [B](A/7+1,B/5+1
:Then
:Text(-1,A,B,"O
:StorePic 2
:Text(-1,A,B,"X
:RecallPic 2
:End
:End
:End
/e

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #19 on: May 07, 2009, 07:16:10 pm »
Yeah using a matrix is WAY slower than strings, although It's a little easier to do hit detection (although still slower). I just have each "room" stored in a part of a program and just call that program and run the drawing routine.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Side Project #2: DUNGEON
« Reply #20 on: May 07, 2009, 09:29:03 pm »
I always found collision detection to be slower with strings than matrices, because with matrices all you got to do is put every solid tiles at the top or bottom, event tiles in the middle and then you only have to check if the tile number is below or above a certain number or between a certain number and another. With strings you need to check for every possible characters you can walk on so the more non-solid tiles you got, the slower your walking engine will be. This is the reason why in Illusiat 13 there are only two possible tiles you can walk on

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #21 on: May 07, 2009, 09:32:28 pm »
I always found collision detection to be slower with strings than matrices, because with matrices all you got to do is put every solid tiles at the top or bottom, event tiles in the middle and then you only have to check if the tile number is below or above a certain number or between a certain number and another. With strings you need to check for every possible characters you can walk on so the more non-solid tiles you got, the slower your walking engine will be. This is the reason why in Illusiat 13 there are only two possible tiles you can walk on
Yeah that's true, but I don't know. Strings are WAY WAY smaller than matrices, especially for what I'm doing, that the slighter delay in hit detection doesn't really bother me.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Side Project #2: DUNGEON
« Reply #22 on: May 07, 2009, 10:10:45 pm »
true. Had Illusiat used matrices it would alerady hit about 130 KB right now I think

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #23 on: May 07, 2009, 10:38:18 pm »
true. Had Illusiat used matrices it would alerady hit about 130 KB right now I think
Exactly. Just storing the matrix data in programs is big, let alone having the matrix in RAM when using it.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline simplethinker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 695
  • Rating: +16/-5
  • snjwffl
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #24 on: May 08, 2009, 03:25:25 pm »
With strings you need to check for every possible characters you can walk on so the more non-solid tiles you got, the slower your walking engine will be.
Couldn't you just use inString( on a string of all your tiles (which can be easily ordered) and use the resulting number as if you had read it from a matrix?

Yeah that's true, but I don't know. Strings are WAY WAY smaller than matrices, especially for what I'm doing, that the slighter delay in hit detection doesn't really bother me.
It might not be as slight as you think.  I just tested access times (16*8*14=1792 reads) for a screen-sized matrix (8 rows x 16 columns) and string (128 elements), and accessing the string took 75% more time than for the matrix :o (4 trials of each; 15 seconds for the matrix, and 26 seconds for the string).

The biggest problem with matrices is that storing the matrices needs approximately double the memory than that for strings, and they take up about nine times as much RAM.  Plus, at the instant you store the matrix an extra copy is put in Ans, so matrices require 18x more RAM than strings.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky



Chip's Challenge: ħ%

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Side Project #2: DUNGEON
« Reply #25 on: May 08, 2009, 04:41:24 pm »
hmm, interesting stuff, I just played around with your code trevmeister66
and I was able to cut four bytes from it and display the same amount.
Code: [Select]
For(A,2,9)
Text(-1,8A-16,0,sub(Str1,14A-12,12
StorePic 1
Text(-1,8A-16,0,sub(Str2,14A-12,12
RecallPic1
End
I also was testing it out and it loads at about teh same speed, but it might be a little faster, I can't really tell.
EDIT: oh yeah I modified it some more and made it 15*8 and I also made it so it doesn't waste memory by making the maps have extra characters that aren't displayed.
Code: [Select]
For(A,1,8)
Text(-1,8A-8,0,sub(Str1,15A-14,15
StorePic 1
Text(-1,8A-8,0,sub(Str2,15A-14,15
RecallPic 1
End
this also cut's two more bytes. and that excludes the bytes saved on the maps.
EDIT2: ok, I also added a little bit of game play to it, but I'm having some trouble detecting tiles above your character... how did you do detection?
« Last Edit: May 08, 2009, 06:05:55 pm by Eeems »
/e

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #26 on: May 08, 2009, 07:00:50 pm »
hmm, interesting stuff, I just played around with your code trevmeister66
and I was able to cut four bytes from it and display the same amount.
Code: [Select]
For(A,2,9)
Text(-1,8A-16,0,sub(Str1,14A-12,12
StorePic 1
Text(-1,8A-16,0,sub(Str2,14A-12,12
RecallPic1
End
I also was testing it out and it loads at about teh same speed, but it might be a little faster, I can't really tell.
EDIT: oh yeah I modified it some more and made it 15*8 and I also made it so it doesn't waste memory by making the maps have extra characters that aren't displayed.
Code: [Select]
For(A,1,8)
Text(-1,8A-8,0,sub(Str1,15A-14,15
StorePic 1
Text(-1,8A-8,0,sub(Str2,15A-14,15
RecallPic 1
End
this also cut's two more bytes. and that excludes the bytes saved on the maps.
EDIT2: ok, I also added a little bit of game play to it, but I'm having some trouble detecting tiles above your character... how did you do detection?

lol that's why I had it at 2,9 instead of 1,8... I had a border around the entire string, which made it ALOT easier to check if you left the map.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Side Project #2: DUNGEON
« Reply #27 on: May 08, 2009, 07:14:20 pm »
ah, well I could do the boarder thing but still make it so the maps don't need to be very large, but what about detecting a tile above your character? how did you do that?
/e

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Side Project #2: DUNGEON
« Reply #28 on: May 09, 2009, 12:15:00 am »
Here's my string:

(14 spaces for top border and bottom border)
"              "
" XXXXXXXXXXXX "
" X                  X "
" X                  X "
" X                  X "
" X                  X "
" X                  X "
" X                  X "
" XXXXXXXXXXXX "
"              "

Normally this string would all be one string, but I made it like this to show you how it works. You do all your hit detection and movement like you normally do, but then you just check to see if your character went onto the border, and if it did, then you change screens depending on whichever side you went on (top, bottom, etc..)

Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Side Project #2: DUNGEON
« Reply #29 on: May 09, 2009, 12:31:11 am »
@simplethinker, isn't inString( slow, though? I remember testing it and it wasn't too fast from what I remember, compared to what i am doing atm