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.

Work in Progress / Asteroids on a Hypersphere

Author
Message
Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 20th Mar 2010 03:26 Edited at: 26th Mar 2010 23:34
A continuation of this project I put in code snippets some time ago that has since become locked. If you posted something there before I had chance to reply: thanks. I had a break from coding. Resumed this a few weeks ago. Hopefully will be done in about a week.

A picture:



What is this?

It's 3D asteroids, but with a twist: instead of being in "flat" 3D space, it's on the surface of a "hypersphere" in 4 dimensions. This means is that it feels like 3D, but if you fly in a straight line, you come back to where you started.

Why did I do this?

For the technical challenge. The game isn't really intended to be much fun. Just a cool thing.

To do list as of 26th March:



Current code, as of 20th March:
(NB this is very messy! I only put it here because if I don't and my hard drive melts tonight, that will be extra annoying. I plan to make this tidier, better commented and give some explanatory documentation, should anyone wish to make any games with this wierd geometry! )


edit: wrong code! here's the main project



JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 20th Mar 2010 12:45
Very cool. I remember you working on this, seems like last year? Hopefully you haven't given up on your shooter project as well.

Glad your back and good luck.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 21st Mar 2010 04:23 Edited at: 21st Mar 2010 04:26
Thanks dude. It has been indeed a year since I first started the hypersphere project. Time flies!

Haven't given up on Badass Spaceship. I just like to take a break and do other things when I feel uninspired. Am learning a few tricks with this present project that hopefully will come in useful.

For instance, my next job is working on polygon collision, using DBP's intersect object command. In my previous projects, i use simple primitive collision shapes- like boxes and spheres. Maybe this will lead to more artistic freedom in Badass Spaceship.

When this project's done, I may work on Asteroid Worlds again (using a few things i've learned), as that is a relatively small project. Also I have this idea to make spherical portals/ magic mirrors, inspired by this hypersphere thing. In my head it's going to be really cool, and i'm itching to bash it in and get it working. Maybe next week if I don't get lazy! After that maybe the spaceship game might get a v1.0 like i've been promising since (Duke Nukem) forever. And then there's my 2 player tank game I want to make online, the car sim, the flight sim, and I want to make a fighting game too.

Thanks for the encouragement.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 21st Mar 2010 13:52
You sound like me. My project folder has 30+ project folders, 15 started, 3 finished.

If you need any help with media, drop me an email.

Anyway took a look at the code and I think I get it, though upon compiling, no media.

(on a side note, I wish you were able to rightclick inside code boxes and select all...)


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 22nd Mar 2010 04:12
Finishing projects is hard. I'll give this one a quick tidyup and upload it tomorrow so you can compile and play.

Today got polygon collision working for shots. Still needs some work.

Don't really need any more media for this project, although maybe I could use some more asteroids at some point. I'll take you up on the media offer when I return to another project though.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 22nd Mar 2010 08:20



Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 22nd Mar 2010 19:54 Edited at: 22nd Mar 2010 19:56
Pretty much finished the shot/asteroid collsion system. Could make it a bit better, but it's as good as is required. Time for a break!

I attach my current project. Controls are in the readme.

edit: I am stupid! unlisted controls: w = shoot, q= drop shot

Attachments

Login to view attachments
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 22nd Mar 2010 21:27
downloading....1700mb?? ...hmm...


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 22nd Mar 2010 21:36
1700kB. 1700MB would be a lot.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 22nd Mar 2010 21:50 Edited at: 22nd Mar 2010 21:51
Chrome acting up.

Very cool. Watching objects bend around you was crazy. if you align yourself just right on the three axis lines, the way they bent around you as you move was fun to watch.

I want to see moving objects in this now, weapon fire, some enemies, lasers...:S lasers...

Only thing I'd do is maybe increase the hyper sphere's size a bit more.

Great stuff. If you plan on making a mini game with this let me know what you need and I can put some stuff together for you.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 22nd Mar 2010 22:30
Thanks dude. I intend to make the player slower, maybe the asteroids smaller, so the space will effectively be bigger. Making stuff move is next on the agenda. If this goes quick maybe i'll add in some spaceships and stuff. Or maybe some asteroids that break into smaller ones. Maybe you could make something for this then, but for now I'll try to finish this.

I had a bash at making a model for the player ship.



It's sort of based on a visualisation of a hypercube, or "tesseract", and also a bit like a babylon 5 spaceship, or Ullysses 31's spaceship. Actually it's kind of similar to Badass Spaceship X, but more symmetric. My modelling skills are balls though. I want it to look more "organic", or complicated or something. Would be cool to have enemy ships and stuff too, but i only have so much time. We'll see how it goes! Maybe i'll try making some concept doodles, or mashing something up in DoGA. Maybe i can't be bothered and would just like some cool models. Not sure yet.

