Tuesday, March 7, 2017

46. Character Armor Customization Part 1

       After accomplish attaching skinned and non-skinned models to the marine, I was able to add armor customization. In the screenshot above, I added a jet-pack and armor inspired by Captain America to the marine. Now players can change the marine's helmet, chest piece, shoulder pieces, thigh pieces, knees, shins, boots, gauntlets and backpacks. Backpacks are divided into 3 categories: wings, jet-packs and capes. There will also be a section called Presets with armor put together prior. The Captain America armor along with his shield is a preset I created for fun. As much fun as character customization is, modeling and creating all the different individual pieces that players can choose from has been very time consuming. So far, I am pleased with the results. This is update is just the beginning so for Part 2, I plan on putting a video together to show the customization in-game. Also, MonoGame 3.6 released not too long ago and is available for download. It was also announced that MonoGame is coming to Nintendo Switch which is awesome! Now developers dedicated to bringing the joys of XNA 4.0 across different platforms have more options thanks to MonoGame. The first titles created in MonoGame will be Matt Thorson's Tower Fall and Celeste & Concerned Ape's Stardew Valley with multiplayer. 

       For the most part, I modeled the helmet SketchUp and then I later exported it and imported the model Autodesk Maya 2013. Next I modeled my headphones in SketchUp to use as the ear protection for the helmet to give it a unique look. After exporting it and importing it in Maya, I changed the color of the ear pieces, deleted the top  part and scaled it down to size it correctly. This gave the helmet a more "tight-fit" appearance. The headphones were modeled to not only serve at the helmet's ear protection but also to establish a communications link. In the screenshot below, I added a microphone on the left earpiece. 

Captain America's Helmet Model Side View

       Thanks for reading and I look forward to posting my next update. 

Monday, February 20, 2017

45. Blood Splatter Test in Starship Troopers?

       This is based off the starter-kit by Hardworker Game Studios which is outdated. I have updated it and re-programmed it in my game engine built upon the XNA 4.0 and MonoGame Fraweworks with the added blood-splatter. It runs on Windows 7, 8 and 10. This program also can run on other platforms supported by MonoGame. The models are simply just a placeholder. This is the beginnings of the AI which is set to simply wander for now. Bounding spheres are attached to the bones of the enemy models for hit detection. The bullets are rendering in a ray-cast. So when the ray intersects the bounding spheres, blood is emitted. Soon, I plan to change it to where the bullets are actual 3D models that will intersect the bounding spheres of the enemies. I have also added audio for the gun-fire. Later I plan to add my physics engine and the animated mutant spider beast models. I did not add my physics engine just yet because the terrain was outdated and I didn't want the player as well as the enemies falling infinitely. Once my physics engine is added, the hit detection will be far more accurate. Hopefully I will have the real-time fur effect implemented on the animated spider beast model soon.

1.Basic Rendering system with basic effect.
2. Particle System.
3. Basic object management.
4. The XNA Terrain Library is outdated so I will add my own terrain from my game engine later
5. The Cyclone Game Engine's XNAnimation Library
6. Anti aliasing 4X
7. Gun-Fire Sound Effect

Friday, December 16, 2016

44. Computer Repair & Data Recovery

       Hello everyone and welcome back to my new blog post. Unfortunately I haven’t been able to post work-in-progress footage for a couple of months due to a hard disk failure in my desktop computer. Not just any type of hard disk failure, but a RAID 0 hard disk failure.

What caused the circumstance of the hard disk failure?

       I am not entirely certain what caused my hard drives to fail. I recall after a Windows update, my computer had undergone an infinite startup repair loop. There are ways to fix this if you are running Windows 7, 8 or 8.1. To learn more about infinite reboot loops and how to fix them, check out this link.

       When I got to this screen in the image shown above, normally I was able to tap F8 multiple times to disable an automatic restart but it didn't work for some reason.

       Then the next screen in the image shown above appeared. This was the first indication that I noticed something wrong with my RAID 0 hard drives. 

       My computer then displayed this screen in the image shown above. Normally it would boot the system and run, but unfortunately it would pause and being the Startup Repair screen shown next. 

       Windows would run the Startup Repair Recover in search for problems and attempting to fix them. Normally if startup problems can't be repaired, you receive a message stating, "Windows cannot repair this computer automatically."

       Then afterwards, a link would appear called, "View advanced options for system recover and support." Instead, I could only view the diagnostic details.

       After clicking Finish, my computer would not shutdown. Instead, it would restart and begin the same process over again. 

       Somehow, I was able to opt out of it and with the help of Alienware's community forums, I was able to attempt an emergency file and folder backup. 

       Then, as the Emergency File & Folder Backup began to make an attempt… my worst nightmare occurred. After trying to run the diagnostic, my computer crashed and a blue screen appeared.

       Luckily, I stored all of my Steel Cyclone Studios projects and files along with my most important data on two separate internal desktop hard drives. However, the RAID 0 hard drives contained the only record of my personal and professional life over the past many years, as well as family pictures. In short, I was devastated but I didn’t give up. The guys over at Part Plus informed me that even they couldn't retrieve my information because of how RAID 0 was setup; even said that they didn't know of anyone to fix it. I remained calm, maintained my composure and tried coming up with several solutions. 

       With help from the guys over at Parts Plus, I was able to take out the two working hard drives with my studio files and install them into a new tower. To help cover the cost of the new tower, my trade in of my older Alienware Aurora desktop helped decrease the price; especially with the Geforce GTX graphics cards I that were installed.  

       My new tower came equipped with a superior cooling system through thermo-tech and the main C-drive came with Windows 10 installed. This time around, I am mainly keeping the operating system on the C-drive and all of my other programs and files on the other hard drives. In short, my computer has been reincarnated. Last, I just had to obtain my research from the damaged RAID 0 hard drives. 

