Nova Imperium - 3D Space 4X being developed in Construct 3

0 favourites
  • 6 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • NOVA IMPERIUM - DEVLOG

    Most recent showcase video:

    Subscribe to Construct videos now

    Major Features Implementated in the latest version:

    - Galaxy Generation

    - Star Systems

    - Stars

    - Planets (last-minute implementation)

    - 3D Camera Control

    - Some Optimization

    OVERVIEW

    First of all I would like to thank Mikal and his/her team for opening up the Construct 3 Engine to new horizons and making something like this possible.

    This Thread will be a sort of Devlog type thing where I will occasionally update this post with the most recent version. The individual devlog Entries will be in the comments.

    Please feel free to leave a comment on what you think or any questions, I really don't want to feel like I'm talking into the void here haha. Any feedback is encouraged and very much appreciated!

    In case you're wondering why I don't have a Construct 3 License badge, it's because I have my construct 3 License tied to my company account, and I prefer posting with my personal account.

  • DEVLOG 1

    Introduction

    This is the first public showcase of the project. It started as a proof-of-concept to explore the feasibility of creating a Space 4X using Contruct 3. With the aim of pushing the boundaries of this engine and take advantage of the streamlined eventing system and ease of use to creating the game logic.

    As I started the first tests, the results showed promise right away, as I was able to get pretty good results very quickly, with much better visual quality than I was initially anticipating.

    The engine also seems to allow much a higher triangle count for 3D objects than I was expecting, which is great plus for graphical fidelity.

    Overview

    Everything you see in the video is generated during runtime. In this version I implemented a procedurally generated Galaxy, Star systems with Stars and Planets.

    - How the Galaxy Generation works

    • I start by creating a galaxy Sprite object that contains some basic variables for the galaxy creation

    • Next a Galaxy Map array is created that serves to plan out where the star systems will be created on the layout. Each cell will be assigned a value to determine whether that location can spawn a star system or not.

    Cells with the value "0" are valid spots to spawn star systems; cells with the value "2" are invalid and can't spawn star systems; and cells with the value "1" are cells that have been chosen to spawn star systems.

    • I make a first pass that turns all cells into 0, then I make a second pass where every other cell is set to 2. This makes sure that the star systems won't be spawned perfectly aligned.

    • Next I will do a Second pass which will determine the shape of the galaxy. For this I start by creating a Drawing Canvas which will be used to check a heightmap.

    • I create a Sprite object with the Heightmap, this is a sprite that contains a black&white image of a galaxy shape like so:

    • I paste this sprite into the Drawing Canvas and take a snapshot, in order to evaluate each pixel color of the image.

    • I run a for loop for the positions corresponding to each of the cells of the Galaxy Map Array on the Drawing Canvas, and compare the Red value on each position. If the red value is low (for example <20), that cell is invalid to create a star system. This makes sure that no star systems will be created in the dark areas of the heightmap, and lots will be created on the light areas.

    • Finally I run a for loop for each of the Galaxy Map Array cells and spawn star systems on a random amount of cells with the value 0. (I have some parameters that make this more controlled, such as a density variable that is also affected by the brightness of the heightmap)

    The great side of this system is that it allows me to easily create pretty much any shape of galaxy I want by making a quick doodle on photoshop. The way I have it set up, is each galaxy type is a different animation of the sprite object, and I can easily determine which type of galaxy shape I want by simply changing the animation before pasting it into the drawing canvas. Pretty cool!

    Then as soon as a star system is created, it automatically populates it with a star and planets. Currently there isn't much into it, but on a future version I will create arrays that house all of the star systems, planets etc, including info related to each one, in order to easily track them.

    Problems Encountered

    1. As expected, before doing any optimization, I encountered problems with frame rate, which were being caused by there being so many 3DObjects on scene. I solved this issue rather easily, by simply making any 3DObjects that are far away, invisible. Considering the nature of this game, where each star system is very far away from each other, this works extremely well, as usually no more than 2 or 3 stars are close to the camera at one given point. So, as soon as they're a bit farther away, it's completely unnoticeable, as I can turn them off and simply display the white aura around them. The images used for the Star System ring graphic and star glow are also pretty big, so I introduced different LODs (Levels of Detail), having lower resolution images be displayed for farther away objects.

    This worked like a charm and put the frame rate at top performance.

    You may notice on the video that frame rate drops sometimes, this is because I haven't implemented this into the planets yet, as they were a last-minute addition, but once I do add some optimization, it should be back at max frame rate.

    2. A pretty bad problem that I did come across however, is that the Drawing Canvas paste object function doesn't always work unfortunately. It's very finicky, and I had to go through a lot of different experiments to get it to work consistently, as it would just decide to not work every now and then, sometimes it would simply not work. The only way I could get it to work was if I called the generation function from the "Start of Layout" condition. Otherwise it would not paste the image. (Yes the function is asynchronous and I have "Wait for previous action" after this action).

    I ended up brute-forcing it in order to getting it to work consistently. Which would consist in destroying the existing heightmap object, creating a new one and paste that one. It repeats until it works basically. This seems to be a problem of the Drawing Canvas Object, that should be addressed Ashley

    3. Effects very touchy with 3D shapes / 3D objects. They look great and and achieve amazing results, but there's an issue where the object gets sliced at the top or bottom with certain camera angles. Often the more the camera angle is closer to the 0-Z value, the worse it gets. The object I have that uses the most effects and requires those effects is the Star Object, somehow I was able to find just about the perfect values to make not show this issue I'm mentioning, the main solution being placing the the Star object in a layer that has a Z elevation of 1. Yeah lol.

    However, with other objects, I seem to not be able to circumvent this, and am often forced to give up adding an effect, and finding a different way to achieve the look I wanted. I would be great if this could be solved, although I don't know if it's a fault of Construct 3 or the 3DObject plugin. I found that this only happens if the effect is on the object itself instead of the layer, but it often is the only way where the results are worth it to keep the effect.

    4. Working around the drawing priority (where 3D objects disappear behind of semitransparent pixels) will be admittedly a pain in the ass. But I hope that that with a lot of tests I'll get there.

    Graphical Enhancements

    I worked a fair bit on the look of the stars, but still need to do a lot with them, such as improving the texture and mesh. I'm also going to create different LODs for each of the 3DObjects, to further improve performance.

    Overall it works for now.

    Conclusion

    If you managed to read through all of this, you're insane. But I hope it was informative, and not too boring.

    This is probably the longest Devlog I will ever write, as I wanted to cover the main topics of what I did with this project. There's a lot of stuff that I didn't cover.

    If there's anything you saw in the video that you're particularly curious about, feel free to ask.

    Overall it's been a lot of fun working on this project, sometimes I get stuck with something for a couple days, but overall I've been able to overcome it one way or another.

    Feels like I'm pushing boundaries, and making the most out of this Engine, which is a great feeling.

    I'm looking forward to see where I'm able to get the graphical quality here.

    Video of this version:

    Subscribe to Construct videos now

    Future Features to Implement

    - Generate background stars and nebula, including a skybox

    - Create arrays that track planets and star systems (and assist on their creation)

    - Different types of planets

    - Create a Twin Star system when 2 star systems overlap

    - More Optimization

  • Very interesting project. I look forward to future posts.

    there's an issue where the object gets sliced at the top or bottom > with certain camera angles.

    Have you tried playing with the "near distance" and "far distance" values in the properties panel under "advanced"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much! Appreciate you leaving a comment!

    Yes I tried that as I also thought that might be causing the problem, however it doesn't seem to be. The far distance is currently sitting at 10 million haha, and the near distance is at the minimum, 1. It may be that if the near distance was allowed to be lower than one, that might affect the result, but unfortunately I am not able to test that.

    What makes it most odd is that the work around I got (barely a work around) was to just set the Z value of the layer where the object with effects is, to 1. Higher than that makes it problematic again, lower than that also problematic.

    Here's a video of the object getting cut off:

    Subscribe to Construct videos now

    I set the layer Z Elevation back to 0 and made the the glow objects invisible to make it easier to see the issue. As you can see, the object gets cropped at the bottom. With different sized objects, it would also get cut at the top. I wonder what could be causing it

  • Does it happen with constructs 3d shapes as well? If not it may be an issue with the 3dobject plugin, else perhaps post a bug report.

  • Hm, interestingly enough I thought I had tried it already, and it turns out I didn't. The 3D shapes indeed do not have this issue. Thanks for the suggestion. So far it seems like it only happens with the 3D Object, and also sprites using Rotate 3D Behavior.

    I'm gonna report this to the creator of the plugin, to see if it's possible to get a fix.

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