Search Unity

Games Chromatic Galaxy - a Twin Stick, rogue like spaceship shooter

Discussion in 'Projects In Progress' started by Kupferrot, Sep 18, 2022.

  1. Kupferrot

    Kupferrot

    Joined:
    Jan 19, 2014
    Posts:
    47
    Hello People,

    over the last months I have been working on a game that I would finally like to share here.

    Chromatic Galaxy is a twin stick, roguelike space shooter and will contain multiple ships that can be customized regarding weapons and abilities. This game is currently aimed for Windows and probably Mac OS (I have an old mac book here and released something for IOS already so I figured I could try a Mac release if there is interest).

    I made a small page on Itch.IO for the game:
    Chromatic Galaxy by Kupferrot (itch.io)

    As mentioned I already worked on this game for a while now and in this first post I would like to share what I have done so far. I have never worked with Unity's Shadergraph and I really want to get into this field because many great visual effects come from shaders. I spent a solid amount of time trying to do some shaders that I could use in this game. So far I came up with a responsive shield shader and a shader for a laser beam ( of course with a lot of help from tutorials) .

    laserCloseGif.gif

    The result of this work can be seen in these videos (Laser Beam is the latest video):





    I also implemented the movement of the ships. There is a different movement pattern for smaller and for bigger ships because I want to give the player the possibility to pick a play style that the player likes. I ended up using completely rigidbody based movement applying physic forces to movement and rotations. This was done because I faced multiple issues with collisions, especially regarding rotating ships, that I was only able to solve this way.

    Among the various smaller bits and pieces that I already coded is also a random map generator that creates random asteroid fields and will later be responsible to create the levels that are necessary for a roguelike game. Furthermore I already implemented 4 different weapons:
    • Laser shots
    • Laser beam
    • Shotgun like laser
    • homing missiles
    ShotGun.png

    laserPointer.gif


    Next I want to start working on the opponents AI which will probably be one of the most challenging parts of the development, but I am looking forward to see what I can create. I plan to have different types of enemies that use different ships so I will need to create something that works for all of them.

    After that I hope to put the various bits and pieces together into something playable so I can start tweaking the controls a bit. I will probably upload a small demo as soon as possible to get some feedback in regarding gameplay.

    At the moment I am using these free ship models from: https://www.patreon.com/quaternius which are really great, so I want to give credit to the page. And I bought some affordable assets from the unity asset store where necessary.

    Thank you for reading and hopefully see you next time.
     
    Last edited: Sep 20, 2022
  2. Kupferrot

    Kupferrot

    Joined:
    Jan 19, 2014
    Posts:
    47
    I would like to share my progress on the AI for the enemy ships, I added basic movement patterns, collision avoidance and aiming/shooting at the player. Have been working on this in the last days and I found the topic very interesting and fun to code. Would like to share with you how I did it.



    Since I am using Unity I was first thinking about taking advantage of unity's NavMesh. I already have experience with this but since my game is in space and most of space is empty, I wanted to try something else. The only obstacles are asteroids and other ships, both of which can move around the level and maybe a stationary space station every now and then. Because of this I decided to instead give the enemy ships "eyes" by using raycasts.

    Of course this didn't work out immediately I had to test different things and it was some trial and error involved. I made a small video about it, in case that you are interested:



    The process looks like this:

    1. AI get triggered and will follow the player
    2. AI will keep a certain distance to the player and circle around him if the distance is sufficient
    3. If the Raycasts detect objects in the way, the ship will adjust movement to the left or right (if both option are possible, it will take the shortest route to the player)
    4. If the area is unpassable the ship will detect this and change objective to leaving this area before focusing on the player again. This happened very rarely in my tests but it can happen which is definitely the downside of not using a dedicated pathfinding algorithm.

    So far this works pretty well, even if there are multiple ships around. I am aware that I might need to redesign this if the AI seems too dumb, but for now I can work with this and I did not experience major issues.

    As I said, this didn't work in the first try. Especially when it comes to the raycasts I tested different options. I found it best to have a certain pattern of raycasts as you can see in following gif:

    They ray's I use get shorter the more they point out to the side, also if I detect objects close by, the ship reduces it's movement speed and the rays are shortened, this way I found the ship to make more precise movements and navigate through tight gaps. The ray's are always pointing in the movement direction and not in the direction the ship is looking. It can move backwards while shooting at you and still avoid asteroids while moving backwards. You can see this in my video. The shooting part was easy, I just check if the line of sight is free of objects and other ships, if it is and the ship is in range, then it will fire.

    I also had alternative idea's how to do it and might come back to them later if necessary. But for now I will test how far I can get with this system.

    Thank you very much for reading and hopefully see you next time.
     
  3. Kupferrot

    Kupferrot

    Joined:
    Jan 19, 2014
    Posts:
    47
    I am happy to finally share some of my progress regarding ship selection and customization. This part was very time consuming for me because it also contains a lot of work on the User Interface, an area that I personally don't enjoy about game dev, but you know....I need a user interface so I have to do it.

    It was actually way more work for me to implement then I thought, because of the way the older scripts for weapons and ship controls work. I had to make many changes in that regard not only to make the selection and customization work, but also to apply it in the later gameplay. In addition I still don't really feel comfortable working with interfaces in unity in general so I spent a lot of time on google. But I guess it is best to just show you what I did:



    I really wanted to have this preview in the upper left and I am very happy this worked out the way I wanted it.

    So why did I have to make changes to my older scripts regarding the weapons?

    This is mainly because I wanted the same type of weapon, for example these litte laser shots (the first weapon in the list), to be different depending on which ship equips it. I didn't think about this before so it gave me some trouble with my original scripts. In the video you can see that the second ship for example fires two of these laser shots instead of just one. The third ship (a small destroyer that I did not introduce so far) also fires two laser shots instead of one. The big ship at the end will even get up to 3 shots out at once.

    I wanted to have it that way so that every weapon is viable for every ship. Also it would look weird if a big battle ships just shoots the same amount of shots as a small fighter does. The battleship will also use a double shot for the shotgun kind of weapon as you can see in the video. And I have some further things planned to distinguish the ship types from each other.

    I think this will also enable the players to engage in different playstyles and encourages them to test out what works best with which kind of ship.

    As a little sidenote I also would like to add, that I worked on the user interface in general when it comes to playing the game:

    UI.png

    In my older post there was no UI at all, because of this I wanted to give you an update now.

    I hope you enjoyed this little post and I will try to get the next one out a bit faster. I am looking forward to the next task ahead and I am also glad I can stop with the UI work for some time :D
     
  4. Kupferrot

    Kupferrot

    Joined:
    Jan 19, 2014
    Posts:
    47
    The last days I worked on implementing a new laser beam weapon. The old one was burst fire, the new one is a constant beam that deals less damage. I also implemented damage dealing for both of the laser beam weapons. This was not implemented until now, also added energy consumption for every weapon and general energy regeneration. I will show the details of implementing this below, but first here is a video of the result (I show the old burst fire beam as well):


    Fortunately I could just reuse the same shader that I already made for the laser burst. I just changed few variables and made a different texture, also used different values in the line renderer this time. I tested around a bit and ended up using this texture:

    2022-12-04 15_02_42-Window.png

    In the video this might not be visible very well, but these small dots around the beam in the middle add a little additional effect to the beam as it looks like little particles are flying alongside it. In the game it is a bit easier to notice.

    As mentioned above the laser beams did not deal damage to enemy ships, this still had to be implemented. I wasn't sure what's the best way to do it, I ended up adding a collider set as trigger at the end of the beam. The end of the beam is defined by the variables that I apply to the line renderer:
    2022-12-04 13_57_52-Window.png

    the index 1 is set by script via raycasting. I shoot out a raycast and the index 1 will be set based on the position of the corresponding collision. Probably I could have already used this raycast somehow to also inflict the damage, but I faced many issues with tags and layers at this point and had to rework some older code to make it work at all. It became very clear to me that I didn't put enough thought into making a good concept that I could build up on later. But I guess sometimes you just need to rework older code, creating a game is a progress and new ideas might come during development, so I feel like I can't plan everything ahead of time.

    I think the shield shader that I created several months ago still holds up pretty well with the collisions that are going on in the video, but it will probably also need a rework at some point.

    shield shader.gif

    The AI script that I created for small fighters was used in the video also for the bigger ship. It kind of works but unfortunately for the bigger ships I need to implement something else. The movement style of the bigger ships is just too different from the small ones because they turn around much slower. This way these bigger ships will end up colliding with objects a lot.
     

    Attached Files:

    tsibiski likes this.