Why is RAID 0 difficult to recover data from?

       Unfortunately, unlike all other versions of RAID, when a RAID 0 fails you have to recreate it. I was unaware at the time that my desktop had a raid 0 hard-drive configuration. When they fail to work; this can be a programmer’s worst nightmare. Essentially with raid 0, half of my data was stored on one hard drive and the rest is stored on a second hard drive. RAID 0 basically writes you’re your data to DISK 1 and half your data to DISK 2. When the array fails, it’s extraordinarily difficult to recover your data. The simplest disk failure will take down the whole array because the date is broken up into fragments. Majority of my research was stored on the raid 0 hard drives and I needed to obtain it. I learned an important less; that is backup everything especially if you are using a RAID 0 configuration. For further information as to why its so difficult to recover data from RAID 0 check out this link

How to Recover from Raid 0 Hard Drive Failures

       In my case, I had to send both hard drives off to a data recovery service where they recovered the data. It was not a cheap solution however it was very reliable than some of the other existing methods I came across. I found a company called Secure Data Recover Services which provides repair treatment with all types of hard drive failures including read/ write head crashes, electronic damage and more. The closest lab facility located near me was in Louisville, KY. Fortunately, there was a no cost appraisal of the damage. The customer service there was excellent. After receiving my request, Mitchell Moore contacted me further with excellent assistance throughout the whole process. This was a huge relief for me to be able to communicate with a human and not something entirely automated. To any self-aware robots reading this in the future, I don’t mean to offend you. He answered all of my questions and possible concerns. 

       Mitchell and his team were able to provide diagnostics and discovered that the Read/ Write Heads were torn and bent. Unfortunately, they had to address the issues in a clean room where both the hard drives were imaged. After the imaging process was complete, the RAID was reassembled into the correct configuration and the data was extracted. After the information was extracted, my data was transferred into an external hard drive and shipped back to me through FedEx. I received an email the next day with information about when the hard drive would arrive. The entire recovery process was complete within one week with the new external drive arriving safe and sound. I feel like I got my life’s history back. So if you are someone or if you know someone with a RAID 0 hard drive failure, I highly recommend contacting Secure Data Recovery Services in a heartbeat. 

       Thank you Parts Plus and Secure Data Recovery Services! After I install my programs, I will finally be able to continue my game development work. A special thanks to all of my supporters for your patience. 

Wednesday, November 2, 2016

43. How to Add Splash Screens to the Menu System

       The following tutorial is based on the Game State Management Sample and shows how to add splash screens as the startup of the game. This tutorial also works with the Network Game State Management Sample. I have posted my entire class below with comments that you can add to your screens folder. I named mine SplaceScreens.cs and make sure to change the namespace of this class to match you project. Also check out Robot Foot Games' tutorial on how to add multiple columns to the Game State Management Sample.

