Jump to content
  • Advertisement
  • entries
    7
  • comments
    0
  • views
    385

About this blog

This is my Game dev blog for Fraud simulator! Let's make a game together!

Entries in this blog

 

Taking a break

This week was about relaxing and designing. Two games I had been waiting on came out this week that got me absorbed, Anno 1800 and Weedcraft. I'm done playing both of them, but they both had some interesting design concepts that I enjoyed. Anno 1800 has something called Expeditions. I absolutely loved the implementation of it. You would run into these events with about 2-4 options, and the options were ambiguous, without a "good" or "evil" option. You prepared for the journey with items and depending on how well prepared you are and some rolls, you succeeded or you didn't. This is similar to what I want to accomplish with Events once the rest of the game is hooked up. I want to have morally ambiguous choices that flow logically, but allow the player to have the freedom of playing how they want. Unfortunately, this means alot of design overhead, especially if you have deep trees. But I think having a shallow tree with a very wide dialog tree is important, and will allow the player replayability and also agency in their own game on choices. Which brings me to one of the design options I have. I want options that will probably get me delisted with a publisher. I really think it's important to have options that will make the player go "no way, I can DO this?" Either for shock value, or to get across that this is not your normal economy simulator, I want to set the tone from the beginning that you will have some very morally ambiguous choices for the entire game. This game is called Fraud Simulator, and one of my goals is to get accused of teaching people how to commit Fraud. The argument of course I will have is, how can you catch fraud if you don't know how to commit it? I plan to have both of these in the game. But enough of that for now, that's a long way off. The event system is not going to do much to my current systems in place, and I need to figure out how I'm going to design the scheduler. Last time, I thought I was going to create an editor for this. The problem with this, is that skills are going to need to have behavior coded in. I have no idea how to create an editor that codes behavior of skills, if that's even possible. So unfortunately, I don't think at this time I'll be able to let the player create skills. Sure, I can make some skills that give you bonuses to stats, and that's easy to code for the editor...but what about a skill that when you use it, it creates things from a recipe? What about a skill that mans the register at a store and sells to customers if they're in the store at that time? How do you allow coding of behavior that affects the game like that from an editor? So, this week I pulled up my design docs and tried to see what I could do in an editor. I don't think companies will be possible, since their behavior is so unique for each type. I can do some skills, but how I envision skills is probably going to change eventually as it is. Recipes and Goods I can absolutely put into an editor, because the game doesn't care what type of recipe or good they are, their behavior is uniform. I feel like I'm overthinking it as it is though, and I just need to get interaction with my economy running. I read up a lot of people that took 2.5 years on their game because they rewrote their code so much or started from scratch. I want to follow SOLID principles, but It's hard when you have no idea what your implementation is going to look like because I've never coded in C# before. On top of that, half of them I'm not even sure what the hell they mean. The other side of the coin is that I know for a fact that my coding is earning me code debt, and I will have to pay up when I refactor eventually. Constant debate in my head about when to start refactoring. I think I really want to start coding everything to an interface here soon. Everytime I watch an example on the SOLID principles, it's always using an interface. Sounds like that's my future. So for this week, just relaxing, catching up on Game of Thrones, checking out some actual games implementation of cool ideas, and doing some brainstorming.

KrisWolfe

KrisWolfe

 

Hooking up the player to the Economy

