Thursday, 23 September 2021

Fast forwarding boring parts of games

It's becoming more common in gaming, particularly with mobile and free-to-play games, for an action or activity to be limited by real-world time, usually in order to provide a 'nudge' to players to nag them into purchasing loot-boxes or other pay-to-win premium extras.

Moral arguments about the ethics of pay-to-win and loot boxes aside, I find this really annoying. These days, the amount of time that I have available for gaming is ever lower, and arguably, time is the most valuable and scarce resource for everyone - after all, we only have get a certain amount, and can't buy more.

So while I was waiting for some in-game nonsense to finish, I started thinking about how feasible it would be to create a fast-forward for these types of activities in-game.

Yeah, I know, there's a certain irony in getting annoyed at having my time wasted and then spending a good deal of time trying to work around it - but sometimes once I get an idea in my head, I have to see it through.

The game I'm using for this demo is Fallout Shelter. I'm well aware that there are already plenty of documented save file hacks for this game, similar to the Saints Row 3 one that I did a while ago.

However, that's not the approach that I want to take here. I still want to play the game, more-or-less as intended. I just don't want to be kept waiting.

A quick experiment by changing the time on the system the game is running on, shows it to be quite tolerant of the time changes, the screen briefly blacking out while the game mechanics catch up.

The first thing to do is to disable NTP (automatic system time synchronization).


In Windows, this can be done by right-clicking on the time in the task bar, selecting "Adjust date/time", and then setting "Set time automatically" to Off. This will stop the system resetting the clock back to the correct time. Just remember to turn it back on when you're done playing.

To do the time adjustment, I'm using AutoHotKey. AutoHotKey (AHK) is an incredibly versatile scripting language for Windows systems, allowing commands and key macros to be bound, system-wide, to keyboard shortcuts.


The idea is to create a global hot key on the system that I can trigger without leaving the game, whenever I want to speed things up by a certain amount.

As the game is mostly touch/mouse controlled, I've bound the macro to the modifier and arrow keys.

* Ctrl-Shift-Right advances time by 1 minute
* Ctrl-Shift-Left advances time by 15 minutes
* Ctrl-Shift-Down advances time by 30 minutes
* Ctrl-Shift-Up advances time by 1 hour

The script is available on GitHub.


Limitations

The script needs to be run as administrator, as elevated privileges are needed to change the system time. There are ways that this can be avoided, but they require more system changes, so for the purposes of this, it's easier to just right-click and select "Run as Administrator".

The script is pretty basic, and operates simply by adding the numbers - so it's not smart enough to cross hour-thresholds - ie. if you advance by a minute at 11.59, it will attempt (and fail) to set the time to 11.60 - but this is simply overcome by, well, waiting a minute.



Thursday, 9 September 2021

Late 1940's / Early 1950's Zippo Restoration

Taking a break from all the DIY-heavy home improvement projects, I found this rusted out Zippo lighter at a flea market.

I've always been a fan of Zippos, their style (and that unique sound) is incredibly iconic, so I figured I'd have a crack at restoring it.

Plus I still have a bunch of spares left over from the trench lighter project I did a while back.

Before starting, I did some research to try and put a date on the lighter, just in case it was something super-rare.

 

 

 

 

The first thing to so is to check the stamp at the bottom of the case:

According to the table provided by Zippo themselves, based on the logo type and the patent number, this lighter was manufactured in the 1937-1950 date range.

Digging through some other online resources, I found that it could be dated further by the chimneys number of holes, and the pattern of the flint wheel.

Depending on the source, the chimney having 8 holes per side dates it as being from late 1946 or 1947 onward.

The diagonal-cut flint wheel puts it also at 1946 onward.

Finally, the hinge (again, depending on the source), puts it at either 1948 or 49 onward

So between all that, it looks most likely that this lighter was produced between 1948-1950.

It's pretty cool to know the lighter has some history to it, but it doesn't make it a massively rare artefact.

Removing the rust

