Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : DROD and Snake
New Topic New Poll Post Reply
Poster Message
Kamaz
Level: Goblin
Avatar
Rank Points: 15
Registered: 11-28-2007
IP: Logged

File: DRODSnake.zip (760.7 KB)
Downloaded 144 times.
License: Other
icon DROD and Snake (+3)  
Ok, long time DRODer, first time looking in the forums - mainly because I only just recently stumbled accross DRODTris.
And it's DRODTris that persuaded me to make this.
DRODSnake.
You know of the old classic Snake game?
After player DRODTris, I dug out an old VB snake program I wrote, rewrote parts, added DROD graphics and sounds, and here's the result for you.
It's not perfect yet. I'm having a few problems coding corners, so you'll have to make do with my temporary solution.
The head of the snake is Beethro, leading a line of Brains. The food is a potion for now. Until I get corners solved, I'm not going to do much there.
There are sounds, one for winning, one for losing, one for eating. I had to use DRODAE sounds, since I don't actually have any wave sounds from JtRH.

Oh, and read the readme included, it should stop a few more common mistake happening.

Happy DRODing,
Kamaz.

Late edit:
Almost forgot. If you do somehow manage to break my program or find a dungeon roach in the workings (or just a normal bug too) don't forget to let me know.
Go ahead, comment, suggest... maybe by the time you do I'll finally work out that corner problem.

____________________________
Go ahead. Destroy the fabric of the universe. See if I care.

[Last edited by Kamaz at 11-28-2007 01:50 PM]
11-28-2007 at 01:30 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
calamarain
Level: Smitemaster
Avatar
Rank Points: 933
Registered: 03-25-2007
IP: Logged
icon Re: DROD and Snake (0)  
Kamaz wrote:
Ok, long time DRODer, first time looking in the forums - mainly because I only just recently stumbled accross DRODTris.
And it's DRODTris that persuaded me to make this.
DRODSnake.
You know of the old classic Snake game?
After player DRODTris, I dug out an old VB snake program I wrote, rewrote parts, added DROD graphics and sounds, and here's the result for you.
It's not perfect yet. I'm having a few problems coding corners, so you'll have to make do with my temporary solution.
The head of the snake is Halph, leading a line of Wubbas. The food is a potion for now. Until I get corners solved, I'm not going to do much there.
There are sounds, one for winning, one for losing, one for eating. I had to use DRODAE sounds, since I don't actually have any wave sounds from JtRH.

Oh, and read the readme included, it should stop a few more common mistake happening.

Happy DRODing,
Kamaz.

First things first - you're not allowed to use the JtRH wave sounds or TCB wave sounds even if you had them. They're not public domain - the AE stuff is.

Furthermore (I can't check at the moment, am on a work computer) - are you using the graphics from JtRH or TCB? They are not public domain and you're not allowed to use them. If they're the graphics from AE, that's fine.

____________________________
My Holds
Click here to view the secret text

11-28-2007 at 01:35 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Kamaz
Level: Goblin
Avatar
Rank Points: 15
Registered: 11-28-2007
IP: Logged
icon Re: DROD and Snake (0)  
Hmm...
Might have to change the graphics then. Wubbas and Halph don't appear in AE...
Other than that, it's all from AE. I don't actually have a copy of JtRH at the moment, I was working off screenshots a friend sent me.
I'll go fix those graphics now.

____________________________
Go ahead. Destroy the fabric of the universe. See if I care.

[Last edited by Kamaz at 11-28-2007 01:38 PM]
11-28-2007 at 01:37 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
calamarain
Level: Smitemaster
Avatar
Rank Points: 933
Registered: 03-25-2007
IP: Logged
icon Re: DROD and Snake (0)  
OK. Wubbas are from JtRH too, I'm afraid.

____________________________
My Holds
Click here to view the secret text


[Last edited by calamarain at 11-28-2007 01:38 PM]
11-28-2007 at 01:37 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Kamaz
Level: Goblin
Avatar
Rank Points: 15
Registered: 11-28-2007
IP: Logged
icon Re: DROD and Snake (0)  
Yep, you beat me to editing my last post.
Back in a bit with the slightly updated version.

____________________________
Go ahead. Destroy the fabric of the universe. See if I care.
11-28-2007 at 01:38 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
calamarain
Level: Smitemaster
Avatar
Rank Points: 933
Registered: 03-25-2007
IP: Logged
icon Re: DROD and Snake (0)  
Kamaz wrote:
Yep, you beat me to editing my last post.
Back in a bit with the slightly updated version.
Okie dokie. It's a good idea for a project, but it's best to err on the side of copyright caution :)

