Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

30. April 2011

While working on an upcoming beginners guide to Wings, I put some thought into something I had never really thought about before…  what the heck was the “Crease” command for?  Functionally it seemed identical to extruding an edge along its normal.  After some messing around though, I figured out the very small but somewhat important difference between the two commands.

The following video shows the difference in action.

Extrude vs Crease in Wings 3D

 

As you see, with Extruding, a 5 sided polygon is created just past the edge that was extruded.  With crease the polygons are created using the next available vertex along the edge.  This is a very minor distinction, as otherwise the two functions are almost identical, but the effect is most pronounced once smoothing is applied.

CreaseVsExtrudeResults

 

So, damned near the same, but slightly different.  But in answer the question “Whats the difference between extruding and crease?” the answer is “not much”.

Art

30. April 2011

6a00d8341c858253ef00e54f2306618834-640wiSo, choosing Blender for my art pipeline has some very big upsides, and a couple massive downsides.

 

Amongst the biggest downsides is that Blender is in the midst of a very long move from 2.4x to 2.5x, which means you are effectively using beta software in production.  Frankly, the 2.5x branch is probably as stable as the 2.4x branch with some major feature improvements.  That said, there is a giant downside… all kinds of documentation is simply and massively WRONG.

I just spent 2 hours trying to get a textured model into Unity, and for the love of all that is, I simply couldn’t get textures to work.  After many google sessions, I read that TexFace needs to be enabled… simply press F5 or F9, but again, these instructions are for 2.4x and are outdated.

I finally found the way after much confusing.

Properties->Material Icon ( the Ball )->New Material->Assign, then scroll down to Options and click Face Textures.  Done.  That was intuitive now, wasn’t it?

 

The following video illustrates that process.  Again of key note If you are using Blender with Unity, your textures WILL NOT WORK if you do not follow this process.

 

Enabling TexFace in Blender 2.56

Art , ,

29. April 2011

I just received the following email and thought I would pass it on.  I’ve received a few of these offers, so if you are looking to purchase in the future, wait for the next promo.

 

Greetings,

At Unity, we love games and want to see your game on mobile devices. To help get your Unity-powered game live in the App Store or available on any of the 30 million-plus Android devices out there, we are offering you a 20% discount on your purchase of a Unity iOS or Unity Android license. Simply visit our online store by April 30th and enter UFRM0430 when asked for your Rebate Code.

Unity Mobile - 20% off

Enjoy,
The Unity Team

Both links edited as they contained tracking info linked to my email address.

General

26. April 2011

So today, after 6 days of downtime I get word from Sony that apparently mine and 75 million other accounts have been compromised, including pretty much all of my personal information. Worst of all, this information included my password and possibly my credit card information.

 