The rust on one side in particular was quite thick. To remove it I started with a small rotary tool wire wheel, then moved to some high-grit sanding discs, before some wet and dry sanding by hand to even out some scratches, finally finishing up with a number of passes with the buffing wheel and polishing compound.

As much as I am trying to preserve the original chromed finish, it was clear even before starting that it had worn through in places - I was merely trying to not make it any worse.

However with that lot done, although it's not exactly 'showroom' quality, the lighter has it's shine back, but retains a lot of it's characterful aging which suits it's age.





Flints & Wicks

The obvious thing to note is that it's not functional. To start with, there was no flint to make a spark. Thankfully the flint spring was still there, so adding one of my spares was all it took to get it sparking again.

The wick had been worn down to nearly nothing as well. I thought that I would likely need to replace it, so had a spare to hand, but it appears as though there was still plenty of wick remaining to pull through. It's quite possibly that the previous owner just never knew to do this - or had lost the flint before it was an issue.

Then all that was left was to add fuel, and:



Thursday, 26 August 2021

Woodstore / Planter from reclaimed wood (old shed)

After finishing the upcycled planter by the firepit, I realised that something similar would be useful as a wood store for the firepit, and would also help define a boundary to the patio and fire pit area.

Looking through the remaining timber from the shed, there was still the shed floor, and the second long wall to use, and the short (back) wall

These formed the back and front of the second planter, with the back wall being split into 2 lengths to provide the sides, in mostly matching dimensions to the first planter.

To help keep the wood dry, the shed door and it's hinges were repurposed. The thing is, the planter is around 8 foot long, and the door only 6.

To overcome this, it's split into 2 sections, with a divider made from part of the shed front. The 6 foot section with the lid is the woodstore, and the remaining 2 foot section was lined out with plastic to create another planter, in the same manner as the first planter.

The idea is that this will house climbing plants to grow along the trellis that has been installed on the fence at the back of the patio.

The door had to be trimmed down as the planter was narrower, and the hinges had to be switched to the opposite side. A bit of scrap chain (left over from the light fitting project), and an odd carabiner clip I had lying around, were looped around the tree to provide a latch to hold the lid open when needed.





Bonus Planter

That was meant for making planters. But, when I set out with all these garden builds, I did set a 'zero-ish' waste rule. And when the bricks were delivered, they came in a wooden crate, which would then need disposing of.

Plus there were a few miscellaneous bits of shed panel left, which were otherwise just going to be firewood.

So I quickly whipped up a third mini-planter to go out on the front lawn. It's pretty rough and ready, but will serve it's purpose, at least for now and until I have more definite plans of the work I want to do out front.

 

 

The bonus planter, just needs top soil and plants

Sunday, 15 August 2021

Planter from old shed

When working on the patio and fire pit, I took on the challenge of 'zero-ish' waste - not having any more waste than could fit in the regular household bins. No skips, special collections etc.

On the opposite side to where the fire pit was built, there was an old shed, which wasn't in bad condition, but was unwanted.

It was taken down so that we could make use of the paving slabs which were being used as it's base.


Along the side of where the raised patio was being built, there was a gap which used to have long-dead roses in - the area marked in brown in the patio-plan model below


Just eye-balling it, I could see that the length of the shed (approx 8 feet), was about the same, and came up with the idea of using the sides to create a raised planter there. 

It also helped the zero-ish waste plan, as the planter would provide space for re-homing soil removed during the fire pit and patio builds, as it could be filled up from ground-level

The frame was simple, just the four sides simply screwed together - leaving the bottom open for drainage.

The front panel was cut down from the front of the shed (below the windows), and the back of the planter was one of the roof panels of the shed. The sides were the other roof panel, cut lengthways.



The back of the planter is higher than the front - I considered cutting it down, but it does provide some utility in that it gives a place to mount things like chicken wire/frost protection/cold frames over the top of the plants if need be, and as it is still lower than the fence itself, I decided to leave it alone.

