Custom Nerf Guns

Lately I’ve been watching a lot of videos about prop making and cosplay. I’m not sure I’m bold enough to dress up myself but I really like the idea of making amazing looking costumes and props from such cheap materials. Unfortunately living in London means our flat is tiny and there’s no space for a workshop or even a spare room. Fortunately my wife is awesome and she suggested that we take a long weekend off work so that we could scratch our creative itches. Leave was booked, craft shops, builders merchants and toy shops were visited and a number of Amazon orders were made.

My original plan had been to replicate a large rifle from Borderlands 2 using foam and PVC pipe. However after watching Adam Savage’s video where he built a custom Nerf rifle in a day I decided to give it a go.

The first attempt

Nerf Strongarm

I picked up one of the cheaper Nerf blasters on sale in a toy shop for under a tenner. It’s called a Strongarm, and it seems pretty oversized for a pistol so I thought it would probably make a pretty cool looking Sci-Fi weapon.

Strongarm colour scheme

First I had to decide how I wanted to paint it. I found a template on the web, and using a pallet of the spray paint colours I had available planned out the colour scheme. The project finally gave me a chance to use my Dremel so I got to work removing the raised Nerf logo, Strongarm branding and the safety instructions from the blaster. This left the plastic a bit chewed up so I tidied it up with a few different grits of wet and dry sandpaper.

Nerf Strongarm with black base coatNext up I disassembled the blaster making sure to take lots of pictures of how the internals fitted together. Then I sprayed the whole thing with a matte black spray paint as a base coat.

Spray paint having a bad reactionOnce it was dry I sprayed the entire blaster with a bright blue spray paint. This is where I hit my first problem. The paint started curling and creating a weird scaly texture. I jumped on to the Facebook group for The PropTarts of Punished Props (a group for fans of the Punished Props YouTube channel) to ask for some advice. Amazingly over thirty people replied to give me advice, what a great community!

It seems the most likely cause was that I had used a solvent based paint for the base layer and the blue acrylic paint had reacted to it. Lesson learned. When it was dry I smoothed out the worst of it with some wet sandpaper and it didn’t look too bad. One of the other suggestions I was given was that spray paint works best if both the can and the surface you’re spraying are warmed up first. So I gently warmed one of the two pieces that make up the slide using a heatgun. It promptly melted and deformed. Second lesson learned. After a bit of heating and bending I managed to get it to fit back on the blaster but it was still pretty mangled.

Next up I masked off the sections I wanted to stay blue leaving only the grip and the “tactical rail” uncovered and sprayed them gloss black. In hindsight I think I probably should have gone with a more matte black but it was beginning to look like my plan.

Custom spray painted Nef Strongarm

As you can see from the image above I chipped quite a lot of paint off of the cylinder while trying to fit the two halves back together. It took a considerable amount of force to get it back together and in the end I resorted to covering it with a tea-towel and hitting it with a rubber mallet. There’s got to be a better way.

With the blaster reassembled I gave the whole thing a coat of a matte clear top coat. Once it had cured I started work on the weathering, touch-ups and finer details. I was pretty proud of the end result.

Custom painted Nerf Strongarm

The second attempt

Nerf Firestrike

Having discovered what not to do and armed with some actual primer I figured I’d give it another go. So the following weekend I started work on a smaller pistol, a Nerf Firestrike Elite. It’s a single shot blaster with an integrated “laser sight”. It has a very futuristic looking silhouette and I thought I could probably get it done fairly quickly as it’s much smaller than the Strongarm above.

I looked around online for an existing template to work out the colour scheme on. I was unable to find one so I threw one up together in Illustrator. It’s not perfect but it’s good enough fo figuring out a colour scheme. Please feel free to use it if it’s useful to you, the outline image to the right links to an A4 transparent version.

Firestrike colour schemeHaving bought a few more colours of spray paint I decided to go with a lighter and more muted colour scheme this time to see how that would work out. I also wanted to break up the shapes of the gun a bit so I used the moulding of the gun to separate the sections of colours.

Nerf Firestrike prepped for spray paintingAs before I ground off the NERF logo, Firestrike branding and the safety instructions. I used a much lower speed this time and that left me with a lot less sanding to do afterwards. Then I roughed up all the surfaces of the blaster with some wire wool to give the paint something to grip into.

Spray painted Nerf FierstrikeThe whole thing got painted with a grey primer and left to dry. Once it was dry I sprayed the whole thing once again with a slightly different shade of grey spray paint. Then the masking began. It took quite a while to cover all of the sections I wanted to stay grey. I used 3M blue painters tape and a scalpel to mask as accurately as I could and then sprayed the ivory coloured sections. When I peeled off the tape I was pretty pleased with the results (and confident I could hide any mistakes with weathering later on). The grip got sprayed matte black and the barrel got sprayed silver.

