Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / 3D maze with sprites (I think I just peed my pants)

Author
Message
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 2nd Apr 2011 23:43
Quote: "why not both?"

voxels are extremely cool !
But i think you have to master a simple raycast engine before you try it as it uses alot of raycasting.

Quote: "I've updated v0.02 because the mouse movement was horrible on some computers. - It should run fine everywhere now."

I found an note that you have to scale the columns wit specific numbers for the fov formula to work ok!
Its a bit weird for me now with some objects far away on the sides!
cube size/distance*277 etc.
Iam going to try it and see wath happens?
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 3rd Apr 2011 00:48
Quote: "[quote]"I've updated v0.02 because the mouse movement was horrible on some computers. - It should run fine everywhere now.""

I found an note that you have to scale the columns wit specific numbers for the fov formula to work ok!
Its a bit weird for me now with some objects far away on the sides!
cube size/distance*277 etc.
Iam going to try it and see wath happens?[/quote]

What? - You said stuff that didn't relate to the quote. xD



Anyway! - I've been working on enemies for Activation and finally gotten a point-to-point raycasting method in my engine now!

Should have some more intense gameplay soon (v0.03)

! <3 2D3D

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 3rd Apr 2011 02:20
Quote: "What? - You said stuff that didn't relate to the quote. xD"