And finally some miscellaneous bits of shed timber was used to add trim to the top of the panels, which also served to pin the plastic liner in place.

The wood was treated with normal fence stain/wood preservative.

The insides of the frame are lined with plastic sheet (which as it happens, is also up-cycled from some packaging.) and stood on some slab offcuts to protect the wood from moisture caused by contact with the wet soil.



 



 

Thursday, 22 July 2021

Fire Pit/BBQ Patio Area - Part 2 - The Reality

The plan for the firepit was scuppered by unavailability of materials due to Covid, so we had to rewind and reformulate the plan.

For the most part, the patio plan came together well, but we had use more slabs from the shed side for the base layer than we thought, because the greenhouse itself was cemented into the ground by metal supports, and not sat on a slab base as initially thought.

This in turn meant we were two slabs shy of what we needed, but we were able to source some that were close enough in appearance.

 

When it came to placing the concrete blocks, we realised we could use fewer than estimated by spacing them out differently, which gave us a spare at the end. It also allowed for us to dispose of hard rubble by using as filler between the blocks, and also allowed us to create airflow from the back of the patio to the firepit, which should help aid combustion.

 


When researching the best materials to use in a fire pit, a few things became obvious.

  • Don't use river rocks. They will likely contain moisture, which when heated, will cause steam, resulting in the rocks exploding. 

  • Regardless of whichever other material you consider, you will find some articles and advice saying it's a good material to use, and an equal number saying it's not.
  • One constant in advice advocating against any material is how it will degrade over time with the heat from the fire.

Therefore it seemed to me that the best course of action would be to use a material that is hard-wearing, but also fairly cheap and readily available, so that if the internet pessimists turn out to be right, it can easily be replaced.

For that reason I chose regular house brick as the lining wall. This wall should take the brunt of the heat, meaning I could use a more decorative stone for the outside.

A mix of brick sizes was used for the outer wall, both for aesthetic effect and it also helped fit the available space better.

The wall was topped off with white coping slabs with a mitre. The inner wall sticks out slightly from the coping, giving it a 'lip'. This is by design and will feed into a later project.

The finished patio and firepit. Still a few finishing touches to do, but perfectly usable as it is.

It wouldn't be a post about a firepit unless there was picture of some flames, would it?




Tuesday, 13 July 2021

Fire Pit/BBQ Patio Area - Part 1 - The Plan

I'm fortunate to have a great view over some fields at the bottom of my garden, and I plan to create a patio/barbecue/fire pit area so that I can make the most of it.

At risk of this becoming just another home improvement blog, I have set myself an additional challenge to differentiate it from all the other "I built a firepit in my backyard" projects all over the internet.

The challenge I have set myself with this project is to aim for 'zero-ish waste'. That is, there's inevitably going to be some waste, but to minimise it to the extent that there's no skip or trip to the dump required - to keep the waste minimal enough that it will go in the regular household bin collections. That means lots of re-purposing and re-using of what's already there - stuff that was left behind by the previous owners.

The fence that is currently at the bottom of the garden is in good condition, so I don't intend to remove or replace that, however at sitting-level, it's just high enough that it blocks the view. So the plan is to create a raised patio, so that eye-level when sat down is not obstructed.

Being a large household project, it was more important than ever for me to be able to communicate the project idea and plan to my partner, so I spent some time planning it out in OpenSCAD, to produce this 1 min animation.



The groundwork

The area that the patio will occupy originally contains a greenhouse, and some slabs that have been laid around it.


This will create a solid base without the need to dig foundations.

Fortunately, the slabs are all an even 60x60cm (or 2x2ft), which makes a convenient grid from which to base the design and measurements.

The plan is to leave the right-most column empty, where a planter will be put. The slab in the left-most, plus two slabs from the other side of the garden where the shed is, will be used to square-off the corner, effectively making a 6x4 square patio (12x8ft)


With this solid base created, concrete blocks will be placed to raise the new patio. Gaps will be left between the blocks to minimise the number that we need, with the space filled with any rubble left over from the build.