I decided that I didn’t want to mask up the whole thing again to spray they cylinder at the front silver so I painted that in with a brush along with the screws and  the plaque. I did the same thing for the black dial above the grip. The handle got a matte clear coat and the rest of it got a gloss clear coat. Then I had to reassemble the blaster and reconnect the wires and laser, again taking lots of pictures before made this a lot easier than it could have been. Next up came the weathering and a final clear coat which left me with this.

Custom painted Nerf Firestrike

…and the rest

So I got a little carried away and won an eBay auction for someone’s Nerf collection. So now I have thirteen more blasters of varying styles and sizes to work on. I’m sure I’ll post the finished versions online as I get them finished.

The Nerf Arsenal

Solid, practical and cheap(ish) laptop

I’ve been fortunate enough to be supplied with MacBook Pros for my last few jobs, including my current role. I passed my own (now aged) MacBook Air on to my Wife when we met and since then I’ve been pretty much using my work machines for personal stuff too.

I was thinking about buying a cheap, reliable laptop for web browsing, coding and other odds and ends. Unfortunately the requirement that it should be cheap pretty much disqualified all Apple products. So I thought I’d look through eBay and see what I could find.

The keys feel very similar to, or possibly better than, those on the MacBook Pro.

In the end I settled on a Lenovo ThinkPad T430 (circa 2012). I chose it because it was available under £250, had a reasonable spec, solid build quality and a very, very nice keyboard. The model I bought was an i7 2.90Ghz with 8GB of RAM, NVIDIA NVS 5400M graphics, a 500GB HDD, DVD-CDRW and a 1600 x 900 antiglare display.

The first modification I made was replacing the optical drive with a HDD caddy and relocating the original HDD there. I then installed the cheapest 240GB SSD I could find as the boot drive.

ThinkPad DVDRW & HDD Caddy
I mean seriously, who needs an optical drive in 2017?

Next up I installed Windows 10 Pro and dual booted it with Linux Mint. I followed an online guide to setup a development environment in Windows, although I expect the Windows partition will mostly be used for coding C# in Visual Studio. I set up the Linux partition as I’ve never experimented with Linux before and this seemed like a good opportunity.

The trackpad was showing its age and had that weird spotty texture that only seems to exist on ThinkPads. It turns out the entire surface is just a sticker. So I peeled it off and replaced it with a smooth trackpad surface made to fit the T430.

Hey that’s smooth

So now I had a machine that ran the OSes I was interested in playing with, held a good charge, had a usable trackpad, a secondary drive for storage and booted up quickly thanks to the SSD. The one remaining and somewhat unexpected issue was the screen. The antiglare TN panel fitted to the T430 is one of the worst displays I have ever seen. It had to go.

A bit of research later and it seems that I was by no means alone in my assessment of the display. Several other users had investigated alternative displays. Sadly it seems there are no IPS displays that are a straight swap. The best alternative appears to be the AlienWare M14X R2 glossy display. The first one I ordered from eBay was a bust as they lied in the description and shipped me the same antiglare panel I already had. In the end I found the panel from laptopscreen.com. The difference is night and day, it’s still not an IPS display but the viewing angles are significantly better and the image is so much sharper.

All in all I’m pretty impressed with this ex-corporate brick. It boots up almost instantly thanks to the SSD. The fingerprint scanner is a surprisingly handy addition and works flawlessly with Windows Hello. The discreet graphics, although old, have turned out to be surprisingly capable. I’ve played Darksiders, Tony Hawks HD and Grid 2 at reasonable frame-rates without issues. On the flip-side rendering in blender is pretty lacklustre, the BMW scene renders in 38 minutes. However for under £350 all in it’s a pretty competent all-rounder!


The things I wish I’d known before I started

