Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Technical question

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
mjkrzak




Joined: 24 Nov 2009
Posts: 43

PostPosted: Fri Feb 21, 2014 8:07 pm    Post subject: Technical question Reply with quote

From a memory standpoint, is there much difference to the size of image slices? Which is to say, should I be making an effort to use the smallest slice size when possible rather than a full screen-sized one?

I expect it doesn't matter all that much with only 30 or so in my experiment, but if there's a major difference in performance between them, it might be good to know down the line.

(Sheesh, two posts in a row for the Help forum. How depressing.)
Back to top
View user's profile Send private message AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Fri Feb 21, 2014 10:17 pm    Post subject: Reply with quote

Well, backdrop slice sprites take up about 64 kb in memory, so it would take 15625 of them to fill up a gigabyte.

A large enemy sprite slice takes up 6.4 kb, so you would need 10 times as many to fill up a gigabyte.

Also, remember that if you load two copies of the same sprite slice, it only takes up the memory for one sprite.

As far as speed, I guess the backdrop slices will be slower, but I have never measured how much.

How many slices do you need to display on the screen at one time?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mjkrzak




Joined: 24 Nov 2009
Posts: 43

PostPosted: Fri Feb 21, 2014 11:51 pm    Post subject: Reply with quote

About 30 or so, maybe half of them duplicates.

I wanted to see if I can whomp up something relatively uncomplicated that reads a standard map and translates it visually to the player in the form of a first person old school dungeon crawl.
Back to top
View user's profile Send private message AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sat Feb 22, 2014 10:01 am    Post subject: Reply with quote

Aha! That sounds really cool! :)

30 backdrop slices doesn't sound like to much, so if it is easier to do them as backdrop slices, I say just try it that way. I wouldn't expect problems.

Do you have any screenshots of what you are working on?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mjkrzak




Joined: 24 Nov 2009
Posts: 43

PostPosted: Sat Feb 22, 2014 1:34 pm    Post subject: Reply with quote

Nah, just concept stage right now.

When I get proof of concept, I suppose I could put something up.
Back to top
View user's profile Send private message AIM Address
Gomez
Guest






PostPosted: Sat Mar 01, 2014 12:41 pm    Post subject: Reply with quote

I can confirm this is doable and runs pretty smoothly, though I used combinations of Large Enemy Graphics rather than backdrops, which might make a difference. You should hurry up and do it. It's way easier than you think it's gonna be and it looks really cool.
Back to top
Sparoku
Pyrithea Amethyst.




Joined: 02 Feb 2004
Posts: 467
Location: Washington State

PostPosted: Sun Mar 02, 2014 11:33 pm    Post subject: Reply with quote

mjkrzak wrote:
Nah, just concept stage right now.

When I get proof of concept, I suppose I could put something up.

I look forward to seeing what you come up with! Big grin
_________________
"There will always be people who will tell you they hate what you made, or like what you made, and will tell you that what you did was wrong or right."
My Discord ID: SparDanger#0305
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mjkrzak




Joined: 24 Nov 2009
Posts: 43

PostPosted: Sat Mar 15, 2014 8:17 pm    Post subject: Reply with quote

Reasonably functional, though the on-keypress navigation feels clunky. Gomez, how did you handle the movement?

Scene1
Scene2
Scene3
Scene4
Scene5
Scene6
Scene7

And I need to widen the field of view one square for a couple of distances. There should be a wall here:

Missing wall

As it stands, it takes a while to input the various views of each block, but once that's done, all you have to do is place the corresponding tile. Each block can have a different directional texture, like doors, though I haven't drawn one yet.
Back to top
View user's profile Send private message AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sun Mar 16, 2014 11:35 am    Post subject: Reply with quote

Wow! that looks great

Can you tell me more about the clunky on-keypress navigation?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mjkrzak




Joined: 24 Nov 2009
Posts: 43

PostPosted: Sun Mar 16, 2014 4:38 pm    Post subject: Reply with quote

Well, it doesn't always go with 1 keypress = 1 movement. Often it takes multiple attempts to move. It was even worse when I had alternate sidestepping and WSAD directions. With those, it consistently took 2 keypresses to do a move. Which is rather strange, as all I did was add the keys to the switch. Same commands for moving forward and turning, but the different buttons always needed a warm up before registering.

