Jump to content
  • Advertisement
  • entries
  • comments
  • views

Project: Fraud Simulator

Solving the tree problem



So, I think I've designed a possible solution to my tree problem.

First off, I really like C#. My background when I was young was C++, and learning data structures and pointers was interesting. I did really well with assembly language, and enjoyed those kind of recursive things. But I never kept up with coding, and now here I am much older and way behind. Object oriented programming had just becoming a thing back when I was coding, and until a few months ago I had no idea what it was.

I started doing some coding with javascript a few years ago, and let me tell you, that's one of the worst languages to start in. Now that I know what a strongly typed language is, having the compiler interpret what you want to do leads to so many obscure bugs it's crazy. With C#, if I make an error, I know exactly where the problem is most of the time. I haven't really run into any huge logic bugs I couldn't track down.

One of my favorite parts of C# is that practically everything is a reference. Keeping track of pointers in C++ was a pain, but C# does it so naturally and intuitively. I absolutely love it.

So now we get to the solution part. I don't know if C++ had events and delegates back when I was coding, but this is a dream. Because of how they work, I don't even care about animations or sounds in the game, because I know I can just go find the method that I want a sound to play and throw in an event code and plug it into my audio, or animation. It makes things so painless.

We have quite a few objects interacting with this hierarchy tree. First off, we have the employee objects themselves, that hold all the data I need to interact with the economy. Salary, jobtype, skills, hunger, cash, so forth. When we load the screen, we have to spawn an "Employee Card", which is the visual layer for the user. The card doesn't care what the data is, it just has a "data container" for the employee...or a pointer. The Employee card is draggable. When they don't have a job assigned, their just idle, and sit on the bottom panel. There's really only two things you can do with an employee card on the hierarchy screen: Drag the card to an employee slot or the idle panel. Right now, I can drag it anywhere, but I'll cut off that hippie golbydygook user freedom later.

The next object we have going on is the employee slot, and I think this is where most of the logic is going to happen. I don't the card really cares what happens to it or where it goes. But the employee slot DOES, because on the display, I want you to be able to grow the tree...in order to do that we need empty slots spawned...and we're going to have to do it for each manager.

So if the CEO has two managers, and those managers have 4 employees each, then we're going to need the CEO to have an empty manager slot next to the two managers so you can hire a new manager, and then each manager will have an extra employee slot in order to grow their trees.

But, if I drag someone in, we're going to need to spawn another empty employee slot next to it. And it has to know where to spawn. in the opposite vein, if I drag out an employee or manager, then they're going to have to despawn the empty employee slot, since there would be two, and I only want 1. And if you drag out a manager, I want the employees to reattach themselves to a different manager.

On top of all that, I currently display things by spawning all the objects. So when I do I refresh the display? I also don't think it's wise to continuously spawn and despawn all these objects everytime something moves slightly.

So for the display, I'm going to be doing some spawning pools. The cards and slots and lines aren't unique, and this will help performance. I'll need 3 different spawning pools.

The card slots will have event listeners on them, waiting for the employee that they're holding moves. If we drag an employee to them, then we register our delegates and then attach them and then have that slot's manager spawn a new empty slot.