You can use sellotape to remove the HDD if it has lost its tab
If you watch any of the many YouTube videos on changing the HDD in a ThinkPad you’ll see how you simply undo one screw, slip off the plastic cover, fish out the tab, give it a tug and you’re done. Sadly it turned out that when I tried this my HDD had no tab to tug.
I contemplated a few approaches to retrieving the stubborn storage device, needle-nosed pliers, supergluing wire to it, even disassembling most of the laptop to get better access. Eventually I figured I should try using some tape. It was pretty fiddly to thread the tape between the HDD and the edge of the enclosure, and then to get it to stick to the HDD but I managed it on the third try. One gentle tug and the drive was out.
The standard display on the T430 is truly an abomination
If I had realised how bad the screen was I would probably have spent the extra for a newer ThinkPad that came with an IPS display. I genuinely hadn’t realised how spoilt I had been by the screens on the Apple laptops I’ve had over the years.
Replacement screens are harder to find than I anticipated
I bought an allegedly 1600 x 900 glossy screen from eBay. I removed the screen that was in the laptop and then fitted the new one. Only to discover that when I removed the protective film it wasn’t a glossy screen at all. It was exactly the same antiglare (matte) screen that I had replaced. After a bit of arguing with the supplier, swapping the screens back over and a trip to the post office I managed to get my money back. I then managed to source a replacement from laptopscreens.com. I suppose scarcity of parts for a 5 year old laptop is to be expected but you need to be careful when buying screens online, there are a lot of misinformed dishonest sellers out there.
Make sure you disconnect the battery before swapping displays
In the interests of full disclosure the machine pictured in this post is not the machine I’m using. It’s an i5 model that I did all of the upgrades on. Unfortunately in my excitement to get rid of the awful display that came with the machine I forgot to disconnect the battery. I took the old display out, swapped the new one in and booted it up. The screen showed an image but it was only visible under a very strong light. Some research online led me to believe that I blew a fuse on the motherboard that controls the power to the backlight.
Disassembling the entire machine and a quick continuity test with a multi-meter seemed to confirm my suspicions. I considered my options, a new motherboard would have been around £100, the proper tools to replace a surface mount fuse would have been well over £100 and neither would guarantee a working machine. So I went back on to eBay and bought a second ThinkPad (the i7 mentioned above) and transferred all of the upgrades over to the new machine. I’m hoping I can sell the other one for spares/repairs.

Building a PC for Blender

I’ve been playing with blender for a while now and I’ve reached the point where my laptop is just not up to the job. I have increasingly found that I abandon projects as adjusting materials and lighting requires hour long renders to see the difference. Having considered all the options;

  • Buying a newer Mac
    This doesn’t really make sense as it may not actually be an improvement as Apple tend to use AMD graphics cards and Blender seems to work best with NVIDIA cards.
  • Buying a secondhand Mac Pro and upgrading the graphics card(s)
    Having spent some time researching this route there doesn’t seem to be much useful information available. It seems that the graphics cards might need flashing to make Mac OS recognise them and the risks involved were too large. Plus the cost of a recent, pre-dustbin, Mac Pro and a good graphics card was equivalent to building a new PC from scratch.
  • Building a Hackintosh
    There’s tons of information out there for people that want to go down this route. I had a very cheap netbook running Mac OS X a few years back and it mostly worked fine but there were enough issues that made me not want to rely on it.

ComponentsI decided that I would bite the bullet and build a Windows PC. Despite the fact that I haven’t used Windows regularly for nearly twenty years and I’ve never built a PC before. So after about six months of research I placed my order and the next day many, many boxes arrived.

The full list of components is on PC Part Picker but essentially the build consists of a water-cooled Intel i7 3.3Ghz 6-core processor, 32Gb of RAM, an NVIDIA GTX 980ti, two 240GB SSDs and two 3TB HDDs.

What do I do with all of these things?

With all of the parts in hand and an entire day to myself I set about trying to put the machine together. I’ve watched countless hours of LinusTechTipsJayzTwoCents and the Awesomesauce Network over the last few months, I thought I was ready.

It turns out that building a PC is a lot more fiddly than the professionals above make it look. I intentionally bought a case that has a reputation for being easy to build in and I’m glad that I did. The instruction book that comes with the case walks you through what to install, how and in what order. Nearly every component I ordered came with a fairly hefty manual or installation guide.

Despite all of the instructions I still hit a few snags. I didn’t connect a cable to the 8-pin power connector at the top of the motherboard before installing the H110i’s radiator. This meant some very careful manoeuvring to get it out without having to disconnect everything.

I also didn’t appear to have a 4-pin cable for my power supply. On my motherboard there’s a 4, 8 and 24-pin socket for power cables. The manual makes it very clear that you must connect all of them for it to operate correctly. I looked around online and it seems that I was not alone in my confusion, plenty of other people could also not find their 4-pin cable. Apparently the 4-pin socket is optional and is only necessary for people that want to increase the voltage to their CPU for hardcore overclocking. So I didn’t connect one and the PC seems to be working fine.

I found cable management more difficult than I expected too. I chose to go all out and had some white, individually sleeved CableMod PSU cables to compliment the build. They look nice enough but I found trying to get them to look neat pretty challenging. Ordering some cable combs and a bit of fiddling seem to have solved that issue now though. Cable management in the back of the case was also a little hairy. I had planned on making it a work of art back there but after fighting with spaghetti for half an hour I decided it was neat enough and the side panel fitted without too much resistance so I called it a day.