Code:

#-----------------------------------------------------
plotscript, FPS_NAV, begin
# Set this script to On-Keypress.
# It alters the movement from N/S/E/W
# to forward/rotate R&L/turn backward

   switch(wait for key (any key)) do(
     case(72) GO_FORWARD(0)       #up (up key)
     case(75) GO_ROTATE(0)         #rotate left (left key)
     case(77) GO_ROTATE(1)         #rotate right (right key)   
     case(80) GO_ROTATE(2)         #down (down key)   
     case(01) open menu (0)      #menu key (esc key)   
     case(119) open menu (0)      #menu key (alt key)
)

FOV
compass

end
#-----------------------------------------------------
script, GO_FORWARD, the_direction, begin
   
   #Case 0 walk forward, case 1 slide left, case 2 slide right
   
   switch(the_direction) do(
      case(0)
         switch(hero direction (me)) do(
            case(north)
               if (check hero wall (me,north))
                  else (set hero position (me, hero x (me), (hero y (me) -- 1)))
            case(south)
               if (check hero wall (me,south))
                  else (set hero position (me, hero x (me), (hero y (me) + 1)))
            case(east)
               if (check hero wall (me,east))
                  else (set hero position (me, (hero x (me) + 1), hero y (me)))
            case(west)
               if (check hero wall (me,west))
                  else (set hero position (me, (hero x (me) -- 1), hero y (me)))
         )
      
      case(1)
         switch(hero direction (me)) do(
            case(north)
               if (check hero wall (me,west))
                  else (set hero position (me, hero x (me)--1, hero y (me)))
            case(south)
               if (check hero wall (me,east))
                  else (set hero position (me, hero x (me)+1, hero y (me)))
            case(east)
               if (check hero wall (me,north))
                  else (set hero position (me, hero x (me), hero y (me)--1))
            case(west)
               if (check hero wall (me,south))
                  else (set hero position (me, hero x (me), hero y (me)+1))
         )

      case(2)      
         switch(hero direction (me)) do(
            case(north)
               if (check hero wall (me,east))
                  else (set hero position (me, hero x (me)+1, hero y (me)))
            case(south)
               if (check hero wall (me,west))
                  else (set hero position (me, hero x (me)--1, hero y (me)))
            case(east)
               if (check hero wall (me,south))
                  else (set hero position (me, hero x (me), hero y (me)+1))
            case(west)
               if (check hero wall (me,north))
                  else (set hero position (me, hero x (me), hero y (me)--1))
         )
   )
end
#-----------------------------------------------------
script, GO_ROTATE, the_direction, begin

#Case 0 turn left, case 1 turn right, case 2 180deg turn

switch(the_direction) do(
  case(0)
   switch(hero direction (me)) do(
      case(north) set hero direction (me, west)
      case(east) set hero direction (me, north)
      case(south) set hero direction (me, east)
      case(west) set hero direction (me, south)
   )
  case(1)
   switch(hero direction (me)) do(
      case(north) set hero direction (me, east)
      case(east) set hero direction (me, south)
      case(south) set hero direction (me, west)
      case(west) set hero direction (me, north)
   )
  case(2)
   switch(hero direction (me)) do(
      case(north) set hero direction (me, south)
      case(east) set hero direction (me, west)
      case(south) set hero direction (me, north)
      case(west) set hero direction (me, east)
   )
)
end


If you want to try it for yourself, here's the RPG file, though I took out the WSAD and sliding. (Even if the base code's still there.)

For reference, the goofy symbol in the lower left corner is just my knock together compass.
Back to top
View user's profile Send private message AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sun Mar 16, 2014 8:06 pm    Post subject: Reply with quote

Looking over the script, I am pretty sure this is the problem:

Code:

plotscript, FPS_NAV, begin
# Set this script to On-Keypress.
# It alters the movement from N/S/E/W
# to forward/rotate R&L/turn backward

   switch(wait for key (any key)) do(
     case(72) GO_FORWARD(0)       #up (up key)
     case(75) GO_ROTATE(0)         #rotate left (left key)
     case(77) GO_ROTATE(1)         #rotate right (right key)   
     case(80) GO_ROTATE(2)         #down (down key)   
     case(01) open menu (0)      #menu key (esc key)   
     case(119) open menu (0)      #menu key (alt key)
)