Slabs taken again from the other side of the garden (they are currently a base for the shed), will be moved over and concreted on top of the concrete blocks to create the raised patio.

 


Finally, the firepit rings are a purchased kit (sold as quarter circles). We will adapt them slightly so so that the circular wall sits at both ground level and on the patio. 

 


Unfortunately there was an unforeseen obstacle in the the fire-pit kit we were going to use was on a lengthy back-order, and we'd be unlikely to get one this year.

But still, the plan makes a good jumping-off point for a new plan.

To be continued...

 

 

 

 

Tuesday, 15 June 2021

Workshop apron from leather scraps

Now that I've recently added a welder to my workshop, I need something a bit more protective than just the usual old clothes I use as workshop attire, so I've been planning to build a leather apron.

What makes this project a bit different though, is I have inherited a large box of leather from another leather crafter who sadly passed away. It's a significant amount of material, so I don't really want to go purchasing yet more for this project.

So the challenge that I set myself is to 'frankenstein' the apron together from the smaller pieces, but do so in a way that hides that fact - or at the very least, styles it out so it doesn't look like a patchwork bodge.

I'm using a borrowed canvas apron as a rough template, but will adapt where necessary to suit me.

The largest suitable piece I have is this, which covers most of the area, but the template comes in a bit short at the edges.


 

 

 

 

 

 

 

A second piece, although a different colour can attach to the bottom, extending it to a more suitable length. This covers the size of the canvas example apron.
 

 




 

 

 

 

I also created edge pieces for the vertical sides of the apron, to tidy it up.
When I've used aprons in the past, I've always found an annoyance of them is how the side bits often 'flap about'. To try and combat this in this design, I've enclosed a length of steel wire in there, which should strike a balance of being flexible enough yet maintaining some sense of shape.



There's still the scuffed portion at the top to deal with. This will be where I affix the straps, so have cut a couple smaller pieces of thicker leather here so which cover the problematic patch, and provide the mounting point for the strap. I did the same on both sides to maintain the symmetry.

There was also enough left over to add a central pocket, which I planned to divide into two.

 


 I wanted all the pieces to be a consistent colour, but not too dark, so I opted for a shade of brown just slightly darker than the pieces were currently.

After dyeing, I fixed the bottom and side sections in place with contact adhesive. This would serve as a placeholder while I stitched them, and add to the overall strength.


 

Straps

In the box of leather that I inherited, there were what appear to be, a number of several unfinished belts. These were all consistent in the type of leather, so were perfect to repurpose as straps for the apron. All I needed do is dye them to match the colour.

 

For the shoulder straps I used a single rivet, as this would also act like a pivot and allow flexibility. This was covered over by the top pieces I mentioned earlier.

I joined these in the middle of the back using a small piece cut from thick leather, from which another piece moves downward to join the belt portion, like a 'Y' shape.

 


 



Another 'junction' piece joins that to the belt in an 'upside-down T' shape.

The belt itself is simply riveted to the sides of the apron. I made the right-hand side particularly for the buckle, as I reasoned it would be easier to fasten/unfasten from the side of the body than trying to reach behind my back.




Finishing touches

I soon realised that the front pocket would just end up filling with dust, so I made a cover flap for that.

Also used some remaining scraps to add some padding to the straps near the shoulder.

Sunday, 9 May 2021

Dartboard Cabinet

I got a dartboard for Christmas, which I have on the wall in my home office.

Darts is a great excuse for getting up and stretching your legs between video meetings, or while thinking over a problem, rather than just pacing back and forth.

However up until now it's simply had an old piece of hardboard as a backing, so thought it's time it got a proper cabinet.

The design is to have two compartments, the main dartboard cupboard (obviously!), and below that a small compartment which can be used as storage for the darts and accessories, and will open to provide a platform to help catch bounce-outs.

The Frame 

The frame is made from a reclaimed iroko desktop - I believe it was from an old school chemistry lab. It's about 5cm thick, so ideal for covering the thickness of the dartboard.