This week I focused on getting the player hooked up to interface with the economy. I've tested what I have with varying amounts of agents, and the numbers popped out about what I would expect, so it appears to be working. I need to capture more statistics later to make sure there's not "other" behavior going on that I don't anticipate, but I'll work on that once I have my player hooked up and I can start messing around with the engine to fine tune the numbers. This week I also discovered that UI is boring as hell to design, and took a lot longer than I thought it would, specifically getting motivated to work on it. I learned a lot about input boxes and drop downs. Dropdowns are way more complicated than they appear. I made two screens...one for managing your companies, and the other for placing orders into the market. The UI is not polished. I bought a UI pack for $5 off the Unity market just to have some placeholder art while I'm figuring out exactly what I want. I still don't know what the final product will look like, but as I hook up the systems to each other, I'll go back over them. Another important concept I'm running into is refactoring. It is actually hard to just say "Ok, this works, I'll come back to it later." I want to refactor my code, but as I'm designing this system to hook the player up to the economy, I'm running into problems that I can only solve by rewriting sections of my economy code. So I need to hold on refactoring code until I have a complete idea of what my code needs. Specifically, I want the player's companies to act a little different than the NPC's. NPC companies have a change to turn their orders into market orders instead of limit orders. I only enter orders for the player when they actually want them. So, I can't just throw the player's companies into the list with the NPC's companies to "get handled." I also want the player to be able to run each part of their company, while the NPC's will require an employee to run parts of their business. This is nice, because it gave me a chance to run some polymorphism. I had methods become different based on if it was a player or NPC, so it was fun to mess around with that. But eventually I think what's going to happen is that I turn the NPC's to act like player characters, but their actions are handled by a factory design pattern instead of the player object. But that's just something to do for another time. I've attached my company management screen and my market screen. Right now I just have a button to create a company...the choices right now are a retailer or a producer...the producer always has at least one recipe, and if they have enough employees, they will produce goods. They will then send those goods to a retailer that they have a contract with. On the market screen, we have a bunch of drop downs which allow you to switch markets, choose which company you own that you want to get orders for, choose which recipe, and then see the current contract market for the good selected. Asks are what producers put out, Bids are what retailers put out, and they sell per good sent. Since I'm a producer with an output recipe, the bid options are disabled. I can then put in a market or limit order for contracts, and they will get executed on the next "game turn". It's a little complicated, and I will need an extensive tutorial, or at least make the UI better to read eventually. And that is currently working. I can acquire contracts and I tested it this weekend. I wanted to do the same for employees, but then realized I wanted the player to be able to run their business without employees. So, the next step is to now get the scheduler up and running with skills. When you own a company, you will have the "produce recipe" skill pop up and for each hour you spend on this skill, you will produce a certain amount of goods. With a retail store, you can "man the register", and if customers show up you will sell to them. That highlights another problem I'm running into. I know I want a skilltree, but I'm not sure what to put in the skilltree, or how it works and unlocks. I want skills to be unlockable the more you use them, so that you get better at a job or skill overtime. Right now my plan is to just add them as I'm designing the rest of the game, and I'm like "oh yeah I should have a skill for this." Another problem I'm running into is that I'm hard coding strings into my code to detect which type of company I have. I think I'm going to have to get a JSON database up and running sooner rather than later, and that can go hand in hand with editors I want hardcoded into the game. I'm thinking I should just create editors now to make skills and types of companies and goods, so that the buyer of my game can also do the same and use the same editors to make whatever skills and companies and goods they want. Another aspect I've been keeping in mind is to keep this multiplayer ready. I want people to be able to run a company together, specializing in different skills and taking on the market, stealing from each other. I want players to be able to have a job AND a secret company on the side, siphoning funds from the business and sabotaging each other...or they could work together and build a mega corp. I know I will need to do a command design pattern for player actions eventually, so that they don't have all the information available to them to cheat. So for now the player object I'm using is a prefab that I edit, and I only store commands on it to send to the economy...Eventually I will put some code in to validate the commands, but for now I want to get systems up and running. So this week I will work on the scheduler and some basic skills to get a company up and running and interfacing with the economy. Then likely start working on an editor to add skills, company types, goods, and recipes into the game through the editor instead of just hard coding it into code.  

KrisWolfe

KrisWolfe

 

Economy milestone

So just a few minutes ago, I got my economy sim up and running. I really love C#. It allows me to do a lot of things I couldn't do in programming languages, or at least so cleanly. I finished the code a week ago, but it was extremely rigid. For instance, I had farms able to produce goods, then make a contract to send goods to someone. Stores could acquire that contract, and goods could get sent to them. But it was only for farms and stores. What I wanted was an object that did not care what type of company was hooked up to it...it just passed along goods from one company to another until the contract expired, and didn't care what class type they were. So I rewrote the classes so that there was a superclass called Company that other types of companies inherited from, and then the contract didn't care what type they were. I was super impressed with how the code handled that kind of coding. Much easier to do than I thought. I have a working economy. I ramped it up to over a thousand agents, 200 farms, 20 stores. The farms all hired the exact amount of employees they needed, they paid their employees and owners, they put contract out on the market for their recipe, they produced goods. Stores acquired contracts with Farms to send them goods, they hired employees to sell them in store, and everyone purchased food and kept themselves fed, receiving salaries, and choosing different goods based on consumer preference. I'm so proud. And the code is extendable easily. Next step, hooking up a player to the economy to own a business or get a job at one of these companies and get paid. I have a skill system in place already, although they don't do anything at the moment. I want skills that are unlocked to affect their job or company different ways, and the more you use a skill, the better you get at a job. Eventually I want other types of companies, like service companies. You could become a janitor, or create a janitor service for other companies...phone services, IT services, manufacturers, different types of retail stores...and the ability to own any of these companies and affect the market. For tonight, it's happy hour.

