dMZX Forums: Raycasting Engine - dMZX Forums

Jump to content

Message from the Management

When you finish a new game, demo, engine, or utility, the first thing to do is submit it to the archive for approval. (Log in first, then Upload a New Game from the sidebar.) Then feel free to post about it in this forum; in fact, please continue to do this. This is so people will actually know about your game and play it. As nice as it is to have archive uploads automated, it's not going to help much if no one knows you have a new game to play.

When uploading your games to the archive, please zip up your game using the .ZIP format, even if it is just a .MZX file. As for less popular formats (such as RAR and 7Z), games uploaded in these formats will be rejected. This is because as wonderful as those compression algorithms might be, ZIP is a near universal compression standard, and the only one that will work with the in-game archive browser planned for MZX.

You can also attach your game to a new thread in this forum. In this case, you can use whatever compression format you find suitable. NOTE: Games posted this way won't be put into the archive unless submitted to the archive proper, or unless the author states he/she wants the game in.

Lastly, we suggest you post a suitable screenshot of your submission (in PNG format) along with the game.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Raycasting Engine

#1 User is offline   mikawo 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 35
  • Joined: 09-December 02

Posted 12 December 2002 - 05:38 PM

I recently read a post about attempting a raycasting engine in MZX, so I decided to use what other people already knew to make my own and this is what I came up with. It raycasts and it even renders except it looks very bad and is very slow. Also, I resolved a few problems by hacks, maybe someone can think of better ways to do some of the things. I didn't finish camera controls so basically you can just move it using 'e' for forward and 'd' for backwards. Note that the camera's position isn't calculated as it should so you can pretty much move out of bounds. Also 's' and 'f' rotates the camera left and right respectively. After laboring on this for a few hours straight, I think it I'm going to stop working on it. I don't know, maybe someone can tidy it up.

Attached File(s)


0

#2 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 12 December 2002 - 09:35 PM

Alright... now nobody can say its impossible...

There are ways to increase the speed:

1) Increase the COMMANDS counter. It sets the number of commands that are processed per cycle. Default is 40.

2) Use trig tables. Not sure if this would be faster or not, but it would be worth a try.

EDIT: Yeah it's slow... even at speed 1 on a 400Mhz computer! Hmm... I wonder if interleaving would work here... It did with Akwende's landscape voxel thingy.

This post has been edited by Frobozz: 12 December 2002 - 09:51 PM

0

#3 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 12 December 2002 - 10:04 PM

Using trig tables would be.. a lot slower, trust me on this. I don't have MZX on this computer (and can't really get it on this computer) but I'll try it later.. and in the mean time I'll talk to mikawo about how he did it and see if there are any obvious things he can do to make it faster.

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#4 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 12 December 2002 - 10:05 PM

How come you can't get it on that computer? College's computer? If so, just carry it around on a ZIP disk.

Btw, you never use AIM do you?
0

#5 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 12 December 2002 - 10:06 PM

Er, lab computer, I'm working right now.. it's Win2k, and I doubt it has Service Pack 2 installed, and I don't have admin for it so I can't install it, so trying to get MZX working on it is most likely a waste of time.

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#6 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 12 December 2002 - 10:10 PM

Heh... Like I said, carry it around on a disk (you know what a ZIP disk is). Also, I would think admin is only blocking access to the registry. I doubt it would care about a dos program that you put on the computer.

Heh... I can install stuff on my college's computer because the admin stuff can't block it (XP pro rules in that way). Also, I know a friend who can hack the computers apart (he's already done some things, but he never learns how to not get caught at it).
0

#7 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 12 December 2002 - 10:49 PM

Storing it isn't a problem, as I have plenty of space here (I've got an entire drive somewhere), it's that these computers use Win2k w/o SP2 and MZX doesn't work very well on pre-SP2 Win2k, and I can't install a Service Pack w/o having admin rights (of this I'm certain)

BTW, zipdisk? What? I don't have a zipdisk drive and there aren't any here, and I wouldn't waste my money on them. I'd sooner just use a normal disk, it's more than large enough.

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#8 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 12 December 2002 - 11:16 PM