This was ripped down into 4 lengths to make the sides of the frame.


These are jointed using lapped mitre joints, screwed through from the back for extra support.


The divider between the main dartboard compartment and the lower storage compartment is joined into the sides with pocket screws.

The backing of the main compartment is hardboard, reclaimed from some dismantled hollow-core doors, simply pinned into rebates in the frame.
The backing of the lower storage compartment is reclaimed laminate flooring, which helps to add rigidity to the structure, again, screwed into rebates in the back of the frame.

I layered some cork over it, to try and prevent bounce-outs and reduce impact noise, although in hindsight I regret that decision, as the thin cork veneer seems to disintegrate at the slightest provocation. But seeing as it's there to catch errant darts, it's pretty much a consumable anyway.


The doors
The doors are iroko, edged with oak to add some contrast.

The fold down door for the storage compartment is reclaimed from a previous project which didn't pan out, and is already built in the same manner.

It also has a leather lining, again from a previous project - I don't know how well that's going to withstand some dart bounce-outs, but I don't think it's chances of surviving being ripped out are much better, so opted to leave it in.


For the storage compartment, a leather lace is used to create a limiter to stop the door folding down too far. This simply threads through a hole drilled in the divider and is knotted.

 

 

 

 

 

 

A simple latch for this is mounted in the side, made from miscellaneous brass hardware from the junk bin.

On the door side, the lace is threaded through more brass hardware (I believe a Chubb keyhole cover), and knotted. The knot is recessed into the door to hide it, and the hardware screwed to the door.

 

 

 

 

 

 

The handles

The handles for the doors are made of leather. This is done by creating a loop as shown below.

A hole is drilled through the thickest part (the 3-layer section). Between the second and third layer only, a small screw is placed with a washer.

The first and second layers are stitched together, and the handle screwed to the door. The hole in the first layer provides access for the screwdriver, as the head of the screw is hidden.

When that's done, the hole in the first layer is hidden by the rivet.

  

Finishing touches

In the back of the cabinet, keyhole hooks were recessed into the top and bottom of the frame. The sides would've been preferable, but the placement on the wall would have collided with cabling behind the wall.

A whole was cut in the centre of the dartboard compartment, this is to allow the existing wall mount to pass through - so the dartboard does still have a direct mount to the wall, which aids with it's positioning on the wall - we can make use of the calculations we did when it was first hung.

Finally, a couple of coats of danish oil were applied to bring out the pattern of the grain.


Friday, 19 March 2021

Sound-activated switch for a set frequency

Clap switches are an old automation gimmick from the 1980s. Basically the circuit hears a noise above a given volume (amplitude), and activates.

This project is an attempt to refine that idea, to create a switch that does the same, but responds only to a given sound (frequency).

This was inspired by watching my partner fail miserably playing South Park - The Stick of Truth.

In the game during battles, there is a timed button press during an attack that increases damage. Timing these button presses was not going well...

That noise triggers at the time the button press is required, so I started thinking about how that noise could be listened for, and the button press triggered.

Band-pass filters

This system relies on the use of a band-pass filter. There are plenty of explanations around about these and how they work, so I won't reinvent the wheel here.

For the purposes of this project, the key point is if the input has a frequency between the low and high thresholds, it is allowed through. Frequencies outside of those thresholds (bands) are rejected.

These can be built in hardware as circuits, but also in software on regular computers.

Fast-fourier Transform (FFT)

This is a well-known algorithm that, in simplistic terms, takes input over time (such as audio), and breaks it down into the frequencies it's composed of.

I'll admit, my understanding of FFTs is similar to the relationship most people have with their household appliances - know how to use it, but can't really explain how it works under the hood. There's plenty of detailed explanation for the more mathematically inclined.