KrisWolfe

KrisWolfe

 

The creation of the Economy

This weekend was spent exclusively on my economic model. I spent a day planning out what I wanted to do. I wanted to replicate demand and supply, curves and market behavior. At first I simply tried to replicate the curves explicitly, with quantity supplied, quantity demanded, price and equilibriums, shortages and surpluses. I realized quickly this was folly, because that is more useful for theoretical application and to understand from a top down view of what's going on. I found this out when I tried to say "ok, well with this shortage, what should the price be." Instead, what I implemented is two markets. A contract market and a retail market. As in real life, logistics for how food gets to the market is usually 4 steps...farms producing the food, sent to wholesalers, sent to distributors and then sent to supermarkets. Very rarely does a farmer just sell to the market itself, and rarely do customers shop at farms. I'm going to just let the market set the price and shortages and supplies, instead of simulating it. This is actually more exciting because I have a feeling a bunch of things I can't plan for will happen in this ecosystem, and I think it'll allow for a fun game.  Currently I have customer behavior up and running. They buy from retailers when they are hungry, and seek jobs when unemployed. They start businesses when they have money for it. They shop at retailers based on market share, and they prefer foods over others, but also keep in mind the cheapest food. Retailers seek goods from Producers, and sell food at a profit. If food doesn't sell, they lower the price. If it's all bought up, they raise the price. They can spend money on budgeting to raise their market share. Producers use recipes to make goods. They then sell them to other producers or retailers. They acquire more recipes for goods that are in demand when they have money for it. I think it's a quaint system for my first economic model. The only thing I did not finish this weekend was getting producers selling to retailers. Everything else was tested to make sure it works, although I'm sure there are plenty of bugs once all the systems are linked to each other. My first design problem I faced was that there was a lot of information I needed linked to each other, specifically with the items. Each company had to keep a list of what price they're selling each good at, and to track market changes. I realized quickly I needed some type of database, but I'm unsure how to hook it up to mySQL or Access. For now, I just have a lot of little classes I'll be putting together. The economy itself is two for loops. A for loop to go through and throw objects into lists that need to be handled later, like if a customer is hungry, they go into a hungry customer list. Then later I'll iterate through and feed them by buying goods. I obsess alot about cpu footprint, although I have a feeling I should not worry about it since this isn't going into an Update() function...this will all be turn based and only function when a button is clicked. So I wonder how many agents I can have before performance is an issue. That'll be for this weekend. Another problem I ran into is fatigue. I haven't coded so much that I start to make obvious errors. I finally decided on Sunday to go through and put a bunch of //TODO: comments everywhere, and let my mind rest. Interesting dilemma. For now, I'm satisfied. The customers work fine with the test data I've given it. Once the companies are up and running, everything is hooked up to constants and will be enjoying to watch my little ecosystem either fail horribly or all prosper together, or watch the companies completely dominate the daily expenses of the customers.

KrisWolfe

KrisWolfe

 

Code Rework

I've been watching alot of videos on C# and the SOLID principles of coding. 3 weeks ago I had never coded in C#, and I've been learning swiftly. Last night I figured out Coroutines and how they work. I did not expect the rest of my code to run while the coroutine was running...I thought it was like a pause for the rest of my code. That has made me think of some interesting ideas, like cascading text. Today I learned about delegates, and the lightbulb turned on. I realized how easy it would be to make code modular with delegates. I also wrecked my UI by switching from constant pixel size to a reference screen size. I realized I just needed to restart,  using all the principles I've learned. Today I redid my skilltree. My player, skill tree, skills, and stats are all scriptable objects now. I created a reset method to throw all the non-starting skills back into the locked List on the skill tree. I also have two different skills, Active and Passive that affect stats when unlocked. I created a debug screen with buttons that adjust the values of the scriptable objects and the player character. It's all wired up nicely. Tomorrow we play around with delegates. I want each of my Systems to talk to each other through delegates, instead of hacking up some references through empty game objects like I was before. It will be interesting to learn about this new C# feature.

KrisWolfe

KrisWolfe

 

Setting up core mechanics