I think all of this will work pretty well. I can think of a few edge cases off the top of my head, but I can get most of this up and running this weekend hopefully. I think making the tree itself will likely be the hardest part of the hierarchy screen.


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 kensarto
      I'm looking for pointers before I get started developing one from scratch, I do not have, or plan to spend money on other peoples scripts or products to import into my project which means I can neither see how they do it, nor use their systems directly. As such, this will be entirely hand written to match what I need.

      The specifications are as follows:
      Unique Actors that prompt different conversations, whether that be an NPC conversation, or the interaction with a work station and selecting options. Branching conversation paths (and therefore a method of storing variables to short and long term store flags for different states) Localised scripts.  I do not want to have 3 or 4 different scripts on every object just for this, it would be optimal in my opinion to have a single dialog manager script, but i will be happy if i have to include an "actor" script on the different NPCs along with that. UI (arguably the easiest of the requirements that will sort itself out when I've got everything else working over time) Is there anything obvious I'm missing about functional requirements, non-functional requirements? What is the best place to get started?
    • By Titanomachy Studios
      Project Name: Condors Vs. Ocelots
      Team Size: 15ish
      Genre: Strategy RPG
      Engine: Unity
      Roles Available:
      3D Artists - generalist or hardsurface w/textures
      2D Artists - Characters, World, and UI
      C# developer/engineer(s)
      Social Media/Marketing/Community Manager
      If you feel as if you can offer the team something more that isn’t listed, we are always open to making an exception, just send your resume/portfolio to us!
      Project Length: Currently planning on release Q1 2020.
      Compensation: Rev-share
      Project Status: Vertical slice is done and iteration development has begun.
      Send emails to careers@titanomachystudios.com
      Must speak English and have access to a Mic.
      Our store page can be found here, https://play.google.com/store/apps/developer?id=Titanomachy+Studios
      Our website here,
      Project Story: Condors and Ocelots have been at war for generations. Battles have left some settlements in ruins. Others teem with refugees. Even away from the fighting, towns and villages suffer from having their fighting-age citizens lured away or conscripted by one faction or the other. Players control their armies and try to wipe out their opponents! Use terrain, abilities and pure cowardice if need be to achieve victory for your faction!
    • By RoKabium Games
      The Riverine design looking like a snake didn’t work very well with the animation so we re-designed this creature to look more like a colourful caterpillar type of animal.
    • By intenscia
      mod.io is an cross platform mod service created by the team behind ModDB.com and IndieDB.com. It can be integrated in-game using the  REST API, C/C++ SDK or engine plugins (if available) Unity is ready and Unreal Engine is in development.
      Features include:
      Platform agnostic (support 1 click mod installs on Steam, Epic Games Store, Discord, GOG, itch.io and even consoles in the future) Clientless (mod.io has no other dependencies and works behind the scenes in your game) Embeddable web app UI, so you can integrate your mod community anywhere Powerful search, filtering and tagging of mods Moderation and reporting systems built-in Steps to getting mod.io integrated:
      Add your game to our test environment or production Read our API documentation for an overview of how mod.io works Choose an Engine Plugin, API or SDK to integrate mod.io into your game and mod making tools Ready to launch? Add your game to our production environment then let's discuss promoting your release Need help? Our team is available on Discord to assist and our getting started guide has more information for you  
      Benefits of using mod.io:
      mod.io offers the same core functionality as Steamworks Workshop (1 click mod installs in-game), plus mod hosting, moderation and all of the critical pieces needed. Where we differ is our approach to modding and the flexibility a REST API offers. For example: 
      Our API is not dependent on a client or SDK, allowing you to run mod.io in many places such as your homepage and launchers Designing a good mod browsing UI is hard, our plugins ship with a UI built in to save you a lot of effort and help your mods stand out We don’t apply rules globally, so if you want to enable patronage, sales or other experimental features, reach out to discuss Our platform is built by the super experienced ModDB.com team and is continually improving for your benefit Your community can consume the mod.io API to build modding fan sites or discord bots if they want Large studios and publishers:
      A private white label option is available to license, if you want a fully featured mod-platform that you can control and host in-house. Contact us to discuss.
      Find out more:
      Visit mod.io | About us | Add your game | Chat on Discord
      These screenshots are from our Unity plugin:

    • By INTwindwolf

      INT is a 3D Sci-fi RPG with a strong emphasis on story, role playing, and innovative RPG features such as randomized companions. The focus is on the journey through a war-torn world with fast-paced combat against hordes of enemies. The player must accomplish quests like a traditional RPG, complete objectives, and meet lively crew members who will aid in the player's survival. Throughout the game you can side and complete missions through criminal cartels, and the two major combatants, the UCE and ACP, of the Interstellar Civil War.
      Please note that all of our current positions are remote work. You will not be required to travel.
      For more information about us, follow the links listed below.
      INT Official website
      IndieDB page
      Also follow social media platforms for the latest news regarding our projects.
      Website Manager
      3D Character Modeler
      3D Environment Modeler
      3D Animator
      Unity Engine Programmer
      The project is marching increasingly closer to be ready for our crowd-funding campaign. Being an Indie team we do not have the creative restrictions often imposed by publishers or other third parties. We are extremely conscientious of our work and continuously uphold a high level of quality throughout our project.
      We are unable to offer wages or per-item payments at this time. However revenue-sharing from crowd-funding is offered to team members who contribute 15-20 hours per week to company projects, as well as maintain constant communication and adhere to deadlines. Your understanding is dearly appreciated.
      TO APPLY
      Please send your Cover Letter, CV, Portfolio (if applicable), and other relevant documents/information to this email: JohnHR@int-game.net
      Thank you for your time! Please feel free to contact me via the email provided should you have any questions or are interested to apply for this position. We look forward to hearing from you!
      John Shen
      HR Lead
      Starboard Games LLC
  • 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!