Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

317 Neutral

About Penkovskiy

  • Rank

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Penkovskiy

    3 Game Design Mindsets

    (you can find the original article here along with future 2D monogame tutorials) It was a late Saturday afternoon as I began the walk across the crooked streets of the inner city. With a small tip-off from one of my trusted friends, I decided to go looking for this suspicious and mysterious looking man who usually hangs out behind Yarn’s cafe on cold nights like these. It was out of sheer desperation and utter determination that pushed me to get my hands on a rare type of night vision goggle that was off the market. As I located the shadowy figure behind the cafe, his face slowly illuminated as he moved into the light. It was easy to see from his worn and anxious face that it was urgent business that had brought him. Tracking this guy down was hard. After many wrong turns, a lot of false information, and a risky run-in with authority, I had finally located the dealer. But I noticed something strange. My friend from earlier had bought these goggles at a quarter of the price this guy was selling them for – I couldn’t believe it! His prices had actually raised significantly for night vision goggles… and only within a few hours… 3 mindsets you can use to design practically any system in a game – and KNOW it works When designing the nitty gritty numbers for your game, the process can be fun. It can also simultaneously feel like you would rather poke small, long needles into your eyeballs. How much damage does this flaming sword of skulls and bones deal? 5,000 hit points YEAH !!! It’s extremely easy to get carried away or end up with an unbalanced mess that ends up breaking your game at spots where you least expect it. There’s a specific reason I decided to fluctuate the price of popular items in my game’s black market, however, as you’ll learn below, the reasoning why is anything BUT random. I love balancing my games. Not just because I’m a complete nerd, but I also use a very refined and methodical system. I’ve always envied games that have a fairly large-ish (consistent) player base, mostly because of two reasons: They have access to a large amount of ‘statistical’ numbers we can test Getting a large and consistent player base to test your game from scratch is hard Is it weird that when I start getting a lot of players in one of my games, I track how many times each tile has been stepped on since the beginning of the game (and then continue to run it through a heat-map process that tells me how densely populated that area is)? (lighter areas are heavily populated) I know I know, I’m a complete weirdo. You don’t have to tell me. I design my games using 3 simple concepts and strategies that are extremely powerful. By following this strategic and methodical system, you’ll be able to rapidly test, move fast, and experiment further than if you were to just throw spaghetti at the wall and hope something sticks (like everyone else). I’ve read a lot of game design documents, and most are super boring, or too vague to really give me actionable advice. “Design with the player in mind!” What does that even mean? What does that look like when you’ve been awake for 40 hours straight staring at your computer screen, talking to yourself, questioning your sanity? Here are some unique things I did to my game’s market recently; Capped the amount of money players could hold. Inflated prices on popularly bought items with a slow decay time. Example equation: (price = 0.99*price + (1-0.99)*initial_value) called every second Fined players through money (something you don’t want players to do? Fine them heavily for it – you’ll quickly see that nobody is cursing anymore ) I made players have to repair their most used items with money. Why did I make these decisions? I’m not just waking up one day and saying “Let’s fine the players! They suck!” Each decision was based upon testing and previous data, ran through this framework. If I thought it would be beneficial to fine players when they curse, I would first spend 5 minutes making a code that tracks how many times players curse and store it in a log. I’d look at it a week later, and based on how often players curse I would decide if fining them would have an effect on the economy. Money inflation is a problem in most multiplayer games, but using a systematic approach that I’ll show you below, you will always know which lever you need to pull to get your game on the right track and finely tune it like a well-oiled machine (no matter what problems you’re facing). Step 1. A benchmark is something simple to track. Follow me through an overly simplified rpg “leveling up” process. A player starts at 50 health. Each level, they gain 10 health. The max level is 20, meaning the max health is 250. The most powerful weapon in the game deals 10 damage per second. The most powerful armor in the game protects 80% of damage. It would take (~2 minutes, or 125 ‘hits’) to kill the strongest player in the game who’s wearing the strongest armor in the game while you’re using the strongest weapon in the game (assuming every hit lands while both of you are running around). These are what I call benchmarks. With these benchmarks, it’s infinitely easier to see exactly how balanced your game is from an overhead angle. Step 2. Working Backwards By knowing your benchmarks, it’s infinitely easier to decide “I don’t want it to take 2 minutes to kill Bob, I want it to take 1 minute” — rather than continuously guessing why it takes the strongest weapon so long to kill bob but one hits everything else. Knowing this, you can adjust each variable accordingly to set an accurate (to what you feel is right) amount of time it takes to progress in the game. Just from our benchmarks alone, we can adjust the following variables: Bob’s max health Bob’s health gained per level Percentage of damage our armor deflects Bob’s speed slowed by his armor (changes combat dynamics) Speed of the top performing weapon (1 hit per second to 1 hit per 2 seconds) The damage of the top performing weapon With this mindset and formula alone, we are already 98% ahead of where you were before (and where most people are when designing games). Notice when most people react to an overpowered weapon, they usually just turn the damage down without knowing A.) Why they are doing it and B.) What their ultimate target is We could even get creative and introduce new designs to balance this. Weapon damage is (reduced or multiplied) by a percentage based on player’s overall level. Health gained per level can slowly decrease (from 10 down to 1) by every level closer to the maximum level allowed. Changing the percentage of damage our armor deflects based on player’s level How easy do items break? By striking the best armor in the game, does it destroy an item faster? If so, would your weapon be destroyed within the amount of time it would take to kill Bob? It can get complicated very quickly, but that’s why we test each change we make to the game one at a time, develop data, and make decisions accordingly. Step 3. Building a finely-tuned machine (perhaps the most important step of all) We can debate, and ponder, and guess all we want about how to balance a game. How to design your game. I know first-hand because I love doing it. It’s fun. It’s fun to dream about how great your game could be, and romanticize about some kind of super complex chemistry mixing system with its own periodic table of elements where player’s can mix to change their genetic codes to enhance stats or change appearances and give them special abilities, and what would happen if blah blah blah. This, my friends, is where I’ve seen more “indie game devs” fail than what I call a ‘dish graveyard’. When I used to work for Dish installing satellite cable, I would see stuff like this. When old people moved out and new people moved in, they would change service, or in most cases, a new dish was just put up because it was easier than adjusting/tracing cables back/swapping parts off an old dish. It was easier to just throw up a new dish. And I say Indies because I’m a fellow indie who’s been plagued by this. I say Indies because most don’t have a team pushing them to focus on their most important KPIs (key performance indicators). It’s fun to make up ideas, get halfway through a project, and come up with some other random idea that you just have to try because motivation strikes. Riding that high of motivation, you jump to the next project, eventually getting bored of that until the vicious cycle begins to repeat itself. We can conquer this by using small tests and tracking our KPIs. We have the ability to test literally anything within our games — and that gets my inner nerd all fluttery and excited. I track things like how many times an item is bought in a specific period of time. I track how often that same item is discarded. If you aren’t tracking stats like these, shame on you! However, we can get super carried away real fast trying to track everything. What do you think is more important to track? How many times a player gets killed (for no specific reason) or; How quickly a player is leveling up (in general) Setting KPIs in the initial phase This is where you need to get solid on specific KPI’s first, preferably straight from the initial design phase. These Key Performance Indicators are going to be the most important benchmarks that you need to hit in your game. They will guide you towards the things that are most important now, and steer you away from the wrong things that will cause you to lose focus. If I were just starting out making a game, my KPIs would be the most basic – Player movement engine (with collision) Basic player animation (walking) Bear bones interaction system If I was trying to balance a weapon, my KPIs would probably look like this; Strongest weapon in the game takes 5 minutes of combat to kill the strongest player in the game Strongest weapon in the game takes 1 minute of combat to kill the weakest player in the game Simple benchmark to hit. The goal is to get something up and playable ASAP so we can begin testing different things with the players. This is another fatal mistake I see so many people make. They spend months (sometimes years) creating this super complex combat-combo-style-point system, only to release it to few (if any) players — (because the developer didn’t want to let people play the game when it wasn’t ‘perfect’, they couldn’t develop a pre-alpha player base) And come to find out, the players hate it. Small test loops is where the real magic happens Using previous benchmarks and data from extensive testing and player feedback, we iterate through small loops. Take action and test based on a small change in our benchmark. Did we hit our KPI? (Did our KPI change?) Repeat. You can only plan something so far. When your work meets the real world, it’s the fine-tuning that will push it over that ‘excellent line’. Because in reality, your players are the market, and as much as it sucks to hear, no matter how much you liked putting in that lizard sword machine gun, if nobody uses it, buys it, or it can kill anything with 1 hit, you will have to adjust it to your player’s (market) demand. Unless you are tracking, planning, and hitting your KPIs (the only things that matter in the initial phase), you’ll easily get sidetracked, overwhelmed, start looking at the wrong things, make bad design decisions, and eventually, lose focus.
  2. This tutorial will walk you through a simple lighting/shadow system. Go into your current Monogame project, and make a new file called lighteffect.fx This file will control the way our light will be drawn to the screen. This is an HLSL style program at this point. Other tutorials on HLSL will be available in the main website which will allow you to do some wicked cool things like; distorting space and the map, spinning, dizzyness, neon glowing, perception warping, and a bunch of other f?#%! amazing things! Here is the full lighteffect file. sampler s0; texture lightMask; sampler lightSampler = sampler_state{Texture = lightMask;}; float4 PixelShaderLight(float2 coords: TEXCOORD0) : COLOR0 { float4 color = tex2D(s0, coords); float4 lightColor = tex2D(lightSampler, coords); return color * lightColor; } technique Technique1 { pass Pass1 { PixelShader = compile ps_2_0 PixelShaderLight(); } } Now, don't get overwhelmed at this code if you aren't familiar with HLSL. Basically, this effect will be called every time we draw the screen (in the Draw() function). This .fx file manipulates each pixel on the texture that is loaded into it, in this case it would be the sampler variable. sampler s0; This represents the texture that you are manipulating. It will be automatically loaded when we call the effect. s0 is a sample register that SpriteBatch uses to draw textures, so it is already initialized. Your last draw function initializes this register, so you don't need to worry about it! (I explain more about this below) RenderTarget2D Render targets are textures that are made on the fly by drawing onto them using spriteBatch, rather than drawing directly to the back buffer. texture lightMask; sampler lightSampler = sampler_state{Texture = lightMask;}; The lightMask variable is our render target that will be created on the fly using additive blending and our light's locations. I'll explain more about this soon, here we are just putting the render target into a register that HLSL can use (called lightSampler). Before I can explain the main part of the HLSL effect, I need to show you what exactly is happening behind the scenes. First, we need the actual light effect that will appear over our lights. I'm showing you this version because the one that I use in the demo is a white transparent gradient, it won't show up on the website. If you want a link to the gradient that I used in the demos above, you can find that at my main website. Otherwise, your demo will look like the image below. You can see black outlines around the circles if you look close. Whatever gradient you download, call it lightmask.png Moving into your main game's class, create a couple variables to store your textures in: public static Texture2D lightMask; public static Effect effect1; RenderTarget2D lightsTarget; RenderTarget2D mainTarget; Now load these in the LoadContent() function. lightMask is going to be lightmask.png effect1 will be lighteffect.fx This is how I initialize my render targets: var pp = GraphicsDevice.PresentationParameters; lightsTarget = new RenderTarget2D( GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight); mainTarget = new RenderTarget2D( GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight); With that stuff out of the way, now we can finally focus on the drawing. In your Draw() function, lets begin by drawing the lightsTarget: GraphicsDevice.SetRenderTarget(lightsTarget); GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); //draw light mask where there should be torches etc... spriteBatch.Draw(lightMask, new Vector2(X, Y), Color.White); spriteBatch.Draw(lightMask, new Vector2(X, Y), Color.White); spriteBatch.End(); Some of that is psuedo code, you have to put in your own coordinates for the lightMask. Basically you want to draw a lightMask at every location you want a light, simple right? What you get is something like this: (The light gradient is highlighted in red just for demonstration) Now in simple, basic theory, we want to draw the game under this texture, with the ability to blend into it so it looks like a natural lighting scene. If you noticed above, we draw the light render scene with BlendState.Additive because we will end up adding this on top of our main scene. What I do next is I draw the main game scene onto mainTarget. GraphicsDevice.SetRenderTarget(mainTarget); GraphicsDevice.Clear(Color.Transparent); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, cam.Transform); cam.Draw(gameTime, spriteBatch); spriteBatch.End(); Okay, we are in the home stretch! Note: All this code is sequential to the last bit and is all located under the Draw function, just so I don't lose any of you. So we have our light scene drawn and our main scene drawn. Now we need to surgically splice them together, without anything getting too bloody. We set our program's render target to the screen's back buffer. This is just the default drawing space for the client's screen. Then we color it black. GraphicsDevice.SetRenderTarget(null); GraphicsDevice.Clear(Color.Black); Now we are ready to begin our splice! spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); effect1.Parameters["lightMask"].SetValue(lightsTarget); effect1.CurrentTechnique.Passes[1].Apply(); spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White); spriteBatch.End(); We begin a spriteBatch whose blendstate is AlphaBlend, which is how we can blend this light scene so smoothly on top of our game. Now we can begin to understand the lighteffect.fx file. Remember from earlier; sampler s0; texture lightMask; sampler lightSampler = sampler_state{Texture = lightMask;}; We pass the lightsTarget texture into our effect's lightMask texture, so lightSampler will hold our light rendered scene. tex2D is a built-in HLSL function that grabs a pixel on the texture at coords vector. Looking back at the main guts of the effect function: float4 color = tex2D(s0, coords); float4 lightColor = tex2D(lightSampler, coords); return color * lightColor; Each pixel that we find in the game's main scene (s0 variable), we look for the pixel in the same coordinates on our second render scene -- the light mask (lightSampler variable). This is where the magic happens, this line of code; return color * lightColor; Takes the color from our main scene and multiplies it by the color in our light rendered scene, the gradient. If lightColor is pure white (very center of the light), it leaves the color alone. If lightColor is completely black, it turns that pixel black. Colors in between(grey) simply tint the final color, which is how our light effect works! Our final result (honoring the color red for demonstration): One more thing worth mentioning, effect1.Apply() only gets the next Draw() function ready. When we finally call spritebatch.Draw(mainTarget), it kicks in the effect file. s0's register is loaded with this mainTarget and the final color effect is applied to the texture as it is drawn to the player's screen. Be careful using this in your existing games, changing drawing blend states and sort modes could funk up some of your game's visuals. You can see a live example of what this system does in a top-down 2D rpg. The live gif lost some quality, the second screen shot shows you how it really looks. You can learn more and ask questions at the original post; http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/
  3. Penkovskiy

    Advertising Through YouTubers

    #2 on 'The Full Strategy' second sentence; "an shooter game"  
  • 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!