Blog Archive — Page 18
This is part of my blog, which I have long since stopped maintaining. The page has been preserved in case its content is of any interest. Please go back to the homepage to see the current contents of this site.
-
Daily Promise: Design Sketches
Current flavour of the month of some of the geek crowd, “Health Month”, is a social network of sorts on which users compete to achieve certain health-related goals. Each month, each member sets a number of goals for themselves to achieve. Its core mechanic is health points – you start with 10, lose one every time you fail to meet a goal, and players who perform well can heal you.
I’m enjoying my use of the site with three goals this month, but I’d like to step it up and set lots. Unfortunately, having more than three goals costs money. (Not that I think the site’s owners don’t have a right to charge, but it can be a deterrent to users such as myself.) It also currently only allows two “custom” rules per month – beyond that, you have to stick with the pre-defined ones.
Another social health site is Tweet What You Eat, on which users tweet their food intake and have the site, or the community, calculate statistics such as their calorie intake.
Over my lunch hour, I’ve come up with some sketches for a site that sits somewhere between the two. It takes Health Month’s goals mechanic, opens it up and removes some of the social aspects that in my opinion Health Month doesn’t implement all that well. It also drifts closer to Tweet What You Eat, in that rather than being its own service it piggybacks of Twitter for its social side.
At the moment this is just a fun concept I’m toying with – I don’t really have the time to make it at the moment, I doubt the space between Health Month and Tweet What You Eat is wide enough to make a new site popular, and I feel a little guilty about thanking Health Month for the enjoyment I’ve had by becoming its competitor.
In the notes below it’s dubbed healthi.ly, though as that domain is parked, it’s come to be known as “Daily Promise” instead.
Home Page
The home page would largely be a “log in / register” affair, possibly also showcasing successful and popular users in a side-bar (not shown). Big banner text explains the rough concept, with a “read more” link to a full “About” page. On the registration side, we make it clear exactly what Daily Promise does and doesn’t do with access to your Twitter account.
Set Up Goals
The main setup page is where you set your goals. Users can set any (reasonable) number of goals, they can drop and resurrect old ones, and add new ones, at any time. Performance against all the goals is tracked and visible on this page. Adding new goals and dropping old ones can be tweeted, but as with every tweet opportunity, the user is presented with an @Anywhere box that they can freely edit and can choose not to tweet as easily as they can choose to tweet. The tweet links to the list of goals on their profile.
Daily Performance
Once goals are set, the user logs in each day (and can fill in past gaps) with whether or not they have met each goal. Each day’s entry presents some brief statistics, and you get more stats on the week after filling in Sunday’s performance. Very good or very bad performance suggests a Tweet that a user might like to make. The tweet links to their performance log on their profile.
Performance Log
This is a user’s main screen. It displays a chart of passes and fails for the last month or so as green (pass), red (fail) or grey (goal not active) squares. Below the chart, more detailed stats are presented, as well as an encouraging text summary of how the user is doing.
Settings
Most of the core settings such as username, display name, avatar and bio are handled by Twitter. Daily Promise’s settings probably boil down to privacy (stop me being searchable, delete my account, etc.) and removing annoyances (always tweet on condition x, never tweet on condition y, etc. – all of which have an “ask me” setting by default).
Friends
The user’s “following” list from Twitter is used to generate their list of Daily Promise friends. Avatars, usernames and Daily Promise performance summaries are displayed here. Clicking through to a user’s profile shows the “performance log” page, topped with name / avatar / bio / etc.
So, and interesting idea, or an appalling one? Would you use this? Should I get off my arse and code? Should I have finished the last six things I started before prototyping something new? Your thoughts are, as always, appreciated.
-
Sea Battle: Of Ships and Submarines
The distinction between surface ships and submarines in Sea Battle has turned out to be a more thorny issue than I originally imagined.
The original plan was to have two classes of vessel, based on their hull types - ship or submarine - and weapons that could hit ships, submarines, or both. A future update could also have included aircraft “hulls”. However, the more I think about the game balance issues, the less I’m convinced that this is a good decision with the tech tree and playing field size that Sea Battle currently has.
Sea Battle’s tech tree, as it currently exists, has four straight “trees” with 10 items in each. By and large, each component that you research is better than its predecessor. (Later hulls are heavier and take longer to build, so small hulls are still useful. However, you would rarely want to choose anything other than the best weapon, engine and radar that is available to you.) Combined with the small playing field, this makes for a fast-paced game of a few minutes, with each player researching and churning out ships constantly to gain the upper hand.
There are a number of reasons why the current tech tree is inappropriate for submarines. Firstly, the weapons that a submarine could have: there’s only two. The Sting Ray torpedo (weapon 8) and Tomahawk missile (weapon 9) are the only weapons appropriate to be fired from a submarine. This would make rushing down the hull tree to submarines pointless unless you’d already reached near the end of the weapons tree – and in most games, you don’t even get that far.
It also creates a UI complication, in that currently, any combination of hull and weapon is permissible. Submarine-appropriate weapons would break that behaviour.
There’s an issue with anti-submarine weapons too. Again, only two (Depth Charge (6) and Sting Ray (8)) are appropriate for use against submarines. But since a viable submarine build wouldn’t exist until Hull 6 + Weapon 8, they would only exist in the late game, at which point Depth Charges just can’t hold their own against other weapons – so why have them at all?
To abuse game theory, the logical choice is for players to build Depth Charge ships when they become available, then hold them in reserve as insurance against their opponent building submarines. But if you see your opponent stocking up on Depth Charge ships, you might as well not bother building subs and just go for better weapons and radar instead. Whoever commits to a strategy first ends up on the losing end.
To cure these problems, perhaps we need to take another lesson from Warzone 2100’s book and have separate tech trees for different weapon types. So rather than one tree of 10 weapons, we have two trees for anti-ship and anti-sub. (And potentially anti-air later.) If we’re going down this route we ought to have different hull trees for ships and subs too. But at this point it’s turning into a rather different game – a slower, more traditional rock-paper-scissors RTS. But these games benefit from larger playing fields, varied terrain and squad-based combat – none of which Sea Battle is particularly well suited to in its current form.
So the question stands: Do I expand Sea Battle significantly to include this extra complexity, on the understanding that I would probably need to rewrite it in something other than Processing and that may consign it to the pile of “projects I lost interest in”, or do I just ignore the issue and for the sake of simplicity not treat submarine hulls as any different from ships?
-
Sea Battle: Here Comes the Science Bit
Another day down, and somehow Sea Battle is remarkably close to the finish line. (No idea what I’m talking about? See previous blog entries 1, 2 & 3.)
First things first, my failings: CPU use and mouse sensitivity are still not fixed. I’m now having to re-render more of the window on each refresh than before, so if anything they might be slightly worse.
On the Facebook thread, Scott and Mark mentioned an AI issue in that a suitably scary player ship, when parked close to but slightly off to one side of the enemy base, will be ignored by enemy ships in favour of attacking the player base instead – even when they have no hope of destroying the player’s base before their own is destroyed. As far as I know that issue is still there, though improved enemy research and build AI should mean the enemy is pumping out ships just as scary as yours.
On to the new features:
-
All 10 hulls, weapons, engines and radars are now implemented
-
You can now choose between them when setting build orders, so you can build in whatever configuration you like
-
Research is now implemented – click on an unresearched component to start researching it
-
You start the game with only basic components, and must research more to survive
-
Colours: Grey - not researched yet, Green - researching now, White - available, Yellow - selected (clicking Build will build this)
-
Enemy AI now handles its own research
-
Enemy AI now builds intelligently rather than randomly
-
You can now drag a box to select multiple ships
And bug fixes / tweaks:
-
Base health significantly increased
-
Building a second ship without moving the first no longer places them on top of one another
-
Pathfinding code tweaked to cope with much faster/slower ships now all the hulls and engines are available
-
Fixed an issue whereby the blue radar circles were drawn at half the ships’ actual radar range
Still to come:
-
Ship / submarine hull and vs ship / submarine weapon distinction
-
Tweaks to enemy AI
-
CPU use / mouse responsiveness fixes
-
Menu system and difficulty picker
If you’d like a good strategy for beating the game at this point, I recommend you begin by keeping your build queue about 3-4 ships full, building the best thing you can at any point. Research-wise, rush down the weapons tree as far as Harpoon missiles, throwing in a couple of hulls and radars. Avoid engines for now. As soon as you have Frigates with Harpoons and Radar Mk 4, keep building them until you’ve fended off all the enemies near your base and you have a fleet of 15-20 of them, then move them all right up to the enemy base. With that fleet you should be able to destroy the base before the ships they build wear yours down too much.
-
-
Sea Battle: That's what Guns are for!
Another day – or three, in this case – brings another ton of functionality for Sea Battle. (Previous posts: 1, 2)
Today’s release reduces the target frame rate from 60 to 30 frames per second, in an attempt to alleviate the CPU hogging reported by aefaradien in the previous post’s comments section. As I said in the comments, it’s not an issue I see on every machine, so I’d be grateful if any testers could tell me what PC setup they have, and how much CPU power the game takes up.
Today’s version also fixes the spinning ships bug that just about everyone reported. What it doesn’t do is make mouse clicks any more responsive, which is annoying me too. Please bear with it for today, I’ll see if I can work out how to deal with that soon.
Mostly this release is about new features. Sea Battle now has:
-
Ships are now implemented as having separate Hulls, Weapons, Engines and Radars
-
Ships can shoot at each other (finally!)
-
Ships have health (and health bars), and can be destroyed
-
Bases have health (and health bars), and can be destroyed
-
That means there’s now a win and a lose condition
-
Enemy ship AI now considers your ships’ scariness – a factor of firepower and remaining health – to pick targets it thinks it can defeat
-
You can now build, with appropriate build delays and an 11-slot build queue
-
The enemy can now build too
-
Colours have been tweaked to make ships’ allegiances more obvious
The only real bit of functionality that’s still missing is the research / build options. Currently, clicking the Build button produces a ship of a predefined configuration – you can’t change that config or research better ones. The AI builds random ships up to and including as powerful as your default one, and has a reasonable amount of ‘thought delay’ to its actions, meaning that you can achieve victory fairly easily. (Just fill up the build queue and send every ship North as soon as it’s built – you’ll lose a few, but enough should survive to destroy the enemy base.)
Note: this blog post is old, and the game now has more functionality than is described here. The next blog post in the sequence is here.
-
-
Sea Battle, now with more Processing
Nearly a month ago now, I blogged some sketches and ideas for a game I felt like writing. masterofwalri made a passing reference to Processing in his comment, and having heard people mention it in the past, I figured I should check it out.
I’m very, very glad I did.
It neatly deals with the issue of what I should develop for. The comments were leading me down the Java path anyway, but Processing’s two-click export to Applet and bundles for Windows, Linux and Mac OS sealed the deal. And it’s easy to program in too – it’s clear that it’s beginner-oriented, but it’s also ideal for simple games like this as it simply removes all the starting faff, like sorting out
JPanel
s andTimerTask
s and all the rest. Time will tell if Processing over-simplifies things and stops me doing something I want to do, but for now it is excelling at the main task of high-level programming languages – reducing the amount of brain overhead I need to allocate in order to talk to the computer.One lunchtime has produced 270 lines of code – which already includes the game area of the GUI, controllable player ships, and the beginnings of AI for the enemy ships.
Note: this blog post is old, and the game now has more functionality than is described here. The next blog post in the sequence is here.
Currently there’s no real gameplay – you can’t build, and ships can’t shoot or be damaged. You can move your ships (starting at the bottom of the screen) around, and the AI ship will hunt yours. Click on a ship to select it (blue circle), then click elsewhere to set its destination. Red lines, when they appear, show when ships would be shooting.
The next block of code will give the ships customised gear, health points, and the ability to attack and sink others. With that will probably come attack animations, which with my lack of skill in that department, will take a while. After that, damageable bases and win/lose conditions, then the build/research system. Finally, graphics tweaks, AI improvements and game balancing will finish it off.
More bloggery will appear once more coding occurs!
-
Windy Morning Mechanics: How Big a Sail do I Need to Fly Away?
I recall walking to school in a hurricane in what must have been 1989 or 1990, grabbing onto a nearby fence to hold myself steady, wondering how strong the wind would have to be to pick me up off the ground. In the intervening 20 years I never did work it out. It’s a windy day today, so, to the Classical-mechanics-mobile!
It seems intuitive to me that the answer to the exact question posed by my five-year-old self is “really bloody strong”, and that a better question might be “how much surface area would I need, positioned at the optimum angle and given a certain wind speed, to counteract my weight?”. Or alternatively, “I’m off down to the workshops, how big a sail do I need to make myself?”.
Let’s start with the pressure on a surface due to the wind, ignoring any issues of aerodynamic flow. Bernoulli’s equation gives us a pressure differential dp, by:
dp = (v2/2) ρWhere v is the velocity of the air, and ρ its density.
The force, F, exerted by the wind on a solid of area Ap perpendicular to it would then be:
F = dp Ap
= (v2/2) ρ ApAssuming the wind is blowing horizontally, in order to generate the maximum amount of lift, the sail should be at 45° to the wind. In this configuration, half the force exerted on the sail will push it in the direction of the wind, and half will push it up.
However, tilting the sail by 45° (π/4 radians) reduces the area which it presents to the oncoming wind. The area presented to the wind, Ap, as a factor of its true area, A, is given by:
Ap = A sin(π/4)
= (√2/2) ASubstituting this into our force equation, we get that:
F = (√2/2) (v2/2) ρ AOr to simplify,
F = (A v2 ρ) / (2 √2)As mentioned earlier, only half that force is upwards, the other half being in the direction of the wind. So the vertical component of the force, Fv, is:
Fv = (A v2 ρ) / (4 √2)This force is being employed to lift a mass m in Earth’s gravity g, so we have that:
m g = (A v2 ρ) / (4 √2)Rearranging this for the sail area required gives us:
A = (4 √2 m g) / (v2 ρ)Numbers time! If we assume a bored software engineer of mass (m) 80 kg, Earth’s gravity (g) of 9.8 m/s2, air density (ρ) of 1.2 kg/m3, and the Met Office’s current estimate of wind speed (v), 54 miles per hour or 24.14 m/s, our answer is:
A = (4 √2 × 80 × 9.8) / (24.142 × 1.2)
= 6.3 m2That’s quite a bit bigger than what I could achieve with bat-style wings between my arms and body, but not totally unachievable.
For my 20 kg five-year-old self, that area would be four times less, at 1.6 m2.
Part 2
Since we’ve got this far, we might as well check out my “really bloody strong” hypothesis for how strongly the wind would need to be blowing to enable our engineer to take off unaided.
Rearranging the equation for wind speed gives us:
v = √((4 √2 m g) / (A ρ))Our engineer has a surface area (from behind) of approximately 1.5 m2, so all other things being equal, the wind speed, v, required is:
v = √((4 √2 × 80 × 9.8) / (1.5 × 1.2))
= 49.6 m/s
= 110 mphThis is well into hurricane territory on the Beaufort scale, although still a way short of the fastest wind speed ever recorded.
As for my five-year-old past self, if I had quarter the mass and the same density, I also had around (1/4)2/3 = 0.4 times the surface area. The air speed required to lift me off the ground at that age would have been:
v = √((4 √2 × 80 × 9.8) / (0.4 × 1.5 × 1.2))
= 39.2 m/s
= 87.7 mphAlso comfortably in hurricane territory, though not quite as outrageous as 110 mph. Maybe if, back then in 1989, I’d stretched my coat out and angled back at 45°…
Thanks to Tam Coton for correcting my original error in the final section.
-
Waning Technological Desire
What seems like a long time ago, I blogged about the unrelenting pace of technology and Internet-borne social interaction, and how much I loved it. But that was a February day with the promise of Spring in the near future. Now it is Autumn, and I am not altogether sure I feel the same way.
I’ve thought long and hard about my options now that my phone contract is up for renewal, and the more I consider, the less sure I am - not just of what I want, but of my innate gadget-fetishism as a whole.
My first choice was going to be a Galaxy Tab, but having seen the prices, I’m not sure if it remains a sensible idea. For that money I could have an iPad - I’m typing this post from one and it sure is nice to type on, but everything else Appley would get on my nerves soon enough. Should I just go for an upgrade of my current hardware - the latest and greatest Android phone, rather than trying to split my usage into a separate tablet and dumbphone? Maybe just jack the whole business in and keep internet browsing to my laptop?
My previous post, in which I spent too much of everyone’s time reminiscing about my horrific late-90s website, reminded me of simpler days. Windows 98, Yahoo dialup, AOL Instant Messenger, Netscape Navigator. A big beige box with 32MB of RAM and 1 hour-a-day usage limit imposed by my parents.
Pretty grim by today’s standards. But yet I used AIM to talk to my friends every night, even though I’d seen them at school that day. And now we have Twitter and Facebook and all the rest, and I’ve IMed my own Best Man, someone I lived with for two years, maybe once a year - and most of my other friends less than that.
I looked at only a few websites a day, in part because they took so long to load, but I was pretty happy with that. These were days a long time before RSS and clearing hundreds of items a day through Google Reader.
For all the grey clicky buttons and emoticons and sneaky IRC sessions behind my parents’ backs, was it maybe just more fun when that’s what the Internet was like? Should I save my money for something other than gadgetry, and hark back to some more innocent age? Or have I got my rose-tinted mirror shades set to maximum, yearning to revive a fake past that I would get bored of within days, separated as I would be from the lightning-fast pulse of technology?
-
A Farewell to Marmablues
May 1998, half a lifetime ago. It was my 13th birthday, and my parents – no doubt annoyed by four years of me messing with the family computer – bought me my own. It had a 333MHz processor, 32 glorious megabytes of RAM, and most exciting of all, a 56k dial-up modem.
With Microsoft Word as my co-pilot and under the ever-watchful phone-bill-monitoring eyes of my parents, I discovered the delights of owning my own website. It had it all, oh yes. Giant background images, a different one for each page. Animated GIFs. Background MIDIs. Frames,
<blink>
and<marquee>
. Web rings to click through, and Tripod’s banner ads inserted at the top of every page. It was called “The Mad Marmablue Web Portal”, and it was exactly as horrendous as you are imagining.A few years later, a chronic lack of smallprint-reading led me to buy it a ‘free’ domain name, only to receive a scary-looking invoice a month later. In the end my parents sent the domain reseller a letter explaining that I was a dumb-ass kid who shouldn’t be trusted on the internet, and that was that. But at the age of seventeen, in possession of a Switch debit card, I found a web host who would set me up with a domain and 100MB of space for £20 a year. “marmablue.co.uk” was born.
Today, it died.
I shouldn’t feel sentimental about jettisoning an old unused domain, particularly not one that harks back to the late-90s animated GIF horror of the Mad Marmablue Web Portal. But it was a part of my youth, the place where for the first time I could put something and anyone could see it. It was where I took my first steps with HTML – by ripping off other websites, naturally – and in time, it was where I first learned JavaScript, PHP and SQL too.
I will miss it. But if I sit very still, and very quietly, I can still hear that horrible 8-bit MIDI rendition of the RoboCop theme tune. So maybe I won’t miss it all that much.
-
The Atheist's Sense of Wonder
I’ve no idea why this thought should crop up now, but I recall being asked several times by religious folk why I would choose not to believe in a god. Often their question is something like “Why believe that everything you see around you was created by random chance, when it would be so much more wonderful to think that someone created it all just for us?”
I disagree completely.
Isn’t it more wonderful to think that at some point, billions of years ago, everything we know was just an unimaginably tiny, unimaginably hot and dense energy field? That within seconds, it coalesced into quarks and leptons and other stranger things, that those quarks became protons and neutrons, then on into hydrogen and helium atoms?
Isn’t it more wonderful that a simple force like gravity drew those atoms together into huge balls of gas, so hot and dense that they ignited and became shining beacons visible from the far end of the universe? And that they eventually exploded, scattering heavy atoms far and wide? And that those atoms – oxygen, carbon, iron, even as heavy as uranium – gathered around another newly-forming star, clumping together into big balls of rock, one of which happened to be in just the right place around just the right kind of star to sustain liquid water on its surface?
Isn’t it more wonderful that after a billion years of volcanism, asteroid impacts and boiling, toxic atmospheres, somewhere in that water, a bunch of molecules lined up in a pattern on the surface of some clay and became the first proteins? That these chemicals strung themselves together in molecules so complex they could contain the code for their own reproduction? That they became so much more complex still that they could encode the information to generate a cell, a microscopic blob with a membrane that means it can keep conditions inside itself different from those outside?
Isn’t it more wonderful that over millions or billions of years, they developed gills so that they could extract oxygen from the water, and gain their energy from that rather than directly from the sun? That after yet another unimaginably long time, some of them went on to develop legs that would allow them to colonise the land?
Isn’t it more wonderful that millions of years ago the Earth was ruled by giant lizards, and that that isn’t just the plot of a science fiction movie but the real history of our planet?
Isn’t it more wonderful that 14 billion years after the first quarks formed, we stand here today? For all that we are vulnerable, disease-ridden, selfish and fond of killing each other, we alone have the medical knowledge to understand ourselves, and we alone have brains advanced enough to contemplate themselves. We alone understand biology, chemistry, physics, mathematics. We alone have telescopes to study distant stars, and we alone have built spaceships that we have thrown out beyond our solar system into the cosmos beyond.
And is it not more wonderful still that we may not be alone in the universe, that amongst the billions of stars and maybe trillions of planets, there could be other creatures like us – or even that the universe could be swarming with life; great civilisations spanning the distant galaxies.
But an omnipotent MacGuffin that made the Earth just for us? That’s not all that great.
-
October's End
How quickly this October has come and gone! Barely a memory ago, it was summer, and we took the train home along the beach in the sunshine. But before long jumpers came out of the cupboard, then coats, then hats. Suddenly the ground is frosty of a morning, I wake up in darkness, and I return home in darkness. The house is empty and cold, and Hallowe’en looms.
If the past is anything to go by, the next month will bring vacant, lonely feelings, feelings of disconnection from the world. I’ll write, but never finish anything I start. And November will pass in a blur, much October has before it.
But then it will be December, a more homely month. The house will be warm again, and light, and will smell of casserole and mince pies.
I never did get on with November.