Building the PC took me all day in the end, including clearing up all the packaging, manuals, screws, and other ephemera. I’m sure if I were to build another machine it would take a lot less time and I’d be aware of the potential pitfalls along the way. Considering how it turned out I’d say it was a pretty good days work.

Even the fans are black and white
Yes it has a window, yes it has lights
Yes it has a window, yes it has lights, try not to judge me…

 Bringing it to life

I’m not going to lie, I was pretty sure that it wouldn’t boot first time but surprisingly it started up fine. I inserted my Windows 10 flash drive and happily clicked through the install. It went without a hitch and pretty soon I was greeted by a Windows desktop. As the machine has no optical drives I plugged in an Ethernet cable and was pleasantly surprised to see that it automatically connected with no issues.

I got to work installing drivers for the motherboard, the graphics card, the cooler, everything went fairly smoothly. Until I rebooted. On booting up the machine asked for the password I had set a few minutes ago. I entered it and it resolutely refused to accept it. I know the password that I entered was correct but Windows refused. I tried the reset password option and Windows helpfully asked me to insert the CD I didn’t have. So I booted back to the installer, formatted all the disks and went through the whole process again. Fun times.

I read/watched a bunch of tutorials on oveclocking and eventually managed to get the CPU stable running at 4.3Ghz and the graphics card also saw a modest increase that got an additional ten fps in the Heaven 4.0 benchmark. I definitely don’t know enough about it to explain it to anyone else though so lets move on to the big question…

Will it blend?

Mikes BMW benchmark

On my laptop the BMW benchmark scene above takes over half an hour to render. On the new PC with an overclocked CPU and GPU the same thing renders on the GPU in 30.29 seconds! Even on the CPU it only takes one minute and twenty seconds!

I am so happy with how it all turned out the machine runs brilliantly, blender works superbly and it’s still pretty quiet. Hopefully I’ll be sharing some new work soon.

Rendering Minecraft in Blender

I’ve been having an on and off love affair with Blender for three years now. While it’s true that the interface is bordering on user-hostile once you begin to understand the Blender way of doing things it is an incredibly capable piece of software.

Recently I stumbled upon Mineways, a free, open-source program which allows you to export sections of your Minecraft worlds for rendering or 3D printing. Being quite a fan of Minecraft (my wife and I had our Minecraft avatars on our wedding cake) I thought I’d have a play with it and see what I could make.

I did it Mineways

The Mineways program itself is incredibly easy to use. Open up a world file, chose the maximum height and depth you would like in the final scene, ctrl-click (right-click) and drag over the section you would like to export and then export an OBJ file for rendering.

Mineways

Once Mineways has finished exporting you’ll be left with several files:

  • An OBJ file which we’ll open in Blender
  • An MTL file which specifies the materials for the model
  • Three PNGs of Minecraft textures in RGB, RGBA and Alpha versions

It’s probably good housekeeping to put all of those files into a folder to keep everything organised and then we’re ready to get into Blender.

Will it blend?

So first up you’ll need to download and install Blender (the current version is 2.74 at the time of writing). Next if you are completely unfamiliar with the software I would recommend you go and make a mug to get up to speed with navigating the interface. You may also find that using a mouse makes it easier to navigate although it is possible with a multitouch trackpad (which is how I use it).

Now that you have Blender installed and you know your way around it a little lets get started. Create a new file in Blender, you should have a scene with a cube in the middle of it. Right click on the cube to select it, press “x” on the keyboard and click on the delete option that appears under your cursor. This should leave you with an empty scene ready to import your model. To import the OBJ file select File > Import > Wavefront (.obj) and then navigate to the OBJ file created by Mineways.

You should now see your model in all it’s greyish beauty. To see a textured preview change the viewport shading mode to texture by pressing “alt+z” (option+z), to switch back press “z” to go to Wireframe mode and “z” again to get back to Solid mode.

Blender Viewport Shading Modes

Now to see how it renders we need to set up at least one light and one camera. Fortunately the default Blender scene contains a camera and a sun lamp so you should be nearly ready to go. Adjust your view by rotating, panning and zooming until you have a good view of the model. Then from the View menu at the bottom left of the panel you’re working in select View > Align View > Align Active Camera to View.

Now we’re ready for our first render. Select the camera icon from the panel on the right to access the render settings. Set your resolution in the panel and then press the Render button. The output may look a little like this.

Blender internal renderer