____________________________
My Holds
Click here to view the secret text

11-28-2007 at 01:46 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Kamaz
Level: Goblin
Avatar
Rank Points: 15
Registered: 11-28-2007
IP: Logged
icon Re: DROD and Snake (+1)  
And done.
That should fix thatparticular problem.
Thanks for letting me know on that one... I didn't know, having only recently been converted to the religion of playing DROD until your hands fall of...

____________________________
Go ahead. Destroy the fabric of the universe. See if I care.
11-28-2007 at 01:51 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Ezlo
Level: Smitemaster
Avatar
Rank Points: 1214
Registered: 01-08-2006
IP: Logged
icon Re: DROD and Snake (0)  
I'm thinking that instead of having Beethro and a line of brains, try using a snake instead. It might just look a bit better! Just thinking out loud here. :)
11-28-2007 at 04:31 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Kamaz
Level: Goblin
Avatar
Rank Points: 15
Registered: 11-28-2007
IP: Logged
icon Re: DROD and Snake (0)  
Ezlo wrote:
I'm thinking that instead of having Beethro and a line of brains, try using a snake instead. It might just look a bit better! Just thinking out loud here. :)
I'd love to be able to do that.
But as I mentioned in my first post, I'm having a few problems coding it right, expecially on the corners. I can get the head to go fine, and the body usually works at the moment.
But getting the graphics to show up right on corners is proving a bit of a problem.
Beethro and Brains was the best I could come up with on short notice.

____________________________
Go ahead. Destroy the fabric of the universe. See if I care.
11-28-2007 at 05:08 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Maurog
Level: Smitemaster
Avatar
Rank Points: 1501
Registered: 09-16-2004
IP: Logged

File: snake.PNG (3.7 KB)
Downloaded 363 times.
License: Public Domain
icon Re: DROD and Snake (+2)  
Below is my code for drawing the snake tiles.

A few comments - x and y are coordinates, dx and dy are difference between previous segment and this segment (the one we fetch tile for). In case of snake, one of those will always be 0 and one either 1 or -1 (because snakes move orthogonally).

nextx and nexty are the coordinates of next snake segment, prevx and prevy of the previous one (snake is basically a list). If they are -1, it means there is no next (=tail) or no prev (=head).

_faces[] is an array of graphics for the snake, it goes as follows (feel free to use my tiles by the way):



_dir is the direction of the head. 0 is north, 1 is northeast, 2 is east and so on until 7 is northwest. There are 8 directions because the template is used for all monsters, the snake only uses the even ones of course.

XTODIR is a function that takes a dx and dy and turns them into a _dir direction.

      Asp dummy = (Asp)mon;
      int prevdx = dummy._mx-dummy._prevx;
      int prevdy = dummy._my-dummy._prevy;
      int nextdx = dummy._nextx-dummy._mx;
      int nextdy = dummy._nexty-dummy._my;
      mon._face = _faces[mon._dir/2+10];
       
      if(dummy._nextx == -1) {
      	if(dummy._prevx != -1)
      		mon._face = _faces[Mon.XTODIR[prevdx+1][prevdy+1]/2+10];
      	else mon._face = _faces[mon._dir/2+10];
      }
      else if(dummy._prevx == -1)
      	if(dummy._nextx != -1)
      		mon._face = _faces[Mon.XTODIR[nextdx+1][nextdy+1]/2+6];
      	else mon._face = _faces[mon._dir/2+6];
      else if(dummy._prevx == dummy._nextx)
        mon._face = _faces[0];
      else if(dummy._prevy == dummy._nexty)
        mon._face = _faces[1];
      else if(prevdx == -1 && nextdy == -1 || prevdy == 1 && nextdx == 1)
      	mon._face = _faces[5];
      else if(prevdx == 1 && nextdy == 1 || prevdy == -1 && nextdx == -1)
      	mon._face = _faces[3]; 
      else if(prevdx == -1 && nextdy == 1 || prevdy == -1 && nextdx == 1)
      	mon._face = _faces[2]; 
      else if(prevdx == 1 && nextdy == -1 || prevdy == 1 && nextdx == -1)
      	mon._face = _faces[4];