Hmm... you can get a small zipdisk for fairly cheap, but the biggest zip is actually bigger than a CD (It's 750Mb). Normal disks are good enough... and I've actually seen computers that don't come with them.

As for not working good, I would assume it would work well enough to actually see this thing in action. It is fairly impressive, but its a bit difficult to navigate even with COMMANDS set to 400.
0

#9 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 12 December 2002 - 11:26 PM

Exo: I've attached a screenshot of what the raycast looks like.

Attached image(s)

  • Attached Image: post-15-1039735566.gif

0

#10 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 13 December 2002 - 12:03 AM

... that's pretty neat. Can you rotate the view? I'm still waiting for mikawo to come on.

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#11 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 13 December 2002 - 02:33 AM

It does but it's quite slow... you cannot move in any direction except north and south, though.

One other way to make this TONS faster is not to write each individual character... I mean surely you can copy block vertical strips of characters.
0

#12 User is offline   Nanobot 

  • It's in your blood
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,623
  • Joined: 11-October 00
  • Gender:Male
  • Location:Chico, CA (USA)

Posted 13 December 2002 - 02:46 AM

Adding a wait 1 before the loop would help a bit, too.
The Nanobox, where wings take dreams...
0

#13 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 13 December 2002 - 04:30 AM

Wait 1 would help with trying to rotate.

As for speed, set COMMANDS to 400 when it first starts and put speed at 1 and it does fairly well. Anything higher than 400 though isn't very good looking.
0

#14 User is offline   mikawo 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 35
  • Joined: 09-December 02

Posted 14 December 2002 - 11:51 AM

I really hoped that I didn't have to do this myself, but despite what I said about not continuing to work on this engine, I went ahead and did because Frobozz kept telling me that I should. At first I didn't want to do it, but it appears that some people didn't find the one that I posted useful, so here's what I got from working on it. It's so much better than it was before, so take a look! And if you have any questions just PM me. There's probably room for even more improvement, but I don't know if I feel up to it.

Anyway, some interesting counters to tinker with:

multiplier - kinda like zoom...

distance - you can get some nice looking stuff if you set this to 32, but its slower, the minimum recommended is 16 (the greater the number the more colors it uses to define depth) currently set as 20 so it might seem slow

cam_x, cam_y - camera positioning

the if statements after the "current_ray" label can be used to limit how much is rendered as well as the 80 (1 degree for each line on a 80x25 screen) in the "ray_done" label

Well, that's it. Enjoy!

Attached File(s)


0

#15 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 14 December 2002 - 05:45 PM

Okay... I've attached another screen shot to show the difference.

I got tired of those keys and tried to make it use the cursor keys, but they went too slow so its back to the others for a while. It does draw faster and may do quite well on a 2Ghz (I'm using a 400Mhz AMD).

Attached image(s)

  • Attached Image: post-15-1039887912.gif

0

#16 User is offline   mikawo 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 35
  • Joined: 09-December 02

Posted 14 December 2002 - 06:42 PM

If it's running a bit slow, you could set distance below 16. I only stated that as the minimum recommended because it was decent on my 1ghz. If you change the settings to make the lines smaller, it might be faster on the slower processors.
0

#17 User is offline   Revvy 

  • Jeez guys, there's no need to be narky.
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,520
  • Joined: 05-March 01
  • Gender:Male
  • Location:Ontario, Canada

Posted 17 December 2002 - 03:26 PM

Very nice mikawo. I couldn't see what distance did though.
<+AFK> Bringing whisky to my mother is like irrigating a lake.

<+AFK> dormando's apathy is palpable.
* AFK palpates
<dormando> stop that

<Malwyn> undressing with revvy a little over a metre away. new definition of awkward.
0

#18 User is offline   paulguy 

  • No furry sex
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,548
  • Joined: 14-July 02
  • Gender:Male

Posted 19 December 2002 - 06:42 PM

Why are all the walss rounded? It makes it kindof difficult to see where you are going in enclosed spaces.


Why-Fi: but I'M MATURE ENOUGH TO BE A MODERATOR!!!!!!!!!!
0

#19 User is offline   Koji 

  • End
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 6,644
  • Joined: 15-November 01
  • Gender:Not Telling
  • Location:US, NC

Posted 19 December 2002 - 08:07 PM

Thats the down side of using the sin/cos stuff... You need to reduce the distances of the rays as you go further from the cener, You could use another sin or cos function to reduce the distances on the screen as you go away from the cener... bascially the center ray doesn't need to be decreased at all and the far left/right rays need to be decreased a bit... you could use cos 90 for the center and cos 130/cos 50 for the edges. This makes the rays seemingly project from a curved plane (like you're eye/camera/lens) rather than a point (like... Nothing real) Thus giving a more realistic view.

This should be done after calculating the distance the ray had to travel before it collided with a wall... decreasing the distance by dist*cos(ang)... I think...

You may have to toy with it a bit to get it just right, but I don't think it'll take much away from the speed (if you can call that speed) of the overall engine.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users