My render came out particularly strangely as the world file I was working from came from a modded version of minecraft (ATlauncher). Mineways is only designed for “vanilla” (non-modified) minecraft worlds so it converts blocks it doesn’t recognise into bedrock. In this case it also got confused by the variety of trees available and made some trunks out of coal ore and some leaf blocks into wood blocks.

It’s fair to say that I was a little disappointed with this render but worry not things will get better. Blender has two built in renderers – the code that computes how the final image should look. Currently we are using Blender Render which is the original renderer for Blender and our other option is to use Cycles. The differences between them are many but essentially it boils down to Cycles being based on the physical world and therefore generally creating more realistic looking renders.

A new Cycle

There are definitely things we could do to improve the output in Blender Render but I’m going to suggest we jump ship to Cycles and get this render looking nice and smooth. Unfortunately however you can’t just switch to Cycles and carry on rendering. You have to recreate all the textures in your scene using nodes.

For most objects you just need to create a diffuse shader that uses an image texture as an input for the colour and then assign filename-RGBA.png as the texture. You can either do this in the materials tab on the right or in the node editor.

minecraft-diffuse-texture-nodes-cycles

For objects that have transparency (leaves, flowers, grass, etc.) you’ll need to add a mix shader between the diffuse shader and the material output. Then you’ll need to connect a transparent shader to the first shader input of the mix shader and control its factor with filename-alpha.png.

minecraft-texture-nodes-cycles

Having made those changes you should get something like this.

Full colour Minecraft render

It takes a while to get all the materials set up and the render can take a long time (this image took about seven hours with a thousand samples) but the results speak for themselves.

If you want to increase the “realism” you can experiment with lighting and add emission shaders to textures that should be light sources. In the image below the environment is set to black, the lava is a mix of diffuse and emission shaders and there is a dim moonlight from above.

Lava Emission Shader in Cycles

Switching to cycles won’t solve any issues with incorrect or missing textures though, so for now it’s probably best to stick to vanilla minecraft worlds. I’d really like to make some nice renders of the particle accelerators and nuclear power stations that my friends and I have built in the previous games so it may become the subject of a future post.

Beyond Minecraft

If you want to experiment further you can make your own textures and assign them to whichever objects you like. I tried another version using a mix shader that combined diffuse and glossy shaders to produce a material similar to a hard plastic.

Hard white plastic cycles nodes

I then added a plane beneath the minecraft model, scaled it so it expanded beyond the view of the camera and assigned the same texture to it. I also used a plane out of shot to the right with an emission shader to simulate the light of a soft box. The result is the bright and clean renders below.

minecraft-white-render

Close up of Mix shader in Cycles

A quick bonus

The day after I posted this I found a YouTube video that explains how to render minecraft items in Blender. It’s really quick and easy to follow, best of all you can use it with cycles by creating a diffuse shader with the colour input set to the image.

Minecraft Iron Sword

Tekkit Classic with Minecraft 1.6.2

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

Following on from my previous post I wanted to write a little more about the issues I found trying to get all of the Tekkit Classic mods working with Minecraft 1.6.2.

Having discussed everyone’s requirements, my friends and I agreed that we wanted all the features of Tekkit Classic with the additions of Stargate, Twilight Forest, Archimedes Ships, Useful Foods, Treecapitator and a few others. I read a lot of guides and figured out how to set up a custom Forge server for Minecraft 1.6.2.

Now we can install any mods we want but there are some caveats. Firstly not all mods work with Minecraft 1.6.2 and secondly not all mods work with each other. This is where we hit the first problem, Tekkit Classic is built on Minecraft 1.2.5 so all of the mods that come with it are designed for that. Some of them have been updated to 1.6.2 but unfortunately not all.

Mod Name 1.6.2 Download
Balkon’s Weapon Mod Yes Here
BuildCraft Yes Here
BuildCraft Additional Pipes No
ccSensors No  
ComputerCraft Yes Here
IC2 Charging Bench Yes Here
Dimensional Anchors Yes Here
Equivalent Exchange 2 No
Ender Storage Yes Here
Industrial Craft 2 Yes Here
IC2 Advanced Machines Yes Here
IC2 Compact Solars Yes Here
IC2 Nuclear Control Yes Here
Immibis Core Yes Here
Inventory Tweaks Yes Here
Iron Chests Yes Here
MAtmos Yes Here
Modular Force Field System Yes Here
Not Enough Items Yes Here
Nether Ores No  
Power Converters Yes Here
Railcraft Yes Here
Red Power No  
Rei’s Minimap Yes Here
Tube Stuff Yes Here
Wireless Redstone WR-CBE Yes Here