FOV
compass

end


You definitely do not want to use the "wait for key" command here. The on-keypress script is only called when a key has already been pressed, but the "wait for key" causes the script to go into a wait state which I believe will cause it to always lose 1 tick of keypresses.

Try writing it like this instead:

Code:

plotscript, FPS_NAV, begin
# Set this script to On-Keypress.
# It alters the movement from N/S/E/W
# to forward/rotate R&L/turn backward
  if(key is pressed(72)) then(GO_FORWARD(0))   #up (up key)
  if(key is pressed(75)) then(GO_ROTATE(0))   #rotate left (left key)
  if(key is pressed(77)) then(GO_ROTATE(1))   #rotate right (right key)   
  if(key is pressed(80)) then(GO_ROTATE(2))   #down (down key)
  if(key is pressed(01)) then(open menu (0))   #menu key (esc key)   
  if(key is pressed(119)) then(open menu (0))   #menu key (alt key)
)

FOV
compass

end
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Gomez
Guest






PostPosted: Wed Mar 19, 2014 11:04 pm    Post subject: Reply with quote

Holy shit, yours looks way better than mine did. As for movement, I just used the default engine movement.

Code:
plotscript,MoveChecks,begin

#Add a check to make sure that battle is NOT currently occurring.

switch (HeroDirection) do (

case (North)
do (
   if (KeyVal (key:Up) >> 1)
   then (walkhero (me,north,1)
   waitforhero (me) )
   
   if (KeyVal (Key:Down) >> 1)
   then (setherodirection (me,south))
   
   if (KeyVal (Key:Left) >> 1)
   then (setherodirection (me,west))
   
   if (KeyVal (Key:Right) >> 1)
   then (setherodirection (me,east))
   )
   
case (South)
do(
   if (KeyVal (key:Up) >> 1)
   then (walkhero (me,south,1)
   waitforhero (me) )
   
   if (KeyVal (Key:Down) >> 1)
   then (setherodirection (me,north))
   
   if (KeyVal (Key:Left) >> 1)
   then (setherodirection (me,east))
   
   if (KeyVal (Key:Right) >> 1)
   then (setherodirection (me,west))
   )

case (West)
do(

   if (KeyVal (key:Up) >> 1)
   then (walkhero (me,west,1)
   waitforhero (me) )
   
   if (KeyVal (Key:Down) >> 1)
   then (setherodirection (me,east))
   
   if (KeyVal (Key:Left) >> 1)
   then (setherodirection (me,south))
   
   if (KeyVal (Key:Right) >> 1)
   then (setherodirection (me,north))

   )
   
case (east)
do(

   if (KeyVal (key:Up) >> 1)
   then (walkhero (me,east,1)
   waitforhero (me) )
   
   if (KeyVal (Key:Down) >> 1)
   then (setherodirection (me,west))
   
   if (KeyVal (Key:Left) >> 1)
   then (setherodirection (me,north))
   
   if (KeyVal (Key:Right) >> 1)
   then (setherodirection (me,south))

   )
   
   )

end


which I called from a while loop.



It looked like this, you can see the default wall/tilemaps/hero underneath the "viewing window". I thought using the default walking/passability would save me a lot of time and grief.
Back to top
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Mar 20, 2014 10:01 am    Post subject: Reply with quote

Wow, looks nice!

Also, I totally forgot that Gomez/Giz created a first person dungeon crawler as well. I only remembered the one Sephy made (which was more or less the same as Giz's).

I recommend using keyval(key:foo) > 1 as in the script Giz posted, rather than keyispressed(key:foo). "keyval > 1" is only true either on a new key press, or on key repeat after a delay.


Incidentally, I just heard that backdrops aren't cached as they're meant to be, so loading or displaying a large number of them (I'm talking about 300, not 30) is far slower than it should be.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Sparoku
Pyrithea Amethyst.




Joined: 02 Feb 2004
Posts: 467
Location: Washington State

PostPosted: Fri Mar 21, 2014 9:25 pm    Post subject: Reply with quote

Kinda reminds me of Sword and Serpents for the NES.

In a good way, of course. Happy
_________________
"There will always be people who will tell you they hate what you made, or like what you made, and will tell you that what you did was wrong or right."
My Discord ID: SparDanger#0305
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group