Jump to content
Sign in to follow this  
  • entries
  • comments
  • views

March 31, 2018 Weekly Update - Untouched Earth Game Development Blog



Wow! Very productive week full of new opportunities, new items, and new bug fixes. I must say, development seems to be progressing wonderfully (fingers crossed I didn’t just jinx myself 😊). The game’s fun level continues to increase, and, to me, that’s the whole point of agonizing over the minute details of code and animation – to give others a fun experience.
***Original blog post can be found by clicking here***
Updates this week include:
  1. Continued developing level three (about 50% complete)
  2. Fixed the artificial intelligence and decision making on enemy characters
  3. *Spotlight* Created a “Spinning Wheel” obstacle
  4. *Spotlight* Created a “Springy Platform” obstacle
  5. *Spotlight* Created a “Smasher” obstacle
  6. *Spotlight* Created two new characters called “Howler 2” and “Piper”
  7. Started creating a new Booster – “Slow time”
  8. *Spotlight* Created and implemented a rendering algorithm to Frames Per Second.
  9. Fixed a bug causing enemy health decrementation to be inconsistent
  10. Fixed the code that caused the “Howler” enemy to freeze when landing
  11. Fixed an error causing bullets to instantly be destroyed and not collide with enemies
Spotlight 1: Created a "Spinning Wheel" obstacle
I’m in love with this obstacle! It’s incredibly fun and presents a tough challenge to the hero. I died multiple time when testing it, but the thrill of successfully maneuvering it was invigorating.
Basically, the obstacle has six platforms the player can jump on. Each platform moves around a center point at a duration and intensity set by the code. The first challenge was getting the six platforms to rotate around the center in harmony. I tried to create a script to manage the movement, but it was a big failure (failure is okay though!). Ultimately I ended up attaching an animator component and just creating an animation in the unity editor. The wheel spins faster by simply increasing the animation speed – Simple...so I thought.
The startDelay variable causes the animation to wait for a number of seconds before starting. The animation variable refers to the types of animation available - either an animation where the "Spinning Wheel" moves and pauses or an animation where the "Spinning Wheel" moves continuously.
Here's where a big error came in. The hero was not staying put on the platforms. The platforms would rotate out from under him, and he would fall to his untimely death (brought a tear to my eye to see such potential wasted so unfairly). I ended up creating a script for each platform that determined whether or not the platform was touching the hero. If it was, the platform script adjusts the hero’s position to keep him on top of the platform.
heroScript refers to the script attached to the hero. If the hero is colliding with the platform, the touchingHero variable is set to true. This variable then signals that a change in position each must be calculated (deltaPosX & deltaPosY) during the FixedUpdate(). This change in position is then added to the hero's transform to correct his position.
It worked like a charm! The spinning wheel was complete, and I could set how fast it moved in the unity editor. I created two modes for it: pause and continuous. Pause mode (featured in the video below) puts a brief pause in between rotations, whereas continuous mode rotates without any breaks.
Spotlight 2: Created a “Springy Platform”
The springy platform was pretty simple to make, and only took about an hour or so of development time. I had never used the SpringJoint2D, so it took some trial and error to make the obstacle usable. I love how it turned out, though! The character can land on it and bounce, making it hard to keep his footing. It really presents a challenge to game play, but, just like the “Spinning Wheel”, feels great when you defeat it! Victory!
Spotlight 3: Created a “Smasher” obstacle
I had originally created a larger smasher obstacle that would plummet downward upon the hero and send shock waves of crushing force through his body! This obstacle is simply an adaptation of that obstacle, but gave me a few challenges. The obstacle is intended to be used when the hero is climbing down a rope or vine. However, if the hero falls from the rope or vine and lands on the “Smasher” he is unable to move and receives damage until he dies. I foresaw rage quitting if I didn’t fix this bug. I ended up updating the hero’s detection manager to include “Smashers” as elements the hero can move on. (see the detection manager section of the game mechanics section if you’re not familiar with the detection manager).
Spotlight 4: Created two new characters called “Howler 2” and “Piper”
Two new characters joined the world, and boy oh boy do they make my skin crawl. Creepy and scary with a hint of horror. One of the characters, who I uniquely named “Howler 2”, is an adaptation of the “Howler” Character – Thank you again HQ game assets for making great assets. I did some art work to make him spookier, and augmented his script to make him more lethal. He’s able to evade hero attacks, is bigger, stronger, and can leap further than the “Howler.” The other character is called “Piper.” He is a distance based character that fires bolts of energy at the hero and runs away when the hero gets close. He’s a real challenge, but a lot of fun to beat up.
Spotlight 5: Created and implemented a rendering algorithm to increase game speed.
This update was huge! HUGE! There was a very serious problem where the frames per second were absolutely horrible when playing the game on a solid gaming PC. I realized I simply had far too many game objects active at once. I did a little research into several topics including object pooling, and ultimately created an algorithm that sets certain sections of the map active and other sections of the map inactive. I created a “Render Trigger” game object, which is basically just a game object with a trigger component, and set them up across the entire world. You can find the entire code below. Super simple and super effective! The game looks stunning, fluid, and has crazy high FPS now.
The sections that are active are loaded into the render array in the unity editor. The sections that are inactive are loaded into the sleep array. When the hero touches the trigger, the render game objects are set active and the sleep game objects are set inactive
As always, thank you for reading. I would love to hear from you and would love to hear any comments or ideas you have. Feel free to leave a comment or email me at watermoongames@gmail.com.
***Original blog post can be found by clicking here***
***Visit Untouched Earth website for more details***