#region File Description
/*  ============================================
 *  SplashScreens.cs
 *  ============================================
 * Upon the game's startup, Splash Screens are shown. The first screen shows the 
 * company logo and then it slowly fades away and displays the game engine logo. 
 * After the game engine logo fades away, the user is taken to the Title Screen.

#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace CycloneGameEngine
    class SplashScreens : GameScreen
      #region Fields
      public enum GameType { Splash1, Splash2}
      GameType gametype = new GameType();
      #region Splash Screens

      #region Studio Logo
      Texture2D StudioLogo;
      float logoFade = 0;
      bool wasNorm = false;
      bool logoStarted = false;
      #endregion End of Studio Logo

      #region Engine Logo
      Texture2D EngineLogo;
      float logoFade2 = 0;
      bool wasNorm2 = false;
      bool logoStarted2 = false;
      #endregion End of Engine Logo

      #endregion End of Splash Screens

        ContentManager content;

        #region Initialization

        // Constructor.
        public SplashScreens()

        // Loads graphics content for this screen. The background texture is quite
        // big, so we use our own local ContentManager to load it. This allows us
        // to unload before going from the menus into the game itself, wheras if we
        // used the shared ContentManager provided by the Game class, the content
        // would remain loaded forever.
        public override void LoadContent()
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            StudioLogo = content.Load<Texture2D>("Images/Splash_Screens/logo2Main");
            EngineLogo = content.Load<Texture2D>("Images/Splash_Screens/Engine-Logo");

        // Unloads graphics content for this screen.
        public override void UnloadContent()


        #region Update and Draw

        // Updates the background screen. Unlike most screens, this should not
        // transition off even if it has been covered by another screen: it is
        // supposed to be covered, after all! This overload forces the
        // coveredByOtherScreen parameter to false in order to stop the base
        // Update method wanting to transition off.
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                       bool coveredByOtherScreen)
            #region Update the 1st Splash Screen
            gametype = GameType.Splash1;

            // If we are at the splash screen
            if (gametype == GameType.Splash1)

                if (!logoStarted)
                    logoStarted = true;

                // Fade the logo in , then out.
                if ((logoFade <= 245) && (wasNorm == false))
                    logoFade += (float)0.8;
                if (logoFade > 244)
                    wasNorm = true;
                if ((logoFade > 11) && (wasNorm == true))
                    logoFade -= 1;
                if ((logoFade < 11) && (wasNorm == true))
                    gametype = GameType.Splash2;
            #endregion End of Drawing the 1st Splash Screen

            #region Update 2nd Splash Screen
            if (gametype == GameType.Splash2)

                if (!logoStarted2)
                    logoStarted2 = true;

                // Fade the logo in , then out.
                if ((logoFade2 <= 245) && (wasNorm2 == false))
                    logoFade2 += (float)0.8;
                if (logoFade2 > 244)
                    wasNorm2 = true;
                if ((logoFade2 > 11) && (wasNorm2 == true))
                    logoFade2 -= 1;
                if ((logoFade2 < 11) && (wasNorm2 == true))
            #endregion End of Drawing the 2nd Splash Screen

            base.Update(gameTime, false, false);


        // Draws the splash screens.
        public override void Draw(GameTime gameTime)
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            #region Draw the 1st Splash Screen
            if (gametype == GameType.Splash1)
                // Set the background color to black
                spriteBatch.Begin(SpriteSortMode.Texture, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, null);

                // Draw the logo to screen.              
                spriteBatch.Draw(StudioLogo, new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2 - (StudioLogo.Width / 2), ScreenManager.GraphicsDevice.Viewport.Height / 2 - (StudioLogo.Height / 2)), new Color(255, 255, 255, (byte)logoFade));

                // End the spritebatch
            #endregion End of Drawing the 1st Splash Screen

            #region Draw the 2nd Splash Screen
            if (gametype == GameType.Splash2)
                // Set the background color to black
                spriteBatch.Begin(SpriteSortMode.Texture, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, null);

                // Draw the logo to screen.              
                spriteBatch.Draw(EngineLogo, new Vector2(ScreenManager.GraphicsDevice.Viewport.Width / 2 - (EngineLogo.Width / 2), ScreenManager.GraphicsDevice.Viewport.Height / 2 - (EngineLogo.Height / 2)), new Color(255, 255, 255, (byte)logoFade2));

                // End the spritebatch

            #endregion End of Drawing the 2nd Splash Screen

Thursday, October 20, 2016

41. Deferred Rendering

       Roy Trieesscheijn has an updated XNA 4.0 version of Catalin Zima's Deferred Rendering Sample. You can read all about it here on Roy's blog. Above is a screenshot of it in action. I have also uploaded the sample to my Indie DB page. So I give a special thanks to Roy for the awesome conversion and Catalin Zima for the original sample. The deferred rendering sample uses directional and point lights and comes equipped with a normal mapping and custom content processor with multiple materials. I plan on adding deferred rendering to the Cyclone Game Engine. 
       One big advantage of deferred rendering is that it will allow your games and or game engines to render a huge number of dynamic lights very efficiently. Right now it is used in Cry Engine, Unreal Engine, Frostbite and many other games and game engines. This rendering technique has quickly become the standard for high quality graphics in games. Deferred Rendering will allow for a huge number of effects to be added to your games. These effects include SSAO, HDR Rendering, Bloom, Per-Pixel Lens Flares and Soft Particles just to name a few. 

Indie DB: download

Sunday, September 18, 2016

40. Plants & Vegetation

       Hello and welcome to my next engine update. My apologies for the long wait. I recently started a new job a while ago and I am adjusting to my new schedule while trying to make time for working on the game engine. Oh, before I forget, the date located in the right hand corner of the following images below were not updated. So... let's get started! With the help of the billboards sample, I recently got the vegetation processor to work in my game engine. As stated on the billboards link, the vegetation processor renders a very large number of billboard sprites using a vertex shader to perform computations entirely on the GPU. Its a fake way of rendering complex objects without bothering to render a full 3D model. This technique helps performance so that there is no additional CPU load from rendering billboards compared to normal static geometry. I tested the vegetation processor in my sample menu system's 3D scene. Initially I encountered some rendering issues with the positioning and transparency of the grass billboards on the 3D terrain model. 

Fixing the Position

       The first of many issues I encountered after getting the grass billboards working in the scene was fixing their position. In the image above, the grass billboards were rendering in the scene but they were positioned way above the terrain model. Click on the image above to see the grass billboards more clearly. They were so far away, it appeared as if there were starts in the sky. In a nutshell, I needed to multiply the view, projection, and world Matrices together to render the grass billboard images over the terrain. Multiplying these three Matrices together get the WorldProjView matrix which is a calculation that can turn a 3D object into pixels.

What is the View Matrix?
       Basically the View Matrix or the View Transform locates the viewer in world space, transforming the vertices into camera space. The View Matrix represents the position and orientation of the camera. The camera, or viewer is the origin, looking in the positive z-direction. It is created by passing in the camera location, where the camera is pointing and by specifying which axis represents “Up” in the universe.  XNA uses a Y-up orientation, which is important to be aware of when creating 3D models.  Blender by default treats Z as the up/down axis, while 3D Studio MAX uses the Y-axis as “Up”.

What is the Projection Matrix?
       The Projection Matrix or Projection Transform can be thought of as the actual camera lens which is used to convert 3D view space to 2D.  The Projection Transform is mainly a scale and perspective projection. The Projection Matrix converts the viewing frustrum into a cuboid shape. It is created by specifying calling CreatePerspectiveFieldOfView() or CreateOrthographicFieldOfView(). As a general rule, for a 2D game you use Orthographic, while in 3D you use Perspective projection.  When creating a Perspective view we specify the field of view ( think of this as the degrees of visibility from the center of your eye view ), the aspect ratio ( the proportions between width and height of the display ), near and far plane ( minimum and maximum depth to render with camera… basically the range of the camera ).  These values all go together to calculate something called the view frustum, which can be thought of as a pyramid in 3D space representing what is currently available.

What is the World Matrix?
       The World matrix is used to position your entity within the scene.  Essentially the World Tranfrom positions ans places a model in a 3D world.  A World Transform changes coordinates from model space, where vertices are defined relative to a model's local origin, to World Space, where vertices are defined relative to an origin common to all the objects in a scene. So in addition to positional information, the World matrix can also represent an objects orientation.

In short, think of it like so:

  • View Matrix = Camera Location
  • Projection Matrix = Camera Lens
  • World Matrix = Object Position/Orientation in 3D Scene

In short, by multiplying these three Matrices together in the first pass rendering of the the billboards, positioned them correctly. Further explanation is below in the source code. You can read more information about matrices and cameras in my second blog post.

       Now that the position was fixed, I encountered another issue which is the transparency. With the help of Shawn Hargreave's blog post on depth sorting alpha blended objects, I was able to solve it. Check out the source code to my terrain's draw method with the source code from the billboard sample integrated below. Its not perfect by any means, but its a decent start.

public void DrawTerrain(Model model, Matrix view, Matrix projection, Matrix world)
            Matrix[] transforms = new Matrix[model.Bones.Count];

            // First we draw the ground geometry using BasicEffect.
            foreach (ModelMesh mm2 in model.Meshes)
                if (mm2.Name != "Billboards")
                    foreach (BasicEffect be2 in mm2.Effects)
                        ScreenManager.GraphicsDevice.BlendState = BlendState.Opaque;
                        ScreenManager.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                        ScreenManager.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

                        be2.View = view;
                        be2.Projection = projection;
                        be2.World = transforms[mm2.ParentBone.Index] * world;

                        be2.AmbientLightColor = new Vector3(0.1f);
                        be2.SpecularPower = 5;


            // Then we use a two-pass technique to render alpha blended billboards with
            // almost-correct depth sorting. The only way to make blending truly proper for
            // alpha objects is to draw everything in sorted order, but manually sorting all
            // our billboards would be very expensive. Instead, we draw in two passes.
            // The first pass has alpha blending turned off, alpha testing set to only accept
            // ~95% or more opaque pixels, and the depth buffer turned on. Because this is only
            // rendering the solid parts of each billboard, the depth buffer works as
            // normal to give correct sorting, but obviously only part of each billboard will
            // be rendered.
            // Then in the second pass we enable alpha blending, set alpha test to only accept
            // pixels with fractional alpha values, and set the depth buffer to test against
            // the existing data but not to write new depth values. This means the translucent
            // areas of each billboard will be sorted correctly against the depth buffer
            // information that was previously written while drawing the opaque parts, although
            // there can still be sorting errors between the translucent areas of different
            // billboards.
            // In practice, sorting errors between translucent pixels tend not to be too
            // noticable as long as the opaque pixels are sorted correctly, so this technique
            // often looks ok, and is much faster than trying to sort everything 100%
            // correctly. It is particularly effective for organic textures like grass and
            // trees.
                foreach (ModelMesh mm2 in model.Meshes)
                    if (mm2.Name == "Billboards")
                        // First pass renders opaque pixels.
                        foreach (Effect effect in mm2.Effects)
                            ScreenManager.GraphicsDevice.BlendState = BlendState.Opaque;
                            ScreenManager.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                            ScreenManager.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
                            ScreenManager.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

                            // At first, only the camera's view was just stored in the effect 
                            // parameter's value for view. Then I multiplied the terrain model's 
                            // parent bone index ( transforms[mm2.ParentBone.Index] ) which is 
                            // what the world matrix is equivalent to by the camera's view matrix
                            // to fix the position. If we recall, the world matrix is the object's 
                            // position and orientation in the 3D scene. So in order to position 
                            // it correctly, it needed to be multiplied by the camera's 
                            // location which is the camera's view matrix (the variable view).

                            effect.Parameters["View"].SetValue(transforms[mm2.ParentBone.Index] * view);


                        // Second pass renders the alpha blended fringe pixels.
                        foreach (Effect effect in mm2.Effects)
                            ScreenManager.GraphicsDevice.BlendState = BlendState.NonPremultiplied;
                            ScreenManager.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead;



       Now that the positioning and transparency of the grass billboards are fixed, I plan on adding different grass images later to give it more of a variety. If you have found this blog post helpful with your XNA and or MonoGame projects, please comment below. Thanks for reading..

Friday, June 3, 2016

39. Engine Update 5 Teaser

       This is a brief video teaser sneak peek of my next game engine update. Everything is still a work-in-progress. Since rigged and non-rigged models can be attached to the character now, I am working on character customization. Soon, players will be able to customize their armor. They will be able to swap out head-wear such as hats, helmets and mask. Soon they will also be able to swap between chest pieces and knee guards. This might not be fully shown in the next video update but I have this working for the most part. As players progress through the game, the upgrades to their suit will greatly improve their gameplay experience. Lately, I have been building up content for creating the models and assets that will go into the game world. I am improving artificial intelligence at the moment. This is just a teaser, so it will be a while before my next engine video update. I have been focusing on my 2D game and my independent studies to further educate myself and make far more progress. I am taking some time off and working on the gameplay! So excited. Below are some more screenshots of some fun I had with armor customization.

Saturday, May 14, 2016

38. How to Install MonoGame for Visual Studio 2015

37. Install XNA on Visual Studio 2015!

       This video will guide you to install XNA Framework in your Visual Studio. Having difficulty to follow this lesson, feel free to download the ready to use extension for VS 2015 here. Find the XNA4-VS2015.zip file.

36. XNA 4.0 Parallax Occlusion Mapping


       Recently, I came across Electronic Meteor's blog post which updated the Parallax Occlusion Mapping Sample to XNA 4.0. In short, parallax mapping is a way to make textures pop out. It's a very efficient way to add depth to a texture, so there is no tessellation here. Parallax Occlusion Mapping was utilized in the hit first-person shooter game called Crysis. This sample also demonstrates another technique called Normal Mapping. In this sample you can switch between the techniques to see each of their effects. The sample was originally created by Alex Alvarex Urban and updated to XNA 3.1 by Canton Javier Ferrero. Thanks to Chris, the sample was updated to XNA 4.0, however he ran into some problems getting the particle system to work. In time, I was able to fix it. I have made the source code available at the following link below for download. If you have found this sample helpful or run into any problems, please comment below.

Also, on a side note, make sure under the File Properties for the smoke.png image, click the drop-down arrow under Content Processor and set the following values like so if they aren't already:

Color Key Enabled = True
Generate Mipmaps = True
Premultiplay Alpha = False
Resize to Power of Two = False
Texture Format = DxtCompressed


Friday, May 13, 2016

35. Creating A Universally Free Education


       In this blog post, rather than showing my next game engine update which would still be too early at the moment, I am going to talk about something else. That is, how can we make education universally free if not more affordable. My outlook on education might seem nontraditional and unconventional to many but this is primarily due to the fact that I am for the most part self-taught. Independent studies became my only option to pursue game development because I couldn't afford to the attend the colleges I was accepted to. To my surprise, independent studies became the best option for me. I didn't pursue game development with the intent to make a lot of money; I just simply wanted to learn it. Like myself, there are many who simply just want to pay rent and get an affordable education in their field of interest, but the predatory student loan system is making a profit off of our desire to do so. I have always believed in a virtually free higher education. Higher education cannot be a luxury for a privileged few. It is an economic necessity that every family should be able to afford, and every person with a dream and ambition should be able to access. Why do I believe in making a free higher education? Simply put, education is a human right. With that said, you are probably reading thinking:

  • How will teachers get paid?
  • How is it going to be free?
  • Who will see the value in a free education?

       We need to see the value in higher education, and I am not talking about the price tag. The value of having a great quality education is that it can change your life – it can help improve your quality of life. For now, if you are reading this, I just want you to visualize what America would look like if there were to be a free higher quality education. What would that look like? It wouldn’t matter was “Class” you are. It wouldn’t matter what sort of income you make to have this. It wouldn’t even matter where you live because it will be accessible everywhere- in every library, in every school, from every home because it would be made accessible online. No, I am not necessarily talking about online classes. For now, I want you to imagine all of the endless possibilities if education were made free and feel free to post comments below of what you came up with. Education will then be utilized as a way for people to become free of poverty and the “Rich or Upper Class”, the “Middle Class” and the “Poor Class” will be virtually pretty much gone. My belief, my dream is for this country to have a free higher education.

       If this were to truly be free then there will be one so called “Class” in America. I would simply like to call it “The Human Class”. The real reason why we have classes began to divide further apart traces back years ago ever since books were invented. Ever since the first book printed with movable type, created by Gutenberg, this posed a new opportunity as well as a problem. People could access books because they were so full of ‘Knowledge and facts’ and in this was seen as a problem because those in authority saw the “Value” in books. It was a problem to them because jobs at the time were chosen for you. So by making books more accessible, it would allow people to learn different skills outside of the job they were given. Later books were distributed with soaring prices, prices so high that only the few could afford them. This is what made the gap between classes even wider, thus adding fuel to the segregation between the “rich” and the “poor”. I realize I am omitting and skipping a lot of information but just bare with me.

       We need to move education in America to the 21st century. I explain more below brainstorming solutions as to how we can do that:

1.) Video Tutorials
       What if America created a Universal Virtual School that can be accessed online that provided clear comprehensive tutorials taught be some of the best professors in the country that is fully accredited? This is very realistic especially with the advancements in technology we have today. You will learn from the greatest minds of the best professors in the country as well as around the world. What if America paid the professors up front to help create these great quality video tutorials? To further help these professors, what it these videos they help create were published on this virtual school’s YouTube Channel and monetized thus further adding to their salary? The goal of the video tutorials will be to break down hard subjects and topics in easy-to-understand language. With this feature, the student can follow along as they watch the video and pause, fast-forward, and rewind the video at any time in case they missed something or wanted to hear something repeated again. We have seen this work well with YouTube video tutorials as well as resources like Khan Academy, Thinkwell, and Lynda.com.

       The goal is to allow students to essentially work at their own pace and not feel rushed. This would be great for non-traditional students coming to school. This would also be great for students who are working a job or two and or raising a family by helping to work around their schedule. They can create their own schedule to match their needs so that their job doesn’t feel like its compensating for their course work. With video tutorials like these, students will not have to worry about when to sign up for a class and what days and hours the classes are because they are all videos and can be accessed at any time if they were to sign up for this virtual school. This will eliminate many “excuses” and “problems” students run into in traditional schools and colleges. All schools whether it be public or private high-schools and colleges will be able to utilize these video tutorials to be used in the classroom and engage students in new ways. Today’s education system disengages students in schools.

2.) Notes
       What if this Universal Virtual School provided Lecture Notes in the form of pdfs and Power Points to review the material from the videos, complete with key concepts and definitions that students will need to remember?

3.) Interactive Games & Simulations
       What if this school provided students with interactive games and simulations to put into practice their knowledge so they can actually apply what they have learned?

4.) Innovative Test & Quizzes
       What if this Universal Virtual School created by America gave test and quizzes (that are not timed!)? You can’t fully see what someone knows by setting a time-limit. These quizzes will let you put your knowledge directly into action. When you, the student gets your quiz results back, they don’t simply just list which ones you got wrong. They will show you how to work each problem and explain what sort of mistakes you might be making. That is the goal! To help students learn from their mistakes. Knowledge cannot be strictly determined by how many questions students got right or simply multiple choice. These quizzes will score each of its questions out of a percentage by looking at the steps the student takes to arrive to their answer. The questions in the quizzes can change if a student decides to take it over to avoid cheating but they will be ‘similar’. If a student wants to do better they can take the test & quizzes over as many times as they please. 

The Problem with Standardized Testing & How We Determine Grades
       I will explain briefly why I don’t think standardized testing truly determines someone’s intelligence. For one, many students completely guess! I will give a prime example from a personal experience of mine. I had two friends who took the same multiple choice math test. One got an A and the other barely got a B. The one who got an A wasn’t necessarily more knowledgeable or smarter than my friend who got a B. Why you may ask? I looked at both of their test thoroughly. My friend who got the B clearly knew more because I saw him work out the problems to arrive to his answer and I was upset at how close apart the optional answers were on this test. I mean very close. I saw how he worked out his problems and although he got the wrong answer he actually understood what he was doing. By seeing how he worked out his problem, I was able to see his thought process. My friend who got the A had barely anything written down, didn’t work through the problems, didn’t really prepare for the test. I asked him how did he get an A and he simply said, “Dude, I completely guessed on all of them haha!” This kind of irritated me a little. The problem I see in education is that we measure someone’s intelligence on standardized test strictly by how many they got right or wrong without knowing their thought process and many students are taught to guess the “most probable” answers.

"Genius is one percent inspiration, ninety nine percent perspiration."
-- Thomas Alva Edison

       Knowledge should not be strictly limited and determined by how many questions students got right or simply multiple choice. Today's standard grading methods don't always reflect a student's effort or knowledge because they don't show their thought process as to how or why they arrived and concluded their answer. Grades can sometimes be damaging as teachers, parents and students alike use them to either encourage or discourage others. I can't tell you how many times I've been asked what were my SAT and ACT scores. All those times in school I witnessed students laugh and put down someone because they scored higher on a test or an assignment. The parent patting their son or daughter on the back when they see all A's on their report card but never saw their actual work, oblivious to whether or not they cheated, or even bothered to ask what all did they learn. Grades can also be damaging because it teaches students that getting wrong answers or making mistakes are bad, when in fact, making mistakes is a huge part of the learning process. Once big misconception I had when I was younger adults would tell me was that if you fail in school or end up with bad grades, you won't be successful later in life. Don't let an exam determine your fate!

"Students are forced to accept their grades, which, over time, cause students to eventually internalize a life-long view of themselves as “smart,” “average,” or “dumb” — with profound impact on their lives. However, students do not get to officially grade teachers. If a student receives an F, it is assumed the student failed, not the teacher."
-- John Bell
Director of Leadership Development, YouthBuild USA

5.) eBooks
       What if this Universal Virtual School provided the world’s largest library of books that can be accessed by all. These eBooks can be looked at and viewed freely online through this Universal Virtual School. This school would pay the authors to make thier books viewable. It would also provide the option to students to purchase hard-copies if they wanted to and they can be sent to their home address.

       To conclude, this is not necessarily like online classes. Many online classes work great and many are not so great. Online classes can be missed, whereas these are video tutorials which can be accessed any point in time. Also, my idea of this Universal Virtual School is not necessarily created to somehow replace colleges, but to provide people an alternative option. So whatever your reason may be, whether you couldn't afford to attend a university, lack the confidence, or if it's personal - this can help. Something like this will not necessarily work for every major but it will be highly beneficial. An example of such a major is becoming a doctor which you must be present to understand surgeries hands-on but the doctorate program can still utilize this Universal School as far as videos, tests and quizzes. This Universal Virtual School could potentially work in-conjunction with colleges, allowing students to transfer credits over.

       For example, a student who wants to be a doctor can use this Universal Virtual School to save money and get their General Education course requirements out of the way such as English Composition, Math, Science, etc. thus saving them money for when they go into the core work of their doctorate program. Students can use this Universal Virtual School to transfer credits in to earn certain degrees. What makes this unlike most traditional colleges is that you as the student, can work and learn at your own pace and eventually graduate in your own time. It might take you longer than somebody else and that’s OK. Also, if you are interested in learning game design, art and or programming, check out my Resources page. I highly recommend it!

       Redefine how you view education. Its absurd to limit the term 'education' to a person's formal schooling. There is more than one way in this world to be an educated man or woman. So when I refer to creating a universally free education, I am not limiting it to strictly college because then it would be difficult to answer how will teachers get paid. My goal with this blog post was also to show you that there are so many resources out there, many in which you probably have or might not have been even aware of. Thanks for reading and feel free to share your thoughts below.

"Intelligence plus character; that's the goal of a true education."
-- Martin Luther King Jr.

"An educated person is one who has so developed the faculties of their mind that they may acquire anything they want, or its equivalent, without violating the rights of others." 
-- Napoleon Hill

Friday, April 15, 2016

34. Playing Sound Effects

       The video above I came across is the fourth part of a MonoGame tutorial series. It covers all aspects of audio programming, playing music, sound effects, and even creating audio using XACT from the XNA tools. Below I show how I got sound effects working better recently in XNA. Sound is crucial as it helps to further bring the game to life. In XNA, sound is pretty straightforward. Import the sound into your project, just like you did with textures. WAV is the preferred format in most environment, however MP3 should be fine too. Other than the project knowing the existence of the sound, the program must store it too, so you will need to create a SoundEffect object with a suitable name. I will use the name Gear1SoundEffect as an example based of my vehicle physics program. The command should be:

Gear1SoundEffect = content.Load(“gear1”);

Now, to get this to play, you will use a function that is built into the class, conveniently,


This will play the sound effect once and then stop.

        Although you can overlap sounds without any problems, if you repeatedly play the same effect at a high rate, the sound will be distorted beyond all recognition. Check out the first time I ran into this problem in an older video of mine here as an example. I needed to limit the rate at which the sound effect was being played using timers; especially since the game program is now running at high frame-rates. So if you have been wondering why most my videos thus far don't have any sound, this is the reason as to why.

       To fix this I created an object called SoundEffectInstance, assigning it the returned object from Gear1SoundEffect.CreateInstance(). After that, all I did was call it’s Play() function. This class has many interesting functions that I suggest you check out on MSDN. Other than Pause(), Stop() and Resume(), an additional function is Apply3D(), which gives it a position in 3D space, taking as arguments one or more listeners and an emitter. This will probably not be of use to you currently, but if you move into 3D XNA programming, it will be of great value.

       Note that you may have up to 16 different SoundEffectInstance object playing simultaneously, this should be more than enough however. Now you can add some life to your game, essentially anything that does not require rotation of images can now be done with what you know.

For more information, check out this article here.

If you found this blog post helpful, please comment below. Thanks for reading and happy coding!

Wednesday, April 13, 2016

33. Basic Car Drifting Physics

       After some trial and error, I was able to get some drifting mechanics working for my vehicle physics. I am continuing to modify and improve the JigLibX Physics Library that I ported over to XNA 4.0 and MonoGame. Inside my Wheel.cs (wheel class), the key was a variable named "smallVel". This variable applies a force between the drive force and the side force. Initially, it was set to three and I decided to change it to 20 for this vehicle. At the moment, it feels like I am driving on ice but it is controllable which makes it a lot of fun to drift. 

Make the following changes so that the car doesn't slide around too much when stopped: 

            float smallVel;
            if (angVel == 0 & !locked)
                smallVel = 1;
            else smallVel = 20;

To give it more of an authentic feel, you can decrease smallVel to tweleve. I also greatly improved the handling. I will most likely create a starter kit based off of this sample program. So if you are using XNA 4.0 or MonoGame and need some on-road, off-road or arcade style car physics, this will help.

Triangle Mesh Collision Problem
       Many developers using JigLibX in XNA had many problems with the Triangle Mesh Object, especially when using it as a ground model but not with the Height Map Object. I sometimes run into these issues. When a physics object hits a vertex or seam between triangles in the mesh, strange things can occur. 

       I separated the garage model into multiple meshes; just two for the most part. Using Autodesk Maya, I then selected them all, grouped them and finally exported the selection. You might have to separate models that have a lot of triangles and faces into separate models. JigLibX uses models that support 16-bit indices in size and not 32-bit. Below is a sample of  my JigLibX TriangeMeshObject.cs code that lets you extract the vertices and indices from a loaded model.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using JigLibX.Geometry;
using JigLibX.Physics;
using JigLibX.Collision;

namespace JigLibXGame
    class TriangleMeshObject : PhysicObject
        TriangleMesh triangleMesh;
        Matrix xform;
        public TriangleMeshObject(Game game, Model model, Matrix orientation, Vector3 position)
            : base(game, model)
            body = new Body();
            collision = new CollisionSkin(null);
            triangleMesh = new TriangleMesh();
            List<Vector3> vertexList = new List<Vector3>();
            List<TriangleVertexIndices> indexList = new List<TriangleVertexIndices>();
            ExtractData(vertexList, indexList, model);
            triangleMesh.CreateMesh(vertexList, indexList, 4, 1.0f);
            collision.AddPrimitive(triangleMesh, new MaterialProperties(0.8f, 0.7f, 0.6f));
            // Transform
            collision.ApplyLocalTransform(new JigLibX.Math.Transform(position, orientation));
            // we also need to move this dummy, so the object is *rendered* at the correct 
            // body.MoveTo(position, orientation);
            this.body.CollisionSkin = this.collision;

        // Helper Method to get the vertex and index List from the model.
        public void ExtractData(List<Vector3> vertices, List<TriangleVertexIndices> indices, Model model)
            Matrix[] bones_ = new Matrix[model.Bones.Count];
            foreach (ModelMesh mm in model.Meshes)
                Game.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
                xform = bones_[mm.ParentBone.Index];
                foreach (ModelMeshPart mmp in mm.MeshParts)
                    int offset = vertices.Count;
                    Vector3[] a = new Vector3[mmp.NumVertices];
                    int vertexStride = mmp.VertexBuffer.VertexDeclaration.VertexStride;
                    mmp.VertexBuffer.GetData<Vector3>(mmp.VertexOffset * vertexStride, a, 0, mmp.NumVertices, vertexStride);
                    for (int i = 0; i != a.Length; ++i)
                        Vector3.Transform(ref a[i], ref xform, out a[i]);

                    // new
                    for (int i = 0; i < a.Length; i++) vertices.Add(new Vector3(a[i].X, a[i].Y, a[i].Z));

                    if (mmp.IndexBuffer.IndexElementSize != IndexElementSize.SixteenBits)
                        throw new Exception(
                            String.Format("Model uses 32-bit indices, which are not supported."));
                    short[] s = new short[mmp.PrimitiveCount * 3];
                    mmp.IndexBuffer.GetData<short>(mmp.StartIndex * 2, s, 0, mmp.PrimitiveCount * 3);
                    JigLibX.Geometry.TriangleVertexIndices[] tvi = new JigLibX.Geometry.TriangleVertexIndices[mmp.PrimitiveCount];
                    for (int i = 0; i != tvi.Length; ++i)
                        tvi[i].I0 = s[i * 3 + 2] + offset;
                        tvi[i].I1 = s[i * 3 + 1] + offset;
                        tvi[i].I2 = s[i * 3 + 0] + offset;
        public override void ApplyEffects(BasicEffect effect)
            //effect.DiffuseColor = Vector3.One * 0.8f;

       Next I will be making a way where the player can switch to cockpit-view and drive in first-person perspective while in-game. Thanks for reading and I look forward to posting more updates. If you have found this blog post helpful or would like to share any improvements, please comment below.