iam tired
Got some awesome scale drawing on the wall segments!
But then an huge fisheye effect
Will have to look at it again tomorrow.
terrible complicated to get everything to work together!
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 4th Apr 2011 20:37
@ Cliff Mellangard 3DEGS
I still can't get texturing figured out. xD - That's my only real concern (that and possibly billboards clipping walls when they're near the edge).

@ Everyone


Activation: (v0.03)


Controls:
WASD/Arrowkeys - Move
Mouse - Look
I took crouching out because it was silly
Shift - Sprint

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 5th Apr 2011 01:40
Looks a like darwinia got an fps baby
In an good way that is .
Cheers.
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Apr 2011 02:09 Edited at: 5th Apr 2011 15:47
xD I recorded the sounds for an ogre then needed an ogre looking enemy so I just stole a sprite from one of my old games and touched it up a bit. - It wasn't supposed to be copying Darwinia.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 7th Apr 2011 02:47 Edited at: 7th Apr 2011 02:47
For anyone who's interested, I've made the start to a voxel engine but due to performance issues will probably leave it alone.

Here's a link incase you want to try it for yourself.

I can get my FPS to stay above 66 but for some reason the engine has random spikes that cause it to be silly. - And other people can't get FPSs above 30 so it's not really a worthwhile venture.

PrimalBeans
13
Years of Service
User Offline
Joined: 14th Oct 2010
Location: The sewer.... hunting alligatiors.
Posted: 7th Apr 2011 09:54
well i think the first part of learing to texture somthing like this is to learn how to slice and image up vertically and scale textures.. what i would do to learn this kind of proramming is invest in the game programming gurus book series for learning a ray casting engine inside and out... im sure its one of the earlier ones cuase i used to own one and im older the the usual forum goer. I would even just google 2.5d ray caster to help you out if you dont have money to order a book. Im even under the impression that doom source is available and you could look at that to learn as well.. just search.

Stormwire
13
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 29th May 2011 22:01 Edited at: 30th May 2011 02:28
Any chance of someone doing a tutorial on this for some of us newbies?

EDIT: http://tigcc.ticalc.org/tut/raycasting.html

Just found one
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Aug 2011 01:45 Edited at: 5th Aug 2011 03:57
Well, I just peed my pants again.

This time I made a voxel engine. !

Can you guess what inspired this particular application?



!

To experience this for yourself you can download my ridiculous little app here:

WASD & mouse to move and look.
Left-mouse to dig.
Shift to sprint.
Looking directly up or down causes stretched voxels and confuses the engine so it looks horrible for the moment. - I'll try and sort it one day.
Press F1 to toggle between normal detail and double detail. (Just performs twice as many raycasts in both directions - this causes my FPS to drop below 66 so I've got it on toggle for when I want to take a picture or something. )
Press X to free the mouse.


Attachments

Login to view attachments
Stormwire
13
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 5th Aug 2011 02:28 Edited at: 5th Aug 2011 02:30
@C0wbox Sweet!!! I love this thread. It really shows the strengths of DBP and its skilled community Oh and JavaXD
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Aug 2011 02:37
xD I wouldn't trust DBP to do this - it's struggling to make 60+FPS with 2400 raycasts in Java, let alone DBP. D:

Although, in DBP I'd have a cleaner way of doing it because I could use the draw commands rather than the sprites I'm using in Slick2D.

Insert Name Here
17
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 5th Aug 2011 02:41
That's one of the coolest things I've seen in a while... although I admit it did confuse me quite a lot as to which way I was travelling!

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Aug 2011 03:13 Edited at: 5th Aug 2011 03:58
! Thanks, I was quite impressed with it when things started working a little earlier too. !

I know, it's a little disorientating when your digging around down there and you get stuck tryna find the way back or something.

Hopefully when I sort out some better lighting and the looking straight up/down problems it'll flow a little better.



First though if anyone reading this thinks they know a better way to raycast from 1 point in a 3D matrix at an angle in the matrix to find the first collision point that doesn't involve using a for loop to test each square along a line, please tell me. - I'm desperately looking for a faster way to do my raycasts. - My PC struggles when I switch it to high detail mode because 2400 for loops all of about 500 odd lines each (i.e. 1200000 lines of code) tends to slow my PC down a little bit.

I know there's a way to do the intersection of a line to a plane, but this would be the intersection of a line to a point. (And those points can be thought of as filling space so they'd almost become boxes.)



EDIT:
Wow, I just gained like 5FPS on high-detail mode by pre-calculating the value of pi/180 for all the conversions from degrees to radians the math's library requires you to use.

Still don't know how to solve this looking down problem. - It seems when you're looking directly down, you're actually looking at 45 degrees because all holes you dig will be diagonal; it just seems to stretch the last voxels so you can't see what's directly underneath you.

For anyone wishing to see the code I'm using for raycasts in order to help with this problem, or the one further up about more efficient raycasts, here's the raycasting method I'm using to do all the rendering:


Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Aug 2011 17:04
Is radVal = pi/180?
Sorry I don't understand this line testing=bsp[castx][casty][castz];

One way you could speed things up is to pre-calculate sin and cos and store them in an array.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Aug 2011 18:06 Edited at: 5th Aug 2011 18:14
@ OBese87
Yeah, radVal is pi/180.

The line testing=bsp[castx][casty][castz]; is basically just storing the value in the array so I'm not constantly grabbing it from the array whenever I want to check what number it is.

The values range from things like 0 for nothing, to 1 for grass, 2 for dirt, 4 for bedrock. Etc. (It checks if testing is above 0 just to make sure it needs to draw a voxel otherwise it carries on casting the ray.)

I'm not sure how I'd pre-calculate sin and cos. :S - I thought they were functions, not values.

(I'd love to do that though, it'd speed everything up 10-fold. xD)


EDIT:
Just got told how the pre-calculated sin/cos array thing works. - Never thought of doing it before.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Aug 2011 19:29 Edited at: 5th Aug 2011 20:08
New version with new features and some performance improvements. !






There are 3 tools, which can be cycled through with the mousewheel, spade - for diggy diggy holes, torch - for placing lights and paintbrush - for drawing pink voxels everywhere.

Left click to use whichever tool is selected.

Main performance increase is storing sin and cos values in arrays which gave me another 5 to 10FPS looking at the sky and ~30+FPS when looking at normal things. - Which is good.

Attachments

Login to view attachments
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 5th Aug 2011 21:17
MAN that's funky O_o

My eyes hurt after playing that.

Also... nothing requires you to convert degrees to radians. Differing conventions do. Just use radians all around.


Why does blue text appear every time you are near?
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 5th Aug 2011 21:23 Edited at: 5th Aug 2011 21:25


After deving on this for such about 5 hours today and all last night, everything I see has squarey undertones. xD - Even plain white spaces look like they're broken into squares.

Yeah I would use radians if I could get my head around it. - They make sense and all I've just used degrees for so long it's almost second nature.

You know, I think of forward being 0, left being -90, right being 90 etc.

To use factors of PI in my code would require division and stuff.

It's a lot easier to do strafing code when you're just adding 90 degrees to the forward movement rather than some sillyly long decimal number.

...in my opinion.

Quik
15
Years of Service
User Offline
Joined: 3rd Jul 2008
Location: Equestria!
Posted: 5th Aug 2011 21:54
really cool xD still prefer minecraft ofc, but i find it rather much very cool ^^

and for the record, I am a man.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 6th Aug 2011 04:39
Just thought I'd let people see the video I made on Voxeng2 for those of you who don't like downloading/playing applications made here.



The video description gives more detail as to what I intend to do with this:
It's not exactly hard to tell what inspired the functionality in this showcase but I've recently been playing around with voxels purely because I can't work out how to get a decent 3D engine to work in Java.

As it is, this engine needs a faster raycasting algorithm (I'm using for-loop iteration in a direction in place of vector maths) and needs the viewing fixed to represent true3D - if you look directly up or down the camera goes all weird.

If this was to become anything like a game I'd probably tone it down a bit and reduce some of the freedom in terms of level of detail and make things more chunk based so as to allow unlimited worlds. - At the moment, each sector (the size of the map shown here) requires at least 128mb to be stored so you'd quickly clog up your hard drive playing this.

For now I intend to keep it to one map and allow the user to mine minerals (which will be given in quantities representative of how many voxels of a mineral are collected) and to build things. - I've experimented with placing voxels but not to any constructive sense.


C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 11th Aug 2011 04:18 Edited at: 11th Aug 2011 04:31
New version with lava, rain, hills, randomized trees and caves. !

Lava working


Old hill generation


Tree placement algorithm failing (Occasionally trees can be placed underground so it's still not perfect xD)


After recolouration and adding the first rain


Once I'd gotten rain working awesomely



Same 3 tools, scroll the mousewheel to change em.
Left click to use whichever tool is selected.

It's set to use high detail mode just because I always ended up pressing F1 to change it to that anyway. - If it runs slowly, press F1 and put up with the horrible appearance. xD

Attachments

Login to view attachments
Stormwire
13
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 11th Aug 2011 05:41
Very nice! Is there a end goal to this? It would be fun to play game game on this engine.
Ocho Geek
16
Years of Service
User Offline
Joined: 16th Aug 2007
Location: Manchester, UK
Posted: 11th Aug 2011 15:08
Very nice, perhaps you would consider changing the fading colour to light blue to simulate fog?


Not Spanish, Not Eight, Just Ocho

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 11th Aug 2011 23:13
Hmm the only trouble with that is that it'd not look all dark in the caves.

I'd need a quick way to tell for each voxel whether it's outside (exposed to the sky) or inside (underground).

Ocho Geek
16
Years of Service
User Offline
Joined: 16th Aug 2007
Location: Manchester, UK
Posted: 12th Aug 2011 00:02
ah

this is almost certainly impossible, but you could change the fog colour in areas surrounded by rock voxels


Not Spanish, Not Eight, Just Ocho

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 12th Aug 2011 13:32
I might just change it to be black below a certain level and fog coloured above it. xD

Ocho Geek
16
Years of Service
User Offline
Joined: 16th Aug 2007
Location: Manchester, UK
Posted: 12th Aug 2011 13:41
it's a temporary measure if you want to have variable altitude, but yeah it would work


Not Spanish, Not Eight, Just Ocho

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Aug 2011 13:49
Tested it, and here's my feedback:

Cons

-I get stuck easily
-It's hard to tell how big you are and how fast you're moving
-It's hard to tell how big the world is... I thought I dug a huge cave, but it turned out to be smaller than a tree.
-It would be much better if the character moved up if you pressed the spacebar, no matter where you are currently looking.
-What is that pink torch tool?

Pros

-Very impressive considering what it is
-Lighting with torches was awesome

TheComet

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 12th Aug 2011 16:24 Edited at: 12th Aug 2011 16:26
@ TheComet
The first 2 cons are to do with the fact that I haven't actually given it a proper FPS engine (like Minecraft has) this is planned soon, so you'll have a certain size hole you can fall down and won't be able get stuck in walls.

The reason you can do this at the moment is because the camera only fills one voxel space, so you can get stuck behind them very easily. xD (I just avoid the walls/floor when I'm testing it for the moment.)

The size of the world is deceptive mainly due to the 3D maths I'm using. - I've received feedback on the latest video I uploaded explaining how to do it better, so hopefully this will sort itself out.

Space will later be reserved for jump. - I might make it (and control) used for changing altitude in these flying-mode versions for a bit though until I change it to FPS.

The pink paint brush is just for drawing on the floor. - No good reason, sjust a bit of fun.

Hah, I'm surprised the torch lighting isn't in cons too. xD - It goes through voxels, doesn't fade properly between chunks and is calculated based on the centre of each chunk too. D:

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Aug 2011 16:44
Quote: "Hah, I'm surprised the torch lighting isn't in cons too. xD - It goes through voxels, doesn't fade properly between chunks and is calculated based on the centre of each chunk too. D:"


Heh, well I needed at least 2 pros to make it an official "constructive feedback" post The torches are in the PROs because this was my reaction:

"hmm, what does this yellow tool do?"

*places torch*

"OMG IT GLOWS!! "

TheComet

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 12th Aug 2011 17:43
@ TheComet
xD!

Yeah, they are kinda funky and definitely made it feel a bit more professional when I first got them working but in all honesty, they're really bad lights actually. xD

@ Ocho Geek
I just thought at work of a better way of doing it, that even Minecraft uses:
Per-player fog.

I determine whether the player is underground or overground (logistically much simpler than checking all the voxels one can see) and change what colour the fog is according to that.

Might even make a lava-layer of fog too.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 23rd Aug 2011 20:59
Just thought I'd share this here:


This is the precursor to Voxeng (the IMBad/Activation engine) but I finally got texturing sorted out. (Only took me like half a year.)

And on a side note, I decided to use some of Notch's sprites for the enemies just for lols. xD (From his 48hour game Prelude of the Chambered)

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 25th Aug 2011 04:58 Edited at: 25th Aug 2011 05:07
Ok I've stopped faffing around doing nothing and decided to actually make a proper game with proper texturing and proper enemies, more in keeping with the original theme Cliff Mellangard 3DEGS and I set between this thread and his on the WIP board.


(Inspired by Notch's Prelude of the Chambered)



Gauntlet of the King v0.01:

Artwork, sounds & coding by me
Music by Blobby 101

Things you will notice I can't actually do properly:
* Sprites
* Floor/ceiling textures
* Smooth collision
(Being able to project sprites independently to the raycasting engine would greatly improve the overall appearance as objects and enemies wouldn't start flashing as you get further from them. Unfortunately I don't know the maths required to project something on a 2D panel from a 3D point and a camera. D: )


Attachments

Login to view attachments
Stormwire
13
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 25th Aug 2011 11:23
Very impressive. Is there only one level? I was looking for a way out but couldn't find one There are 2 keys and only one door so I am thinking I must keep missing the exit. Runs very smooth on my comp!
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 25th Aug 2011 17:28
xD Well, there are at least 3 doors in the level, and 3 keys dotted around, so you must have missed a corridor somewhere.

Ocho Geek
16
Years of Service
User Offline
Joined: 16th Aug 2007
Location: Manchester, UK
Posted: 26th Aug 2011 20:24
I had fun with it


Not Spanish, Not Eight, Just Ocho

Login to post a reply

Server time is: 2024-05-04 01:02:26
Your offset time is: 2024-05-04 01:02:26