Checking out your 100 models thread, some of the RTS style units look just right for my shooter game.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 23rd Mar 2010 00:21 Edited at: 23rd Mar 2010 00:24
Very cool. Yah if you need exclusive original models, I've been pumping out media like crazy lately. Life is going better so I have more motivation then usual.

Good luck with whatever route you go.

edit: Hmm..just thought of something crazy...could this be applied to a game level built by equal sized segments? *insert Twilight Zone theme*


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 23rd Mar 2010 04:59 Edited at: 23rd Mar 2010 05:09
Quote: "Very cool. Yah if you need exclusive original models, I've been pumping out media like crazy lately. Life is going better so I have more motivation then usual.
"

Glad to hear it.

Quote: "Hmm..just thought of something crazy...could this be applied to a game level built by equal sized segments? *insert Twilight Zone theme*"

Yes and no. Mostly no. You can divide the space into equal segments, but only of very specific sizes. It's like how you can cover a sphere with a number of pentagons, triangles, or squares. Or you could cut it up into slices. However, if you tried to stick little squares onto a globe to form a grid, like you would on a flat surface, the curvature would soon mess it up.

You can break a hypersphere up into 600 tetrahedral cells apparently. So you could have modular models that fit these cells i guess. However, with my current system, I only scale and position the models. This is a sort of small angle approximation, and is only true to first order or something. Basically, your consecutive cells would not match up right. I can get away with the approximation only because there is no obvious regularity in a world of irregularly placed, irregularly shaped asteroids.

So basically no. You can project a "hypercube" to cover the hypersphere though, in the same way you can project a cube onto a sphere, giving you 6 "square" regions. Instead you get 8 "cube" volumes. This way you can break space up by a 3d grid in each. However, you can't really fill this space with modular parts (unless you scale and shear them) because the grid is warped.

In short this whole thing isn't really that useful for much.

BTW it'd be totally awesome to be able to shear and perform perspective tranformations on objects in DBP, without recourse to (slowish) vertex commands. Like with a "scale object" style command. I know you can scale, then remake meshes, rotate and that to get a shear, but that's slow too. I wonder if there's another way.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 23rd Mar 2010 08:53
I get what your saying...too bad, could make for crazy puzzlers.

Quote: "BTW it'd be totally awesome to be able to shear and perform perspective tranformations on objects in DBP, without recourse to (slowish) vertex commands. "


I'd also like to see objects actually 'bend' and 'skew' around the player. I wonder if it's possible through memblocks? I've seen mesh warping in DBP before, though I'd be lost as to how to implement it here.


Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Mar 2010 12:03
Could you perhaps post an executable with media?
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 23rd Mar 2010 18:10
He did. Look up a few posts.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 23rd Mar 2010 18:32 Edited at: 23rd Mar 2010 20:13
Quote: "I'd also like to see objects actually 'bend' and 'skew' around the player. I wonder if it's possible through memblocks? I've seen mesh warping in DBP before, though I'd be lost as to how to implement it here."

You can do it with the vertexdata commands, which is faster than memblocks. However, it's still kind of slow. Maybe with a modern computer it wouldn't be an issue though.

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 24th Mar 2010 04:21
Did some menial coding today. Tidying. Bits and bobs. Boring but it's closer to completion now.

If you're trying the .exe - i forgot to cap the framerate! It may be totally stupid if you have a fast comp. uncomment sync rate 100.

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 25th Mar 2010 02:18 Edited at: 25th Mar 2010 06:25
The asteroids move now. Looks pretty cool. Think the game might be fairly fun after all! You don't need eyes in the back of your head, because if you keep moving forward(assuming there aren't any really fast asteroids, which there will be if i put in proper collisions), you only have to avoid stuff you can see, and it's more frentic and fun than I had expected!

Still need to make them spin and collide. Many small fixes to do. Have fixed some unexpected things, but new ones keep popping up! That's coding i guess.

I have a feeling the "simple billiard ball" collisions are going to be a massive pain in the a-hole. Ho hum. Time for bed.

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 25th Mar 2010 19:18 Edited at: 26th Mar 2010 03:37
Sleep must be good for the mind!

After waking, 5 minutes was all it took. I have in my hand a piece of paper, and on it is how i'm going to do the collsions. A lot more trivial than i'd thought. Will be typing it in this evening. Hope it works OK. If it does, i'm pretty much done with this.

edit: asteroids bounce off eachother now! only modelled as simple spheres. works well enough. May make an imporved version with proper polygon collsions, rotational momentum etc later.

Basically i need to tidy it up now and it's pretty much done.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 26th Mar 2010 07:55
Very cool, can't wait to see it in action.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 27th Mar 2010 02:31 Edited at: 27th Mar 2010 02:33
Thanks dude. I chucked a vid on Youtube so you can see.

here

loads of little tedious things to sort out. Big thing will be making the asteroids explode and at the same time have it not look rubbish. Also there's no player collision, no game over, and no reset yet. Loads of the things on the "i can skip this" part of the to do list I want to put in. I'll try to do something to this regularly, but am going to start another project. Am I not wicked?

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 28th Mar 2010 05:05
It looks good in action. Just thinking of how this would make a good 3d-hyper-asteroid game. Needs some enemies as well.