Recommended Comments

Thanks! He’s actually a purchased asset from the unity store that I only made the animations for. They did a great job creating him. Too much fun to fight!:D

Share this comment

Link to comment

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 ggenije
      Important: I am trying to realize in scrtach which is performance very low due to it's "virutal level" scrtach->flashplayer->java...
      Also i'm new to this forum so i'm sorry if I missed group (like last time)
      Like a title is saying:
      I have project ,and I get negative feedback on it because some people need 30 min to complete it (what is the planned time)
      but problem is that some people need EVEN 5 hours…(game is incremental/idle/upgrade type so it's important to keep same time ...)
      Of course people with slower computer will have less fps so game will be slower for them,
      so I have created TimeDelta system for each frame to calculate something to do per second
      for example
        Update(){move(TimeDelta*speed)}  so that mean it will be moving speed number of pixels(or units) per second so it will be same for almost each user.

      But problem is next:
      I have to change ySpeed by jumpPower (#PlayerJump in my project)
      when any jump button is pressed
      then in each frame decrease ySpeed by gravity it is(-10 * TimeDelta)
      but when someone have lower fps it will have higher TimeDelta and will fall faster but with same jump it turns out to jump significantly lower that changes core of game
      BUT even worse if fps suddenly in moment of jump then timeDelta would be 1 so player will jump much much MUCH higher , then fall much slower because timeDelta changed in meanwhile…(and the point of my game is about upgrading jump not complete game in first fps drop)


      Then I got an idea to fix TimeDelta (like in unity for rigibody) so it will be rounded like
      if calculated TimeDelta is 0.01834 it will be 0.02 fixed
      if weaker computer is using it the TImeDelta will be 0.143 so runded to 0.14 and so on…

      I did not manage to realize it… i tried to calculate it before main initialization of game objects
      but I'm afraid to fps will drop in moment that is calculating so it will be much diffirent…
      I was trying with empty loop(400)(in scrtach even this is taking time) to calculate it but i'm not sure is it right

      So is there good way to realize this fixed TimeDelta
      I only have timer function to use and time difference between frames
    • By trapazza
      I'm trying to add some details like grass, rocks, trees, etc. to my little procedurally-generated planet. The meshes for the terrain are created from a spherified cube which is split in chunks (chunked LOD).
      To do this I've wrote a geometry shader that takes a mesh as input and uses its vertex positions as locations where the patches of grass will be placed (as textured quads).
      For an infinite flat world (not spherical) I'd use the terrain mesh as input to the geometry shader, but I've found that this won't work well on a sphere, since the vertex density is not homogeneous across the surface.
      So the main question would be: How to create a point cloud for each terrain chunk whose points were equally distributed across the chunk?
      Note: I've seen some examples where these points are calculated from intersecting a massive rain of totally random perpendicular rays from above... but I found this solution overkill, to say the least.
      Another related question would be: Is there something better/faster than the geometry shader approach, maybe using compute shaders and instancing?
    • By FedGuard
      Hello all,
      I would like to start off with thanking you all for this community. Without fora like these to assist people the already hard journey to making an own game would be exponentially more difficult. Next I would like to apologize for the long post, in advance...
      I am contemplating making a game. There, now that's out of the way, maybe some further details might be handy.
      I am not some youngster (no offence) with dreams of breaking into the industry, I am 38, have a full-time job, a wife, kid and dog so I think I am not even considered indie? However I recently found myself with additional time on my hands and decided I would try my hand at making a game.Why? Well mostly because I would like to contribute something, also because I think I have a project worth making (and of course some extra income wouldn't hurt either to be honest). The first thing I realized was, I have absolutely no relevant skill or experience. Hmm; ok, never mind, we can overcome that, right?
      I have spent a few months "researching",meaning looking at YouTube channels, reading articles and fora. Needless to say, I am more confused now than when I started. I also bought some courses (Blender, Unity, C#) and set out to make my ideas more concrete.
      I quickly discovered, I am definitely not an artist... So I decided, though I do plan to continue learning the art side eventually, I would focus on the design and development phase first. The idea being, if it takes me a year or more solely learning stuff and taking courses without actually working on my game, I would become demoralized and the risk of quitting would increase.
      So I thought I would:
      1: Keep following the courses Unity and C# while starting on the actual game development as the courses and my knowledge progress.
      2: Acquire some artwork to help me get a connection with the game and main character, and have something to helm keep me motivated. (I already did some contacting and realized this will not be cheap...). Also try to have the main character model so I can use it to start testing the initial character and game mechanics. For this I have my first concrete question. I already learned that outsourcing this will easily run up in the high hundreds or thousands of dollars... (lowest offer so far being 220 USD) I am therefore playing with the idea of purchasing https://assetstore.unity.com/packages/3d/animations/medieval-animations-mega-pack-12141 with the intention of then have an artist alter and/or add to the animations (it is for a Roman character so some shield animations are not going to work the same way.). This way I could start  with the basic character mechanics. Is this a good idea, waste of money,...? Any suggestions? I then have a related but separate question. Is it a good idea to buy Playmaker (or some other similar software I haven't yet heard of like RPGAIO), and using this for initial build, then changing/adding code as the need arises?
      3.Get a playable initial level ready as a rough demo and then starting to look for artist for level design and character/prop creation.
      I would really appreciate some input from more experienced people, and especially answers to my questions. Of course any advice is extremely welcome.
    • By GameTop
      Dirt Bike Extreme - another game made with Unity. Took about 2 months to complete.
      Take part in extreme motorcycle races across the dangerous and challenging tracks. Dirt Bike Extreme is easy to pick up but hard to master. Race, jump and crash your way and other mad rivals through the amazing tracks as you master the skills and physics of motocross in this high-speed racing adventure. Conquer challenging routes on 23 different runs, discover new bikes and become the best of the best! Over 257K downloads already!
      Windows Version:

      Mac Version:


    • By CommanderLake
      I've been experimenting with my own n-body simulation for some time and I recently discovered how to optimize it for efficient multithreading and vectorization with the Intel compiler. It did exactly the same thing after making it multithreaded and scaled very well on my ancient i7 3820 (4.3GHz). Then I changed the interleaved xy coordinates to separate arrays for x and y to eliminate the strided loads to improve AVX scaling and copy the coordinates to an interleaved array for OpenTK to render as points. Now the physics is all wrong, the points form clumps that interact with each other but they are unusually dense and accelerate faster than they decelerate causing the clumps to randomly fly off into the distance and after several seconds I get a NaN where 2 points somehow occupy exactly the same x and y float coordinates. This is the C++ DLL:
      #include "PPC.h" #include <thread> static const float G = 0.0000001F; const int count = 4096; __declspec(align(64)) float pointsx[count]; __declspec(align(64)) float pointsy[count]; void SetData(float* x, float* y){ memcpy(pointsx, x, count * sizeof(float)); memcpy(pointsy, y, count * sizeof(float)); } void Compute(float* points, float* velx, float* vely, long pcount, float aspect, float zoom) { #pragma omp parallel for for (auto i = 0; i < count; ++i) { auto forcex = 0.0F; auto forcey = 0.0F; for (auto j = 0; j < count; ++j) { if(j == i)continue; const auto distx = pointsx[i] - pointsx[j]; const auto disty = pointsy[i] - pointsy[j]; //if(px != px) continue; //most efficient way to avoid a NaN failure const auto force = G / (distx * distx + disty * disty); forcex += distx * force; forcey += disty * force; } pointsx[i] += velx[i] -= forcex; pointsy[i] += vely[i] -= forcey; if (zoom != 1) { points[i * 2] = pointsx[i] * zoom / aspect; points[i * 2 + 1] = pointsy[i] * zoom; } else { points[i * 2] = pointsx[i] / aspect; points[i * 2 + 1] = pointsy[i]; } /*points[i * 2] = pointsx[i]; points[i * 2 + 1] = pointsy[i];*/ } } This is the relevant part of the C# OpenTK GameWindow:
      private void PhysicsLoop(){ while(true){ if(stop){ for(var i = 0; i < pcount; ++i) { velx[i] = vely[i] = 0F; } } if(reset){ reset = false; var r = new Random(); for(var i = 0; i < Startcount; ++i){ do{ pointsx[i] = (float)(r.NextDouble()*2.0F - 1.0F); pointsy[i] = (float)(r.NextDouble()*2.0F - 1.0F); } while(pointsx[i]*pointsx[i] + pointsy[i]*pointsy[i] > 1.0F); velx[i] = vely[i] = 0.0F; } NativeMethods.SetData(pointsx, pointsy); pcount = Startcount; buffersize = (IntPtr)(pcount*8); } are.WaitOne(); NativeMethods.Compute(points0, velx, vely, pcount, aspect, zoom); var pointstemp = points0; points0 = points1; points1 = pointstemp; are1.Set(); } } protected override void OnRenderFrame(FrameEventArgs e){ GL.Clear(ClearBufferMask.ColorBufferBit); GL.EnableVertexAttribArray(0); GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); mre1.Wait(); are1.WaitOne(); GL.BufferData(BufferTarget.ArrayBuffer, buffersize, points1, BufferUsageHint.StaticDraw); are.Set(); GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, 0, 0); GL.DrawArrays(PrimitiveType.Points, 0, pcount); GL.DisableVertexAttribArray(0); SwapBuffers(); } These are the array declarations:
      private const int Startcount = 4096; private readonly float[] pointsx = new float[Startcount]; private readonly float[] pointsy = new float[Startcount]; private float[] points0 = new float[Startcount*2]; private float[] points1 = new float[Startcount*2]; private readonly float[] velx = new float[Startcount]; private readonly float[] vely = new float[Startcount];  
      Edit 0: It seems that adding 3 zeros to G increases the accuracy of the simulation but I'm at a loss as to why its different without interleaved coordinates. Edit 1: I somehow achieved an 8.3x performance increase with AVX over scalar with the new code above!

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!