So the basic concept is this

  • Pipe the audio input into the FFT
  • The FFT converts it into the frequency domain
  • Zero out all the values for the frequencies that fall outside of the range we're 'listening' for.
  • Do an inverse FFT transform, which turns the frequency domain data back into time-domain (i.e. back to real audio). This gives us sound where everything except for the range we're listening for is muted.
  • This can then be passed into a regular 'clap-switch', where we trigger if the volume of the sound is above a given level.

 

Finding the target frequency

This part of the process can be trickier than it initially seems. Sounds are composed of many frequencies, so it is necessary to select a frequency range that is unique to the target part of the audio.

To start with, I extracted the audio from the above video clip using FFMPEG, and opened it up in Audacity. This initially shows the audio waveform.


Select the area containing the sound, and select Tools, Plot Spectrum.

This will show the frequencies that exist within the selection. However, this doesn't give us all the answers. Save the plot (I just took the below screen-shot and used that). Then select another parts of the audio and repeat the exercise. Then basically it's a case of spot-the-difference, looking for a frequency spike that appears in our target audio but not the other samples.

A sample spectrum from elsewhere in the audio.
The segment containing the target sound. Circled are frequency spikes not seen in the rest of the audio,

Hardware

To run this switch I'm going to use the Next Thing Co CHIP. This is the same system I used for the TV desk project years ago. Unfortunately these are now discontinued, but there are still many ARM-based SoCs running Linux out there.

Potentially this could be distilled down further on to a smaller microcontroller, although I'd have reservations about how far you could reduce the resources until the processing time introduces enough lag to make it too slow to use.

As well as effectively being a 'proper' computer, the CHIP has general purpose IO pins, like most microcontrollers. This can provide the interface for the output of the 'clap' switch. In this case, for the sake of example I'm just hooking up a simple LED that will blink on detection of the given sound.

Although the CHIP does have microphone pins and the ability to switch it's video pin from the jack to be an audio in, for the sake of prototyping, I found it much easer to just use a cheap USB adapter which has microphone and headphone sockets.

Power comes from a standard USB phone charger.

Control is done via a serial connection to my PC, using Minicom.


Software

As the CHIP is a full-blown Linux distribution, there's lots more flexibility in the software that we use. I ended up using Java and the Apache Commons Math library.

The basic OS was pre-installed, Java 8 JDK was installed from here.

The Java code listens to the microphone input, and allows the user to load a JSON file containing details of the filter to apply - this made testing and refining the filter easier. The values are the start and end of the frequency range to listen for, and the threshold of amplitude to trigger the output (This figure can be a bit of trial and error based on how loud the input is, and can vary if the input volume varies.)

It can also be controlled via command line to either pass-through the audio to the headphones as-is, or post-filter - i.e. you hear what the 'clap' circuit would hear.

Code is on GitHub here.

Configuration

Some configuration was required to enable the GPIO pins to be activated on boot. To do this, the necessary commands (below) are wrapped in the bash script 

/etc/init.d/preparegpio.sh:

echo 1023 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1023/direction
echo 0 > /sys/class/gpio/gpio1023/value
chown chip:chip /sys/class/gpio/gpio1023/value
 

(Refer to the CHIP docs for what exactly these mean)

This is set to run on boot by adding the below line to /etc/rc.local

sh /etc/init.d/preparegpio.sh

Finally, for the Java code to trigger blinking the LED, it triggers another SH script. I went this route as I intend to develop the Java code into a more general purpose audio tool, so didn't want to tie the code too closely to the hardware I'm using for this project.

It also has the benefit that the audio processing doesn't wait for the GPIO operation to complete, thus reducing the lag.

~/triggergpio.sh

echo 1 > /sys/class/gpio/gpio1023/value
sleep .5
echo 0 > /sys/class/gpio/gpio1023/value

Testing

While it certainly does respond to the input audio as expected, there is definitely some processing lag, as can be seen as the video progresses.

This isn't entirely unexpected, and could be overcome by throwing more computing power at the processing (The CHIP is a 1GHz processor), or possibly further optimisation of the code (or porting it to C or similar).

That might be the subject of a follow up project at a later date, but for now, this demonstrates the idea.