So what's this new project? *curiosity*


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 29th Mar 2010 03:25 Edited at: 29th Mar 2010 03:26
Thanks dude.

Since you asked, the new thing i'm doing is a kind of portal thing. I got the idea doing this. Imagine if you had a flat space represented by a piece of paper, then folded that paper, hole-punched through the two halves, and the stuck the holes together, sort of with a wormhole. Then do that in 3D.

Basically it's going to be very much like having two reflective globes, but the reflection seen in globe 1 is of where globe 2 is, and vice versa. At distance, the "relection" will look very "fisheye" like, then as you get closer, it will appear flatter and flatter, and you can fly "into" the magic mirror ball and then fly out of the other one.

I plan to do this with cube maps. It requires that I render 6 cameras (per visible portal) to images before the main cam, so it might be a bit slow, although most of these images can be low resolution. These cameras are positioned "inside" the sphere (although not at the centre - at the "focus") Then I have a special object for the sphere with these 6 textures. The uv data is fixed and I move the vertices using vertexdata commands.

The maths is hella trickier than i thought, but it seems there's loads of how to stuff for reflection mapping on the internet, so i should be able to suss it out with the aid of that. It's not going to be easy but it should end up totally awesome!

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 29th Mar 2010 05:54
Wasn't that Einsteins theory of object mass bending space time? I swear I've heard of that same scenario you've described in a movie too...maybe 'Blackhole' or another one, or was it 'Wing Commander'?

Sounds wicked anyway. Good luck.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 30th Mar 2010 07:06
Yeah general relativity is about bending space and time. Einstein's one up on me because I don't do anything with time. I'll have a look out for those movies.

Got that portal thing working! It's pretty sweet. Still needs stuff done to it. Might post a vid tomorrow.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 30th Mar 2010 08:08 Edited at: 30th Mar 2010 08:12
I found it! I knew the movie I was thinking about had Laurence Fishburne and Sam Neill in it, I just couldn't remember the name of it. It was called Event Horizon, and it was one of those few movies where their science actually made sense.

Here's the wiki.

It's a great movie if you ever get a chance to rent it.

I want to see a video of yours as well. Sounds like fun to program.

Edit: Just added it to my Netflix queue, I remember it being a good watch.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 1st Apr 2010 00:31
Think I saw that once. Not sure whether I liked it. Seem to remember a disturbing bit with bleeding eyes or something.

Anyway here is a video of the portal thing. I'll post a new topic in a bit, with code and screenies etc.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 1st Apr 2010 02:22
@Dr Tank

That was a weird experience... It ran at 136 fps, but I found a place on the hypersphere where it would drop to 32 fps, not quite sure what's going on... But this is a cool project, keep it up!

I looked at that spherical portal thing, and I am amazed! Great job there too!

TheComet

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 1st Apr 2010 04:15 Edited at: 1st Apr 2010 04:15
Thanks dude. Curious about that bug. I should put more debug info in demos in future, then you could post co-ordinates. Ho hum. Project is still a bit messy. Hopefully it'll get fixed as i clear it up.

Glad to hear you like the portals thing. Here's its topic.

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 15th May 2010 01:35 Edited at: 15th May 2010 01:37
Been playing with this again. Experimenting with using a shader to render the objects.

I now have perspective transformation on objects. Means that were you located at the "north pole" of the hypersphere, objects near you would have regular perspective, objects on the equator are viewed with orthographic persepective, and objects in the southern hemisphere have kind of reversed perspective. Check out the video.

Imagine a 2D sphere, with you standing on the north pole. Now imagine looking down straight at the north pole from space, so you see a 2D projection of the world. Any objects are positioned and scaled in this 2D space. so objects on the equator are squashed flat, and objects at the south pole are at the same place as objects on the north pole. This is how correct perspective rendering is achieved, along with correct texture mapping.

However, were you to do this in standard DBP, it would screw up depth mapping, drawing objects at the south pole in front of those at the equator, and inside out. My shader method draws to the depth map separately.

Without diagrams that probably makes next to no sense. Here's the shader code anyway. Vertex shader does most of the work. Would be much much shorter if I could find a way to send custom 4x4 matrices per object to the shader. I realise I could have separate shaders/techniques for every object but that would be too inelegant to bear!

I realise the depth is very crude. I know how to make it better on paper, but have yet to implement it.

JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 15th May 2010 15:19
0.o

Very cool perspective change. Can't wait to see more.


Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 16th May 2010 02:44
Thanks dude. This is sort of a backburner project. Trying to keep it bumped frequently enough to not incur a lock, but no real hurry. I'll play with it when I feel like it.

Login to post a reply

Server time is: 2024-05-01 22:49:21
Your offset time is: 2024-05-01 22:49:21