Of the modules missing the Additional Pipes for Buildcraft and the Sensors for ComputerCraft were no big deal as I don’t think any of us have ever used them.  Equivalent Exchange 2 not being available is a bigger problem as one of my friends is very keen on that mod.  EE3 is available for 1.6.2 but it is arguably not as good (or perhaps it’s just more balanced). Nether Ores are no big loss either as none of us really mine in the nether.

Red Power is an issue though as it includes so many features. There are some modders working on creating similar mods for 1.6.2, Immibis has RedLogic and I came across a few others.

Unfortunately I was unable to get RedLogic or Equivalent Exchange 3 to install with the other mods on my server.  I’m hoping there will be some updates that may resolve that in the near future as they make up a large chunk of the features of Tekkit Classic.

This is my final set of mods, including what I could from Tekkit Classic and the additional ones that we wanted.

  • Advanced Repulsion Systems 56.0.0
  • Advanced Machines 56.0.0
  • Arhimede’s Ships 1.6.2
  • BuildCraft 4.0.2
  • ChickenChunks 1.3.3.2
  • CodeChickenCore 0.9.0.5
  • ComputerCraft 1.5.6
  • Dimensional Anchor 56.0.1
  • Dyeable Beds 1.6.2
  • EnderStorage 1.4.2.2
  • Greg’s SG Craft Mod 1.6.2
  • Immibis Core 56.0.5
  • Immibis MicroBlocks 56.0.5
  • Industrial Craft 2
  • Infinitubes 56.0.1
  • Iron Chests 1.6.2
  • IC2 Charging Bench 1.90
  • Not Enough Items 1.6.1.3
  • Teleport Pipes Mod 1.6.2
  • Timber! 1.6.2
  • Twilight Forst 1.19.3
  • Useful Food 1.6.2
  • Weapon Mod

Building a Custom Forge Minecraft 1.6.2 Server

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

Having played through Tekkit Classic, Voltz, YogCraft and Tekkit my friends and I decided it was time for a custom mod pack. This of course meant that I had to figure out how to build it. After reading a bunch of tutorials of differing quality and reliability I was left under the impression that I would need to use a PC. Fortunately for us Mac users with Minecraft 1.6.2 and the new Forge installer this is not the case.

Installing Minecraft Server 1.6.2 and Forge

Head to the minecraft site and grab a copy of minecraft_server.1.6.2.jar. Make a folder to store your server and copy the jar into it. Double click to run the server and continue passed any warnings that may pop up. Once the server has finished loading type “Stop” in the console.

Now we need to install Forge so head over to their site and grab the latest installer. Download it to your desktop or anywhere else that isn’t your minecraft server folder. Double click to the launch the installer. Chose “Install Server” and then make sure it’s got the correct path to your server folder. Hit Ok. This seems to take ages, I have a 70mb connection and yet the bar still crawls along and stops repeatedly. After waiting a while you will probably receive an error like the one below:

Error downloading
These libraries failed to download. Try again.
org.scala-lang:scala-library:2.10.2,
org.scala-lang:scala-compiler:2.10.2

If this happens WontWorld on Youtube has got you covered. For me it only failed to download one of the libraries but his instructions fixed it.

Now you will need a launcher batch file so that you can configure how much RAM is assigned to the server at launch. Open up textedit (or similar), make sure you are in Plain Text (Format > Make Plain Text), then copy and paste the following code.

#!/bin/bash
cd "$(dirname "$0")"
exec java -Xmx4G -Xms4G -jar minecraftforge-universal-1.6.2-9.10.0.804.jar

This will assign 4Gb of RAM for your server but you can change it accordingly for your system. My server runs 24/7 on a Mac Mini with 8Gb of RAM that I use as HTPC as well so I leave half the RAM free for other applications.

Save the file as launch.command. Now you need to set permissions for the file so that it can be executed. Open terminal, navigate to your server folder by typing “cd” without the quotes, then a space, then drag and drop your server folder onto the terminal window. That should complete the command with the full path to your server folder. Hit return and then type the following code.

chmod a+x launcher.command

Excellent. Now quit terminal as it’s scary in there and we won’t need it anymore. Next double click on launcher.bat and your MinecraftForge server should start. This would be a good time to test that you can connect to your new server.

Installing Forge for your Minecraft Client

Before connecting to the server you’ll need to install forge but before you can so that you must run Minecraft once. You’ll need a copy of Minecraft 1.6.2 from the Downloads page. Install it as normal and then open it. Once you get to the screen with a button that says “Play” you can quit and then install Forge.

