I've just started working on a game similar to ChessRogue.
Both ChessRogue and my game take place in a dungeon whose inhabitants' movements are like those of chess pieces.
At http://www.apolitical.info/private/rogue/levelgen , I've got some code which creates a dungeon level, and prints it. EDIT I've changed the code so it prints plain text rather than a table with background colors.
However this appears to be very slow compared to printing plain text. This is a problem because I want the game to be browser-based. However the chessboard setup should be helpful for telling (eg) if two creatures are on the same diagonal.
Is there a faster way to get the same effect I've got here?
[php] printing a chessboard-like dungeon.
-
Age of Fable
- Posts: 54
- Joined: Fri Feb 19, 2010 6:37 am
[php] printing a chessboard-like dungeon.
Last edited by Age of Fable on Sun Oct 03, 2010 10:21 pm, edited 1 time in total.
Easy to play - hard to survive. http://www.ageoffable.net
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: [php] printing a chessboard-like dungeon.
yes, first off you are using tables..that is tooo many.
Look at my javascript/ajax tutorials. I have a way of build 100's of divs very fast and it assigns each div a tag. For mine they are 30 across.
So I know
to the left of current div is -1
to the right is +1
up on is -30
down one is +30
so if I want to check to see if the diagonal div up and to the left of my player i do a simple
http://indie-resource.com/forums/viewto ... =26&t=2283
Look at my javascript/ajax tutorials. I have a way of build 100's of divs very fast and it assigns each div a tag. For mine they are 30 across.
So I know
to the left of current div is -1
to the right is +1
up on is -30
down one is +30
so if I want to check to see if the diagonal div up and to the left of my player i do a simple
Code: Select all
$checkdiv = playerdiv - 31;
if($checkdiv = $monster)
{
do this!
}http://indie-resource.com/forums/viewto ... =26&t=2283
-
Age of Fable
- Posts: 54
- Joined: Fri Feb 19, 2010 6:37 am
Re: [php] printing a chessboard-like dungeon.
Which one/s do I need to look at?
Easy to play - hard to survive. http://www.ageoffable.net
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm