Jump to content
  • Advertisement
  • entries
    26
  • comments
    21
  • views
    2677

Dev Log #3

Sign in to follow this  
FatPugStudio

429 views

Intro

Turns out that thing aren’t always simple as they seem at first glance. I spent more time than planned on overhauling the weapon pickup and replacement system i wrote about in the previous dev log. Apparently, despite the system being laid out well, there were some hurdles that appeared.

First of all, the weapon switching system that was meant to be extremely basic and function by simply activating and deactivating children objects (weapon objects with firing FSMs) on the gunpoint of the ship proved too common for the concept of weapon equipping, upgrading and dropping during the game. I upgraded the system and while it’s very complicated and probably can be laid out a lot simpler, it works as intended.

The setup

Upon starting the game, Player is spawned, its child Gunpoint, and Gunpoint children, Basic Weapon Object (Level 1 out of 5 weapon) and Empty Weapon Object. You’re probably wondering why would i put something like Empty Weapon when it’s not even used, but we’ll get to it. Every Weapon Object has two FSMs, Main FSM, used for the upgrade system, and Firing FSM, used for firing the weapon. Gunpoint object stores the Weapon Switch FSM. Bear in mind that Weapon Object can also be Weapon On Ship, or a Weapon Pickup, depending on the state in which it is and the fact that Player can have two weapons equipped, but only one active at the same time.

Weapon Upgrade System – how it works?

Main FSM controller on the Basic Weapon Object enters the first state. It searches for the Gunpoint object (place on the ship where it will be spawned. Search is done by tag, since it is quicker than searching for it by name). When it finds it, it stores it in the variable. By checking if the Weapon Object is childed to a Gunpoint or not, the Main FSM is branching in two directions, which determines if it’s really a weapon equipped by Player, or a Pickup waiting to be collected.

Shorter branch is executed is if the Weapon Object is a child of the Gunpoint object. It is then stored in the Weapons On Ship array, and the Main FSM finishes it’s job for now. That means that it is a weapon equipped by Player and it can be fired.

If it is not childed, it means it’s a Pickup (drifting in space, waiting to be collected), its Firing FSM is disabled, a child which is an animated circle indicator for easier visibility is activated and the state machine starts its next event.

Weapon Object starts measuring distance from the Player. When the distance drops below defined value, Weapon Object can receive the key command from the Player, otherwise, it’s non-responsive to key press. In game terms, when the Player hovers over the weapon, by pressing key following states can occur:

Simplest case occurs ff the same weapon type of maximum upgrade level exists on the ship (checked by iterating through the Weapons On Ship array). “Weapon is at maximum upgrade level” message appears, the pickup eventually leaves the screen and it is despawned.

If the same weapon type of lower upgrade levels exist on the ship, it is upgraded. If the pickup is of the same or lower level than the weapon on the ship, the weapon on the ship is upgraded by one level. But if the pickup is one or more levels higher than the weapon on ship, the weapon on the ship is upgraded to that level. So, you get a pickup and it upgrades your weapon by one or more levels and it disappears. In game terms, it sounds simple, but actually there’s a lot of mechanics behind it.

For example, Player is equiped with Level 1 Weapon, and there’s a Level 1 Weapon Pickup which we collect. Level 1 Weapon Pickup iterates through the Weapons On Ship array, and it finds the Level 1 Weapon of the same type. It gets the position of the Gunpoint object, spawns Level 2 Weapon and adds it to the Weapons On Ship array. It also checks if the Level 1 Weapon in the array has its Main FSM enabled or not. If it is enabled, that means it’s an active weapon (we’ll also get to it when we get to the Weapon Switching mechanism), which means that the Level 2 Weapon that is spawned should also be active which is done by activating Firing FSM on Level 2 Weapon nad adding it to the Active Weapon array (needed for the Weapon Switching mechanism). Firing FSM on Level 1 Weapon is disabled, it is removed from the Active Weapon array, removed from the Weapons On Ship array, Level 1 Weapon equipped on ship itself is despawned and Level 1 Pickup is finally despawned at the end of the last state. If the Level 1 Weapon on ship is inactive (its Firing FSM is deactivated), the Level 2 Weapon also spawns with its Firing FSM deactivated, but is not added to the Active Weapon array.

What happens if the Player is equipped with one or two weapons that are different from the pickup?

Things get a bit complicated there. If Weapon On Ship array does not contain any of the levels of the Weapon Object that is the same as the Weapon Object pickup, a Replace Active/Replace Empty state is entered. Remember the Empty Weapon object from the setup? It is used as a placeholder when picking up a weapon that is different from the basic equipped weapon. By iterating the Weapon On Ship array and finding no weapons of the same type but finding an Empty Weapon object, it is simply despawned, removed from Weapons On Ship array and replaced by the picked up Weapon Object. Since it is not active, spawned weapon Firing FSM is also not active, thus not added to the Active Weapon array.

A different Active Weapon acts similar to an Empty Weapon object if all slots are taken. It is removed from the Weapons On Ship array, removed from the Active Weapon array, deparented from the Gunpoint, its children activated (circle indicator that makes it visible more better on screen), and the pickup is spawned on the Gunpoint. As i said in the beginning, whenever a Weapon Object spawns, it immediately checks if it is a parent of the Gunpoint or not, and then added to the Weapons On Ship array or not.

Switching Weapons

Finally, switching the weapons. First we need to make sure that the Player can’t cycle between the equipped weapon and the Empty Weapon object. As long as the Empty Weapon is in the Weapons On Ship array, cycling is not enabled. When it is no longer contained in the array, Player can freely switch between weapons. Every switch gets the first and second index numbers of the Weapons On Ship array, stores them as Weapon 1 and Weapon 2 variables, enables and disables Firing FSM on them, adds the Weapon Object with enabled Firing FSM to the Active Weapon array, and removes the Weapon Object with disabled Firing FSM from the Active Weapon array. We need the information about the Active Weapon so it can be replaced with the pickup that is different from it. That enables the Player to upgrade the weapon of the same type as the pickup on ship whether it is active or not, or select which weapon will be replaced (if both are different from the pickup) by simply switching weapons to active or not.

Complete system for upgrading and replacing weapons. Thing is - every weapon level object needs to have one of these.Complete system for upgrading and replacing weapons. Thing is – every weapon level object needs to have one of these.

 

The post Dev Log #3 appeared first on Fat Pug Studio.


