Just to let you know that MeshMaker has now been upgraded to version 1.9.2. All of the packages have been tweaked and tested to be compatible with Unity 4.6.2 and 5.0. They have all had minor changes and fixes but the big changes are for Geom.
Geom 2.0 includes the following new features:
- Unity 5 ready.
- New 2D interface with 3 orthogonal views.
- Now possible to move points in the Y axis.
- Insert and Delete control points.
- Unlimited grid sizes.
- Undo/Redo feature.
- Easily enter point positions.
- Save/Load program settings.
- Save/Load frameworks to XML files.
- Custom colors for 2D and 3D views.
- Show/Hide 2D interface.
- Change background picture for tracing objects.
- 15 new starting geometric shapes.
- Numbered control points in 2D and 3D views.
- Synchronized point movement across all grids.
- Automatic prefab creation.
And hopefully I won't be doing too much damage out there by describing my own way of programming and some tips I use for coding style...
By Alan Baylis
To me, this style of programming means writing a program without a definitive plan, documentation, a flow chart or even comments. You just code, save, test and repeat. It is suitable for small to medium sized projects with a solo programmer.
Don't use comments, except to add temporary notes while they are fresh in your mind or to add a todo line. The reason for this is because it will force you to read the code rather than relying on section headers, notes and other aids to memory. You'll get a solid understanding of the code itself and be able to navigate using class and function names alone.
I still prefer to write my main todo list down on a sheet of A4. I don't know why writing the todo list down on paper helps but it does. Call it manifestation or tactile reinforcement but it actually feels satisfying to tick off each point physically. The most important page of notes is the bug list. Record them as you find them on paper and tick those off one by one too. The project isn't finished until both the todo list and bug list are all ticked off.
I do still scribble bits of math and visualize trigonometry on paper but it is still not documentation. By the way, a good understanding of trig and matricies is probably the highest level of mathematics you'll need to program graphics applications. And keep your few pages of notes around after you finish just for posterity.
Each day you should have an idea of how much you can achieve. It might be one main feature of the program or a few small ones but be easy on yourself and get that main functionality working before moving on. After adding a new feature go back and test the other features again to make sure you haven't introduced a new bug.
You will need a good understanding of the language and the API you are working with but mostly on a need to know basis. If you have the time and resources to sit down and read the whole manual all the better, just don't try to retain it all at once. The act of researching and reading webpages on the fly while programming something new is a very organic way to learn rather than by wrote.
On coding style, use real variable names. USE REAL VARIABLE NAMES! This is the only documentation you have so make sure the variable and function names are telling you what they are and what they are doing. Don't use abbreviations or trendy shortcuts except for a few very common ones which I favour like writing the letters "num" before the name of a variable that holds the number of things. Classes and function names start with a capital and variables don't; I also avoid the underscore for private variables but this is just a personal habit of mine. Of course I do always use camelcase notation and you should, must, will, do it too.
In the small piece of code that follows you will notice that my curly brackets are lined up and this is almost mandatory in my coding practice. You'll also notice that there is a space after keywords and no space between a function name and its parameter list. I also write Boolean checks out in full. This saves a small amount of mental gymnastics as to whether the variable is actually a bool or not. Your code should not use the shortest or most obscure language features just to sate your ego. Most of the language abbreviations and advanced features are simply there to save you a small amount of typing. I would rather type a few extra character than have to spend even a microsecond second guessing what a line of code is doing. Remember, without comments, you are the one who may have to reinterpret what this code is doing years after you have written it. Another point I'm serious about is spacing between the arguments when calling a function. This makes the arguments so much easier to read and I often use a decimal point even when it isn't needed just in case I need to come back later and change the value, plus it is visually cleaner. On the subject of curly brackets I very often use them after a conditional statement even when there is only one line of code following it. This again makes the code easier to read and allows me to add lines to the body of the statement at a later date. I even use them in switch blocks between the case and break keywords. An exception to this rule is when I know it is very unlikely that extra lines will be needed later. I also used the GUI.changed variable in an implied manner because the variable was so well named I felt it wasn't necessary.
string tempString = GUI.GetNameOfFocusedControl();
if (mouseUp == false && (tempString == "right"))
mouseUp = true;
if (parent != null)
GUI.color = new Color(0.9f, 1.0f, 0.9f);
GUI.color = new Color(1.0f, 1.0f, 1.0f);
If you write a line or block of code that you decide isn't needed, don't delete it, just comment it out as you may need to add it back in later. The mess this makes is actually a bonus when searching through your code later. The areas of commented out code, which should be a different color like dark green in my experience, adds a topology to the code which allows you to scroll through thousands of lines of code and know exactly where you are. Without using comments to document sections of code this turns out to be almost necessary.
A small trick using comments I use is to temporarily comment out code using the following style:
Commented out code here.
Uncommented out code here.
I can add in or take out large sections of code just by adding or removing the first forward slash.
While hotdogging, also avoid complex structures like multiple inheritance, partial classes or abstract classes wherever possible. I am not an object orientated purist and find that abstracted code adds far too many possibilities for error, though I do find delegates useful for program flow between different classes.
Save very often. Hammer that ctrl-S shortcut. Backup often too, especially once you have achieved the days goals. And not just part of the project, the WHOLE project, and to multiple hard drives. I actually use an incremental save system where I add the date to each saved copy to keep a record of the project development and this allows me to go back to an earlier version if I find I need to. This happens occasionally as serious bugs can creep into a project without you realizing and it is easier to just grab your new sections of code and apply it to an earlier save rather than spend hours debugging. Using Windows Commander to compare a previous file with the new one line by line is also a good way to check for errant changes that may be causing other features to break.
Rightly or wrongly this style of programming has developed over many years and while I certainly wouldn't recommend this for a team of developers or a very large mission critical project, I find it suitable for learning and my own projects.
If you have any thoughts on this programming style or suggestions then you can let me know at...
Alan Baylis firstname.lastname@example.org
More fictional stories here
Have you seen the new and improved Tranquility Lane website yet?
Some new songs I created recently
You can also support this website and developer by purchasing
the MeshMaker Collection for the Unity Game Engine
To learn more about MeshMaker please visit the website here
I'm still working on the next addition to the MeshMaker Collection so it shouldn't be too far away.
Thanks for stopping by!
Alan Baylis email@example.com
The Disinformation Age
By Alan Baylis
It was a surprisingly pleasant afternoon as they roamed the foothills. The temperature was cool but they were all sweating from the weight of the packs and other equipment they were carrying. Ahead of John, the three other members were a stark contrast to the green grass and trees around them, all dressed in white overalls that were getting increasingly dirty each time they stopped and dug a patch of ground. His mind was wandering as he plodded along, listening to the beeps and tones coming from his detector. The digital display showed the typical layers of strata that you would expect but occasionally he would see the traces of previous digs which meant others had already picked over this area. It was still worth a look as their detectors were top of the line and capable of reaching down over three feet further than any other model, depending on the ground below them. Sometimes an extra foot or two was just enough to find the top of a large mound of material that others had been blind to. It had been months since they had had such luck, but that's the life of a prospector, always living on hope and scraping by until the next big find.
The others were beginning to bunch up as usual, just within earshot of each other so they could pass the time talking about anything and everything. He himself liked the quiet, if you discount the constant noises being emitted from the detector, and preferred to hang back at the rear. Naturally there was a small amount of competition between them, even though the profits were to be split equally, so it would be a plus if he could find something the others had casually walked over and missed while chatting away. The sun was a couple of hours off the horizon and it had been a completely uneventful day. The type of day that made him dream about the life of ordinary workers, with their air-conditioned offices, plush chairs and ice cold water dispensers. He was just about to stop for a drink himself when heard a slightly louder ping in his headphones. He backed up a few steps and waved his detector over the spot where he had been and the ping was there again. The display on the detector showed a slightly disturbed area at the full depth of its scan, clearly unnatural and certainly worth a dig. He marked the spot with a few rocks from nearby and rounded up the others to begin the excavation.
After an hour of digging the sun was just starting to fade so they hung a few lights in the trees around them and switched on their headlamps. As they went deeper into the hole that they had created they started to pull out the usual garbage, mostly plastic and bits of rusted metal but there was a lot more of it than expected. Obviously they had found the remains of an old rubbish tip so they started passing up buckets of trash and making piles of it around the top of the hole. After a few more hours of digging they stumbled across what they were hoping for, a nearly complete old computer. It was heavily corroded and had been crushed by the weight of the dirt above but it was clearly intact. Carefully they hoisted the computer up the narrow shaft on a rope and placed it in a clearing under one of the lights. As the others gathered around, John had the honor of prizing the twisted mess of metal apart. They could see the typical parts, cables, motherboard and other cards as they cut into the box but they only cheered when the hard drive popped into view. Depending on what could be salvaged from the disks this one find could fund their digs for another year and if the computer was from the 20th century it would certainly earn them a small fortune. Dealers would pay top dollar for any files that could be authenticated as having been created before the age of disinformation.