How do I create StarMap?

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I would like to make a starmap like the one shown in this video (3m 21s):

    https://youtu.be/GTajTg2IQOE?t=3m21s

    I have made simple maps that have nodes connected together, but nothing like what is shown in the video.

    To sum up what I am having trouble wrapping my mind around:

    -Spawning nodes and creating "connections" using lines

    -Making the next set of nodes appear to be "far away" using a zooming effect

    -Choosing which direction/lane to go in

    I appreciate any help/guidance I can get.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The Q3D plugin is designed to do things like this directly. Just place some stars in 3D space, set the camera to "perspective" mode, and animate the motion of the camera to get the desired effect.

  • You can do it with some minimal math. Basically you take 3d points x,y,z and project it to the screen with:

    screenx=x/z

    screeny=y/z

    size=1/z

    If the perspective is too severe you can scale it with:

    screenx=scale*x/z

    screeny=scale*y/z

    size=scale/z

    The camera is at 0,0,0 but if you want to move it around you can also do this:

    screenx=scale*(x-camerax)/(z-cameraz)

    screeny=scale*(y-cameray)/(z-cameraz)

    size=scale/(z-cameraz)

    you can also hide anything behind the camera by seeing if scale/(z-cameraz)<0 for each object.

    lines are done by taking two points and using lerp to find the in between positions.

    https://www.dropbox.com/s/5fser7xtmov44 ... .capx?dl=1

  • You can do it with some minimal math. Basically you take 3d points x,y,z and project it to the screen with:

    screenx=x/z

    screeny=y/z

    size=1/z

    If the perspective is too severe you can scale it with:

    screenx=scale*x/z

    screeny=scale*y/z

    size=scale/z

    The camera is at 0,0,0 but if you want to move it around you can also do this:

    screenx=scale*(x-camerax)/(z-cameraz)

    screeny=scale*(y-cameray)/(z-cameraz)

    size=scale/(z-cameraz)

    you can also hide anything behind the camera by seeing if scale/(z-cameraz)<0 for each object.

    lines are done by taking two points and using lerp to find the in between positions.

    https://www.dropbox.com/s/5fser7xtmov44 ... .capx?dl=1

    Thank you, this was very helpful.

    I was able to make a very basic/linear node generator after figuring out how your example worked: https://www.dropbox.com/s/w5m8q3fyw97fg ... .capx?dl=0

    The method I used to focus on the next node is not perfect but it works for now. My biggest concern now is how I will generate different paths and allow the player to choose which path to take.

    The goal is to make it branch out like the sector map in FTL (shown below)

    I will experiment some more to try and find an efficient way to accomplish this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)