This week was a little tougher than the last. Specifically, I wanted to create a skill tree, but I didn't have an idea of what exactly I wanted in the skilltree. I had some general ideas of what I wanted to happen, but nothing specific. What I want to do is have a scheduler that you choose which active skills you have available, and the more you use a skill, it will unlock others. At the same time, as you progress in a day, the skill will "do stuff". This week I tried Scriptable Objects, but I did not want my skilltree to be persistent. I decided I would use JSON to load my skilltree eventually. For now I have some test skills hardcoded into my skilltree class. My scheduler was tricky, because I couldn't use prefabs. Each skill would be different, and my attempts at injecting the skill into the prefab failed. Eventually I decided to recreate a gameobject completely from scratch. This was a huge pain, because there are so many components it needs. Especially Text, which has all kinds of toggles and enums to sort through to get it right. But today I got it working. I have a grid on the right that spawns "spawners" on the right for each active skill in the skill tree, and these spawners will create 1 object I can drag around. When I drag that object, it will create another object, so I can have multiple objects. My scheduler has 16 hours that will attach the draggable object to itself, so that my day schedule can count how many of each skill are in the scheduler. It works. It might be horrible code, but it works. This week: Get a visual skill tree up that shows what skills unlock, and have the skills actually do something when we're in the schedule.    So to recap, what I currently have working: Purchase Orders work, with a 2 day delay, recreating an aspect of "The Beer Game". Customers vary depending on the day. All calculations for storage and inventory works, and if you have too much it gets rid of it, and if you don't have enough to sell to customers, it won't sell. Small economy is working, allowing us to hold inventory and cash and deduct and add as you sell. A scheduler that counts how many skills are in it. A skilltree that has unlocked and locked skills, and the ability to unlock skills and make them active. Pretty happy with what's done in a week.   Here's some crappy photos of my game so far with free art assets I found off the store. Lots to polish when the game mechanics are in place.

KrisWolfe

KrisWolfe

 

First milestone

Today was my first foray into the game development. I have a working prototype of my main game mechanic, the scheduler. I wanted to create a drag and drop system. I'm allowing 16 hours of time from 9 am to midnight (7 hours of sleeping and 1 hour of day prep) to be customizable. I want tasks that you can do to be unlocked, with maybe around 10 different tasks in the beginning of the game. Currently, I only have one task wired up. The 16 objects are on a grid, and when the task comes near one of the 16 hours, it will fade to 50% alpha, allowing you to see which hour your task is hovering over. If released, the hour will recognize it and bring the task to itself, and switch itself to invisible. At first I had the object destroyed, and a controller to detect to see if there were 16 hours in the frame, and create a prefab if it wasn't, but it was clunky and you could see it mess up, even if for one frame. If the task is not inside the schedule, it will destroy itself, and another prefab will be created from it's original spawn point. If another task tries to go over a different task that isn't the default, then the default hour will destroy the other task object and bring in the new task. It works very well, although the code is horrendous. Eventually I'll need to learn how to actually code, but for now it works. The "spawners" that create a new prefab of tasks when you pick one up to drag need to be organized on a vertical grid, so that they can detect how many will need to be available and sort themselves accordingly. I also wanted to be able to adjust the size of the tasks so that they occupy more than one hour, but I don't have an idea of how that can be possible with my current code, so it will need to be refactored. For now, it's functional, and I want to get it wired up! As for the actual simulation, I have a simple "Beer Game" simulation working. You have to manage Red Cups, Lemons, and Sugar to sell to customers. Each one takes up varying amounts to make lemonade. One bag of sugar can create 22 cups, one crate of lemons 28. The lemons take up the majority of your space. Customers are random, with more coming on the weekend. Each day creates journal entries for you business, and I have 3 accounts wired up...inventory, cash, and retained earnings. If you purchase orders, it takes two days for it to arrive, so you have to balance all three inventories with limited cash and customers. I want to implement spoilage, where lemons go bad in 4 days. I currently am not checking to see if we go over inventory space, need to code that in. I want to code in more customers for weekends and much less for weekdays. I think once I've wired up the schedule system, I'll work on player stats and skills. Have different tasks adjust them. I think I want a task to unlock more recipes and industries. Tasks to network, and marketing. A way to clean out your garage to increase inventory space and storage. Some type of "brand name" system to affect customers. I honestly don't think this will be too difficult. I think the hardest coding was the scheduler, and the next will likely be a framework for detecting which company the player is interested in and having json files being read to see which inventory items are needed to produce and to display it automatically. I currently know nothing about JSON, so this will be a huge opportunity to increase my knowledge. It already looks like a hassle, so we'll see. But currently working on a functional vertical slice of a lemonade selling game before implementing that! We will see how the week goes.

KrisWolfe

KrisWolfe

  • 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!