Pseudo 3D Starfield

crystalnoir

  • *
  • Posts: 50
Hi everyone,

I have created (translated is the word) one of my code and routine in Stencyl. This is a pseudo 3D Starfield.

The aim of this, is to simulate a 3D starfield in a 2D World coordinate. It could be useful for a space game for example.

To make the effect we create a set of stars and with math calculations, we simulate a "fake z coordinate". With this method, we can make the player "believe" in a 3D starfield, with a fake depth.

I'm cleaning up the code for now, I will share it as a kit when it will be clear. However, you can see the effect by clicking the link below (dropbox upload), this a demo to let you see the effect :)

Click to see the 3D Stars Demo

Thank you !
I'm not english, so please excuse me if I make some mistakes :)

crystalnoir

  • *
  • Posts: 50
I have added some comments to the code, and I have published it as a Kit in the StencylForge. Public domain, you can do what you want with it  :)
I'm not english, so please excuse me if I make some mistakes :)

ipe 369

  • Posts: 1001
You should add steering
Not like, stopping and starting, 3d world stuff, simple stuff, just move the stars differently when you press a key

crystalnoir

  • *
  • Posts: 50
Yes this can be done :) But in this way, you are completly free to add what you want : moving pressing a key or with mouse movement, or later why not with virtual joy etc...

That's why I have let this as it is. In fact it depends what do you want to do with it :)
I'm not english, so please excuse me if I make some mistakes :)

ipe 369

  • Posts: 1001
Might try something with it later...

ipe 369

  • Posts: 1001
wait are the stars actors?

crystalnoir

  • *
  • Posts: 50
Stars are in fact a very small image (4x4) that's why it seems that there are no actor when you click the stars actor, but there are.

Or may be I don't understand your question ?

Thank's Ozygiygas :)
I'm not english, so please excuse me if I make some mistakes :)

ipe 369

  • Posts: 1001
No i haven't downloaded it, just wondering if you'd created actors. I'll probably do another version of this where you draw the pixels manually, because having this many actors is sure to slow larger or more complex scenes down a bit

Sorry if that came across a little poncy, i just dislike having to ask people for free work done... XD

« Last Edit: November 27, 2012, 08:25:45 am by ipe 369 »

crystalnoir

  • *
  • Posts: 50
In fact we have actors yes, but there are always the same. I create 150 actors but when they reach a special position they return to the "initial random position". In this way there aren't more stars actors in the scene.

We can draw manualy a pixel or two with the same way in fact , if we want to instead of using actors.
I'm not english, so please excuse me if I make some mistakes :)

ipe 369

  • Posts: 1001
Yeah, you can, if you have it as 1 actor it's a lot faster. Because of stencyl, even if you set your actors to no collisions, box2d is still doing a load in the background with physics even if you set it not to, it'll still be calculating inertia or something, along with stencyl's processes running too. If you just have one actor and draw it all manually, you can avoid all of that. I think in stencyl 3.0 they've got a button which completely toggles off box2d, making processes like these much faster.