This is an unforgiveable sin on many levels, but more than anything I have to say this… if you are storing sensitive information in your game, encrypt the hell out of it!  Really, it’s not that hard.  Actually here is how you do it…  this is code I have used in another project, but sadly I forget exactly where I got it from for proper crediting.  So, if you are the author, let me know and I will give proper accreditation.

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace ConfigurationLibrary
{
    public sealed class CryptoString
    {
        private CryptoString() { }
        private static byte[] savedKey = ASCIIEncoding.UTF8.GetBytes("YOURVALHERE");
        private static byte[] savedIV = ASCIIEncoding.UTF8.GetBytes("YOURVALHEREASWELL");
        public static byte[] Key
        {
            get { return savedKey; }
            set { savedKey = value; }
        }
        public static byte[] IV
        {
            get { return savedIV; }
            set { savedIV = value; }
        }
        private static void RdGenerateSecretKey(RijndaelManaged rdProvider)
        {
            if(savedKey == null)
            {
                rdProvider.KeySize = 256;
                rdProvider.GenerateKey();
                savedKey = rdProvider.Key;
            }
        }
        private static void RdGenerateSecretInitVector(RijndaelManaged rdProvider)
        {
            if(savedIV == null)
            {
                rdProvider.GenerateIV();
                savedIV = rdProvider.IV;
            }
        }
        public static string Encrypt(string originalStr)
        {
            // Encode data string to be stored in memory.
            byte[] originalStrAsBytes = Encoding.ASCII.GetBytes(originalStr);
            byte[] originalBytes = { };
            // Create MemoryStream to contain output.
            using(MemoryStream memStream = new
                     MemoryStream(originalStrAsBytes.Length))
            {
                using(RijndaelManaged rijndael = new RijndaelManaged())
                {
                    // Generate and save secret key and init vector.
                    RdGenerateSecretKey(rijndael);
                    RdGenerateSecretInitVector(rijndael);
                    if(savedKey == null || savedIV == null)
                    {
                        throw (new NullReferenceException(
                                "savedKey and savedIV must be non-null."));
                    }
                    // Create encryptor and stream objects.
                    using(ICryptoTransform rdTransform =
                           rijndael.CreateEncryptor((byte[])savedKey.
                           Clone(), (byte[])savedIV.Clone()))
                    {
                        using(CryptoStream cryptoStream = new CryptoStream(memStream,
                              rdTransform, CryptoStreamMode.Write))
                        {
                            // Write encrypted data to the MemoryStream.
                            cryptoStream.Write(originalStrAsBytes, 0,
                                       originalStrAsBytes.Length);
                            cryptoStream.FlushFinalBlock();
                            originalBytes = memStream.ToArray();
                        }
                    }
                }
            }
            // Convert encrypted string.
            string encryptedStr = Convert.ToBase64String(originalBytes);
            return (encryptedStr);
        }
        public static string Decrypt(string encryptedStr)
        {
            // Unconvert encrypted string.
            byte[] encryptedStrAsBytes = Convert.FromBase64String(encryptedStr);
            byte[] initialText = new Byte[encryptedStrAsBytes.Length];
            using(RijndaelManaged rijndael = new RijndaelManaged())
            {
                using(MemoryStream memStream = new MemoryStream(encryptedStrAsBytes))
                {
                    if(savedKey == null || savedIV == null)
                    {
                        throw (new NullReferenceException(
                                "savedKey and savedIV must be non-null."));
                    }
                    // Create decryptor and stream objects.
                    using(ICryptoTransform rdTransform =
                         rijndael.CreateDecryptor((byte[])savedKey.
                         Clone(), (byte[])savedIV.Clone()))
                    {
                        using(CryptoStream cryptoStream = new CryptoStream(memStream,
                         rdTransform, CryptoStreamMode.Read))
                        {
                            // Read in decrypted string as a byte[].
                            cryptoStream.Read(initialText, 0, initialText.Length);
                        }
                    }
                }
            }
            // Convert byte[] to string.
            string decryptedStr = Encoding.ASCII.GetString(initialText);
            return (decryptedStr);
        }
    }
}

Now its as simple as calling ConfigurationLibrary.CryptoString.Encrypt(somestring);  and ConfigurationLibrary.CryptoString.Decrypt(somestring).

 

It is this easy to encrypt your info, compromising your users security is never justified!  Just be sure to protect your encryption keys as much as possible.

 

For the record, I don’t know if Sony encrypted this information or not, but they haven’t communicated that they did, which leads me to believe that they didn’t.  If they did, Sony has done a horrible job at PR.  If they didn’t, Sony made a mistake a first year CS student never should have!  Either way, Sony just screwed up really badly.

Programming, Totally Off Topic , ,

26. April 2011

blender_logoSo, I am a bit late to the party as this was actually announced on the 22nd, but the newest version of Blender, 2.57a has been released.  As Blender is one of the primary tools we will be using to create our game even a minor bug fix release is important.  A full list of bug fixes is available here.  No new shiny sexy features, but 100 less bugs is nothing to sneeze at.

If you haven’t already, go ahead and download Blender here.

Art

Month List

Popular Comments