This is fairly simple, just run the Forge installer you downloaded earlier choose “Install Client” make sure that the installer has the right path to your minecraft install and hit OK. This is generally very quick and painless.

Now open Minecraft again, choose the new Forge profile at the bottom left and hit Play. In Minecraft click Multiplayer, then add your server and test that it works.

If you’ve got this far and everything is working then it’s time to move on to the fun bit.

Installing Mods into FML in Minecraft 1.6.2

So now that you have your list of mods, download them all into a working directory somewhere other than your server folder. When you download them be sure that your browser is not unzipping them, if it is you should be able to find the zips in the trash.  All of the mods will be either ZIP files or JAR files.

All that’s left to do now is install the mods by moving the mod file into the mods folder inside your server folder.  It would be nice if you could just drag them all in at once and it worked but that was not my experience.  I found that it was best to add one at a time and check I could still login. Remember that any mod installed on your server also needs to be installed on your client.

Some mods have different files for server and client but most are universal.  So add a mod to your server, start the server, add the mod to your client, start your client and join the server.  Sometimes after adding a mod to the server it will die horribly and throw a SEVERE error. If that happens read the log file, read the forums, check for dependencies and try again.

You may need to copy the contents of the server’s config folder to your client’s config folder if you encounter ID mismatches between client and server.

It would also be a good idea to make backups of your server every time you successfully install a mod. This may seem like overkill but I finished this project once and was happily playing online when I decided I should add one more mod.  It threw a severe error, removing the bad mod didn’t fix it neither did reinstalling the server and copying the last backup of mods. Moral of the story backup everything all the time.

In the end I managed to get the following mods installed and living happily side by side.

  • Advanced Repulsion Systems 56.0.0
  • Advanced Machines 56.0.0
  • Arhimede’s Ships 1.6.2
  • BuildCraft 4.0.2
  • ChickenChunks 1.3.3.2
  • CodeChickenCore 0.9.0.5
  • ComputerCraft 1.5.6
  • Dimensional Anchor 56.0.1
  • Dyeable Beds 1.6.2
  • EnderStorage 1.4.2.2
  • Greg’s SG Craft Mod 1.6.2
  • Immibis Core 56.0.5
  • Immibis MicroBlocks 56.0.5
  • Industrial Craft 2
  • Infinitubes 56.0.1
  • Iron Chests 1.6.2
  • IC2 Charging Bench 1.90
  • Not Enough Items 1.6.1.3
  • Teleport Pipes Mod 1.6.2
  • Timber! 1.6.2
  • Twilight Forst 1.19.3
  • Useful Food 1.6.2
  • Weapon Mod

Now it’s up to my friends to play test it and see if it breaks horribly.

Dynamically Generate Product Variations with PHP

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

“Why can’t I just dynamically generate product variations with PHP?”, I thought, “Surely that must be how other people do this!”.

I’ve been working on an ecommerce site, with Drupal Commerce, for a business that a friend and I have started up. We’re selling sports clothing that is made to order. The customer is able to pick a style, two colours and a size. There are eighteen available colours so for each style there are over three hundred variations that could be chosen. As well as building the site I am creating artwork for the products. They are fairly simple vectors that use only two flat colours with a black outline on top.

As simple as they were generating over three hundred images per product was not an option.

It also turns out that all of the commerce platforms I looked at, including drupal commerce, expect you to define all of the variations and then assign an image to each. There are ways of importing product catalogues into DC but it seemed unnecessary as the products are all made to order so there’s no stock to track.  So this became my first challenge.  Eventually after reading half of the internet I found a drupal module called Commerce Customizable Products.  It allows you to specify fields the user has to complete before adding a product to their cart. I used it to add size and colour options along with two image upload fields.

So that took care of capturing the information from the customer’s order but I was no closer to generating the product images. After scouring yet more of the internet I posted to stackoverflow in the hope the wisdom of crowds would provide me an answer. Sadly there were none forthcoming. I continued reading everything I could about manipulating images with PHP and eventually I solved my own problem.

To create the images dynamically I have created one GIF that contains the white background, a pure red and pure blue region to define the primary and secondary areas. This is run through GD which changes the red and blue to the user selected colours. Then a transparent PNG is merged on top which contains the black outline and the company logo (see example at top of post).

I then created a page with selection boxes for colours and style and used a little jQuery to pass those options to the PHP that generates the image.  When the script receives the options it uses them to create a filename for the image that it will produce but first it checks to see if that file already exists.  If it does then it returns the existing file if not it creates it on the server for future use and returns it.

I have put up a demo with all the scripts that you need to dynamically generate product variations with PHP.  There’s a link to a zip file that includes all of the code and some images on that page too.