View the full article

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Elliot Nykvist
      Hey!
      I wonder how to program a mobile game in C # that should be like Mario Wanted, but I want the object to be still and when you click on the right guy a new level appear, but if you click on wrong you lose the game. So how Should I program this? I have almost zero experience of programing so any help would be helpful or else do you know where I can learn to program.
      Thanks in advance!
    • By Lazy Fangs
      Hi all!
      We are looking for people to help make a simple TPS shooter game - the goal of the project is to create a hobby team that would eventually be able to learn, tackle bigger projects and make some cool games.
      We have a GDD that still needs some work and we are clarifying it as we speak:
      https://docs.google.com/document/d/1UdvIVc7qomldBq_8WuAK5mXVnv7rstcNkpgSZtaB4FM/edit?usp=sharing
       
      Currently we are looking for:
      Concept Artists
      2D Texture Artists
      3D Modellers
      C# Programmers
      Level Designers
      Sound/FX

      Please PM me, leave a reply or contact me on Discord: Wing Dancer#2868
    • By Data7 Games
      Project Name: Rift One
      Role Required**: (Language - C#)
      - Dedicated Unity Programmers
      My Role: Project Lead
      Previous Projects: N/A
      Team Size: 6
      Project Length: n/a
      Compensation: Rev-share until we get funding.
      Responsibilities: 
      - Must know Unity. 
      - Must Know How Gitlab & Sourcetree work
      - Advanced Programming.
      - Friendly and chilled
      Project Description: An Sci-Fi FPS based in a alien world, where you, mark maxin are forced to enter a portal that transports you to another world.
      **Contact**: please Email us at data7games@gmail.com
    • By Kracken
      Looking for someone / people to join my team. We are making a 2D idle game with some unique features. Further questions you can DM on discord @Kraken#2892
    • By Guy Fleegman
      Graphic Artist Opportunity
       

       
      If you’re an artist and have ever thought about game development, but were hesitant about actually doing it, this is the perfect opportunity for you. There’s no commitment and moderate pixel art skills are probably all you need to bring to the table.
       
      Cube Universe is a game that has been in development for 5 years. It has combat, crafting, world building, quests, RPG skills and abilities, travel between planets and it’s multiplayer… it’s a fully functional game with a dedicated developer behind it all. It’s a science fiction, fantasy sandbox game where magic and technology meet. It’s alien and mystical. There’s no limit to what can be in the game and that means a lot of room to express yourself as an artist.
       
      When I say pixel art skills are required for a 3D game, let me explain the current process of how content can be created in Cube Universe.
       

       
      Cube Universe comes with a built-in editor. It allows you to build structures (like a house, a castle, a spaceship, or a sacrificial temple to the moon god of a primitive culture) using the game world’s terrain blocks (which you can also create different kinds of). It also features a modeller that allows you to create more intricate furniture, lively creatures and decorations (like a fireplace, a holographic console, a bookshelf, or a laboratory table bubbling with the craziest potions imaginable).
       
      Note: A terrain block is 0.5 metres cubed. When modelling, a 0.5 metre block is 16x16x16 voxels. Each voxel allows for 4x4 pixels on each face.
       

       
      It’s all about speeding up the process though; getting your ideas into the game world as quickly as possible. Cube Universe’s editor can import MagicaVoxel ( https://ephtracy.github.io/ ) models and it keeps the color information for texturing. MagicaVoxel is an amazingly simple and powerful voxel modelling/coloring tool that’s completely free to use.
       

       
      The next step is to add minor details through the Cube Universe editor using it’s built-in paint tools. You can import your own palette and paint until you’re satisfied. At this point everything is kept simple on purpose because the texture can now be imported into your preferred paint program as a PNG file.
       

       
      In this case, GIMP ( https://www.gimp.org/ ) is being used to change colors faster and paint the wood grain. It’s easy to see how the sides of the model are represented in the PNG file, but this process might require you to go back and forth a bit between GIMP and the editor to texture around corners and such. After you’re satisfied, you can run any filters in GIMP over your textures and you’re done!
       

       
      The nice thing when creating content is that the game supports shadows and ambient occlusion, which creates a darkening around seams and let’s you keep your textures simple while the game adds shading. The most time consuming part of the process is usually the texturing. A 30 minute model could typically take 2 hours to texture, for example. The focus of this game’s graphics is to create content easily with a pleasant appeal. The texture style is purposely simple to keep things as economical as possible. The modelling is where you want to spend the most time being creative and I believe that focus will make for an enjoyable experience creating content for Cube Universe.
       

       
      Once you have a handle on static models, Cube Universe’s editor also exports bones, meshes and UV maps to Blender ( https://www.blender.org/ ) for animation all in a DAE (Collada) file. Animation is it’s own thing and we’d love to have someone who is familiar with basic Blender bone animation, but that is not a prerequisite for this recruitment phase. This is how the creatures are animated though. And you can only model so many tables and teleporter pads before you get the itch to try making a wild half-monster, half-robot abomination that strikes fear into the player from a 100 metres away. This is what drives artists to learn more technical things; torturing the player creating engaging experiences for the player.
       
      At the end of the day, that’s what game development is about; learning new skills, pushing yourself a little out of your comfort zone and making wild ideas into a digital reality. I’ve written this recruitment post from my own perspective with the project. I’m not an experienced game artist, but I’m having a blast making stuff and learning new techniques. I’ve even learned new things about the software I thought I was already familiar with. And that’s where the fun in development comes from. Also, you won’t be alone. This is a team effort and helping each other is a crucial part of that. We'll help you get started and share any tips and tricks with you to make your life easier on this project.
       
      If you’ve made it this far, you’re definitely wondering about payment. At this point, all that can be offered is revenue sharing. If you are looking at this as an opportunity to retire on a tropical island, you’ll most likely be disappointed. If you view this as a way to experience 3D game development in probably the most accessible way possible, then I believe you’ll enjoy your time on the project. You’ll receive a copy of a cool sandbox game and some money when sales are made down the road. The details can be discussed further with the developer directly.
       
      You’ve probably noticed that all the software an artist needs is free to download. Got a computer? You’re good to go! The developer is passionate about this game and has implemented a lot of features in the editor to accommodate speed and flexibility for you, the artist. Discord messaging is the primary way to communicate and stay connected to the project. Google Drive is used for all file sharing and asset backup. That’s all the online accounts you require to join the team and start creating.
       
      Currently the game is for sale on the official website ( https://www.beosar.com/games/cubeuniverse/ ), but it’s not quite ready for a marketing push yet. With sandbox games, content is king and Cube Universe needs your help. If you’re new to game development, you'll gain some important skills and experience to help you with future endeavors. If you know someone who might be interested in the graphic side of games, please mention this opportunity to them and let them decide if this is right for them. Lastly, if you know all this stuff already and have lots of experience, well let’s see what you got, tough guy! C’mon, I dare you! 😉
       
      Feel free to ask questions in this thread. Otherwise, you can contact Beosar ( https://www.gamedev.net/profile/221978-beosar/ ) here on GameDev.net for further information. If you prefer Discord, Beosar#8149 is what you'll need.
       
       
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!