Hope it helps. Snakes are complicated to draw...

____________________________
Slay the living! Raise the dead!
Paint the sky in crimson red!

[Last edited by Maurog at 11-28-2007 07:43 PM]
11-28-2007 at 07:24 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Syntax
Level: Smitemaster
Rank Points: 1218
Registered: 05-12-2005
IP: Logged
icon Re: DROD and Snake (0)  
You could probably also store each segment's pre and post segments direction with the snake when calculating the snake and use a 2d array lookup to fetch the right graphic. This could then be easily extended to display different graphics for "straight section going up" and "straight section going down" if need be.

The method would be:

snake moves down
update current head with "next segment is down"
create head
update new head with "last segment is up"

snake moves right
update current head with "next segment is right"
create head
update new head with "last segment is left"

Now:

When drawing the snake, the old head (in this example) can now easily tell previous segment is above and next is right hence display bendy section with a simple lookup.

Just a thought... Less processing required at display time. This would also be easy to extend to hex grids for example.
11-29-2007 at 01:22 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Kamaz
Level: Goblin
Avatar
Rank Points: 15
Registered: 11-28-2007
IP: Logged
icon Re: DROD and Snake (0)  
Some useful ideas, I can tell.
I'll give them a shot, but to be honest I'm not expecting it to work, mainly because I'm not certain if I can integrate it into the current code used to assign graphics.
I should be able to get the head and tail working fine, and it's possible I might be able to get body up/down and left/right, but I'm not optimistic on the corners.
Bear with me people, I'll see what I can do. No promises though, it has been some time since I last worked with VB.

____________________________
Go ahead. Destroy the fabric of the universe. See if I care.
11-29-2007 at 11:17 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Gutter
Level: Goblin
Rank Points: 21
Registered: 03-31-2003
IP: Logged
icon Re: DROD and Snake (+1)  
Corners aren't much harder than the head of tail.

The easiest way to approach that IMHO is to assign a binary value to each side of the tiles.

So "up" is 1, "right" is 2, "bottom" is 4 and "left" is 8. Like this :
    1
  |---|
 8|   | 2
  |---|
    4


And then you go through each snake segments and add the values of the "entry" and "exit" sides. So any combination of entry and exits will give you a tile value between 0-15.

Your graphic file simply need to be in the right order. I don't have access to drawing tools, but it`s easy enough. A simple snake tileset would be :

Tile :
0 : empty tile
1 : tail/head coming from the north (because "1" is the sum of only one side)
2 : tail/head coming from the west
3 : north to west corner (because "3" is the sum of the north and west sides)
4 : tail/head coming from the south
5 : straight segment, north to south
6 : west to south corner
7 : not used (because "7" is the sum of 3 sides, and the snake will never touch 3 sides at once)
8 : tail/head coming from the east
9 : east to north corner
10 : etc... just add the side values together to know their shapes.

This technique works with drawing Snakes, path arrows, Drod's gates, or even to draw overworld RPG maps (it allows to quickly determine what tiles goes where based on it's surrounding)

[Last edited by Gutter at 12-03-2007 10:30 PM]
12-03-2007 at 10:27 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Syntax
Level: Smitemaster
Rank Points: 1218
Registered: 05-12-2005
IP: Logged
icon Re: DROD and Snake (0)  
Yeah good complement to mine - this is the perfect lookup. Nicely put (though I think your East/West sums might be wrong but the gist is there) :)
12-03-2007 at 11:14 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : DROD and Snake
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.