YogCraft and Server Texture Packs

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

I have been running a private Minecraft server for myself and some friends for a while now.  We have been playing through a variety of Modpacks, starting with Tekkit then Voltz and yesterday we switched over to YogCraft.

On Minecraft servers you have the option to force users to download and automagically install a texture pack when they join.  I’ve never tried this before but I thought I’d give it a go as I was starting a new server.  The way it works is that you need a zip file containing the texture pack somewhere publicly accessible on the internet and you modify the server.properties file to tell it where to find it.  I tried this but immediately realised that there is a limit of 10Mb for texture packs served in this way and the one I had was 38Mb!

A little research showed me that there are some command line utilities to optimize PNG files which might help reduce the file size. A guy who knows a lot about PNGs has made them more user friendly by making a free drag and drop PNG optimiser called ImageOptim. I gave it the texture pack to chew on, 1200+ images that come to 40.7Mb before zipping, and left it to cook overnight.  I knew I was being overly optimistic seeing as I would need a 74% reduction overall to get it within the maximum allowed file size.

Additionally I found out that when you compress files on a Mac it includes all of the hidden system files (resource forks) in the archive. For a texture pack the system files are redundant and potentially increase the overall file size. Fortunately there are several applications available that allow you to create zip archives without the system files. I already use a free application called Keka to deal with archives and found that it offers this facility.

So after running all of the images through ImageOptim I was left with a folder weighing in at 32.1Mb.  I then compressed it at the highest setting with with Keka telling it to “exclude Mac resource forks” and was rewarded with a 29.9Mb file. For the sake of comparison using the built in Compress command in OS X created a 30.5Mb zip file so excluding the resource forks saved 0.6Mb.

The net result is a decrease in file size of a little over 21% which although significant is sadly shy of the 74% saving required. So I guess I’ll just email my friends a link to the zip and instructions on how to install texture packs for Minecraft.

For the sake of anyone arriving here from google the folder for texture packs in YogCraft on the Mac is: /Applications/YogCraft/minecraft/texturepacks

Airplay Amp on a Budget

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

I bought some Mordaunt Short Avanti 902i’s to use as rears for a surround sound set several years ago but have only ever had one living room large enough to accommodate the whole setup.  As we now have a large swedish shelving system in our home office I was hoping to finally be able to use these bookshelf speakers that have been nestled in their box for the last four years.

Ideally I wanted to be able to stream to them from iTunes and iOS devices.  As they are passive speakers I knew I would require an amp and I was hopeful that by now network streaming might be a fairly standard feature.  Sadly this is not the case, at least not in the section my budget would stretch too.

Above right is the Denon stack a DNP720AE Network Music Player atop a PMA520AE Stereo Amp.  When I first saw the Denon streamer I misunderstood it to be a self contained amp with network connections.  Unfortunately for nearly £200 this device only generates an unamplified signal so it still requires the amp below before it can power speakers. Interestingly Denon do make a single device solution in the form of an AV receiver – an amp that deals with video as well as audio – that includes wireless streaming for around the £260 mark.

Sadly everything I looked at was still way beyond my budget and it became apparent that there is no such thing as a cheap Hi-Fi amplifier.  Even on eBay old amps go for upwards of £100.  After much searching I came across a mini amplifier on Amazon for the princely sum of £26.99!  It’s called a Lepai TA2020+ and it has surprisingly good reviews.  I called in an old Airport Express that I had loaned out to a friend and I am now eagerly awaiting delivery of this tiny amp.  I will let you know how this budget option turns out.

Figuring out FreePBX

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

In a moment of clarity I realised I was massively overcomplicating how to go about directing calls.  I had wanted the PBX to know if I was out of the house and route calls to the extension on my iPhone instead of my Mac.  When I thought about it this evening I realised that’s completely unnecessary as FreePBX lets you set a rule for what to do if an extension is unreachable.  So I have now set it up so that if the softphone on my Mac isn’t signed in then the call forwards to the extension for my iPhone.

On the subject of the iPhone, it turns out there are a number of SIP clients out there.  I’ve tried a few of them but so far the most reliable one has been 3CXPhone as it has the ability to accept calls in the background and when the device is on standby.  The only downside is that the ringtone is Marimba which I can’t stand and sadly there is no option to change it.

It’s all coming together quicker than I expected but there are still a few things to tick off:-

  • Setup a VPN so I can connect externally.
  • Configure the PBX to only allow calls through between 9am and 5pm Monday to Friday.  All other calls should go to voicemail and the messages forwarded to my email account.
  • Record better messages for any of the greetings or menus I’ll be using rather than the robotic American voice currently being used.