A 3D printed World Lock

I’ve been eyeing 3D printers for quite a while and finally pulled the trigger and purchased the rather economical Flashforge Dreamer.

I actually wanted a Taz 5 but I couldn’t find anywhere to ship it to Japan at a reasonable price, so whatever.

Anyway, despite feeling a bit limited due to the smallish build area it’s been a lot of fun.

IMG_1915

Printing an elephant

IMG_1917

The finished elephant. The legs move with no assembly as they are printed that way!

Was up and printing in thirty minutes.  So far stuff has worked without hairspray, glue sticks, painters tape and the other things I read about that scared me.

Some Dreamer tips:

  • The SD card shows as “error” in the dreamer when you have Wifi enabled. (as of the latest firmware available on 4/22/2015)  I think it has something to do with Wifi mode taking over the SD card as it uses the SD card as a cache while printing.  They should really change the message to “busy” or something. If you need to print from SD, turn off Wifi first.
  • I almost always print with a fairly hot build plate. (65C)  I let it cool before removing the print.
  • DO NOT USE the putty knife it comes with.  It’s way too thick.  Buy one with a much thinner edged one at the store and you will be amazed at how much easier your prints come off the bed!
  • If a print is going to fail horribly, it’s probably going to be within the first 5 minutes, so check around then.
IMG_1919

No really, that’s exactly what I was going for

Thingiverse seems like “the place” to get 3d files.  Any other good places out there?

If you have a dreamer, the first thing you notice is those spools of filament you bought from adafruit are too big.  No problem!  I used this design and a skateboard bearing to create a nice lazy susan style spool holder, it works great.

Also printed a solder spool holder just because.

IMG_1927

A printed solder holder. See, I’m saving money already

IMG_1935

3D printed Pi2+PiTFT case for my Growtopia monitor so it looks less like a bomb, found it here.

Ok, that’s all fine and dandy, but the real reason I wanted a 3D printer is to make my own stuff.

I used Inkscape (sort of the Blender of vector art) to generate a shape from the 2D bitmap of the Growtopia logo, imported that into Blender and extruded it.   Well, as I expected it’s a bit hard to see and crap in general.  I printed another in black filament to sort of use it as a “drop shadow”, helped a bit.

Can you recognize this logo?!

Can you recognize this logo? Er.. maybe if I raised parts to make the letters stand out more, I dunno

It was suggested on Twitter to print Growtopia characters, but man, that’s hard to do. Akiko whipped up a 3D model of a world lock for me though.

world_lock

Have a 3D printer and want to print your own World Lock?  You can get the .stl from here!

What other simple Growtopia things would make sense to print?  Hrm.  Is a character really possible?  What if we painted it…

A tip about Blender to 3D Flashprint/Simplify3D’s stl scale

In Blender, I set the units to metric, then set the scene scale to 0.01.  When doing the final export I set the STL export scale to 1000 and this keeps the measurements in Blender exactly matching the final print size.  (Use the Ruler/Protractor tool in Blender to measure pieces easily)

blender_measurements

Also, keep in mind Blender now has some helpful options to check if your models are setup right for 3D printing, you just need to enable them. Too bad the export STL button on the 3D Print menu doesn’t have a scale setting, I need that.

Conclusion

I bought a 9 pin dot matrix printer for $220 for my Commodore 128 a looong time ago. You’d laugh at the low resolution pictures I downloaded off Quantumlink and printed. You had to stand across the room to figure out which movie star it was. So noisy.  So slow you could read faster than it could print!

Similarly to the path 2D has taken, I believe 3D printing is now accelerating its journey towards detailed full color prints that will become a standard we all take for granted in just a few years.  Exciting times.

Seth’s Crappy Game Reviews – The review quality that is, not the games

I play a lot of games. I mean, a lot.

So I figured I’d sit down, think about the games I’ve played in the last year and sort of give my opinions on them.  Screenshots were taken by me, generally because I accidently hit the stupid share button on the PS4 or something, but hey, they came in handy today.

Assassin’s Creed Unity (PS4)

Well, it’s another Assassin’s Creed game.  I didn’t enjoy this one as much as  Black Flag (you got to be a pirate and sail ships around!) but it’s ok.  Like every Assassin’s Creed game, you run around in an open world killing people (from behind, more often than not) and earning points until you can finally unlock the power where you can be a ninja and back stab two people at once.

I didn’t find France in the 1800s a particularly interesting setting.

Assassin's Creed® Unity_20141225153146Not since Dead Rising 3 have I seen this many characters on screen, crowds are truly something to behold.

It can draw 1000 people but it can’t locate the stinking straw cart right in front of you.

Papers, Please (by Lucas Pope, PC)

I’ll be honest, I sort of avoided this game because I figured it would be a simplistic preachy game that I’m simultaneously agreeing with and totally uninterested in playing.

Happy to say that isn’t the case – it has fascinating mechanics that truly pull you into the world of being an immigration officer. It won’t take you more than an hour or two, but I highly recommend it.

Farcry 4 (PS4)

It’s exactly like you would expect if you’ve played Farcry 2 or 3.  If you liked those (I did) you’ll like this.

The Farcry recipe is you move around some vaguely asian country helping the natives and fighting the local militia while skinning pigs and finding treasure in an open world environment. It’s just good fun.

Metal Gear Solid V: Ground Zeroes (PS4)

This is a one level demo that cost me $30 and takes around 45 minutes to complete.  Screw you, kojima.

I’m possibly bitter because I bought this twice, my version had Snake speaking Japanese only, so I bought it again in English, not knowing I had like only 5 minutes left to play.

METAL GEAR SOLID V_ GROUND ZEROES_20140324144022

Snake not being voiced by David Hayter just feels wrong.  But heck, I’ll take Keifer over him speaking Japanese.

Looking forward to the next REAL Metal Gear though. (Phantom Pain)  Behind Kojima’s ridiculous characters and embarrassingly bad writing there is generally an amazing game engine.

Wasteland 2 (and as a bonus, Dragon Age Inquisition sort of)

It really is a modern Fallout 1&2 style experience.  The writing is great, the fighting engine is solid.

I quit playing Dragon Age Inquisition (highly polished and flavorless ) to play this (a bit rough around the edges but much more entertaining) and haven’t looked back.

Thief (PC 2014 version from Square Enix)

Man, I don’t think I’ve ever hated the character I play as much as this version of Garrett. He’s constantly whining about things being too dangerous, slaps his much cooler partner and then backstabs her.

The only person I wanted to murder was Garrett, where is that button.

As the for the actual game?  Yawn, go play Dishonored or The Order 1886 instead.  I mean, it’s ok I guess, but way too much figuring out which of the 1% of windows and doors actually are usable and will trigger the next predictable scripted scene. Did not finish.

The Order 1886 (PS4)

Well, if you’d like a stealth fps with a sort of alternate steampunk timeline of the 1900s in England, this is your game.

Everybody has been freaking out about the render tech in this game – Ok, I guess.. sure, it’s a very convincing London, they’ve finally figured out how to make a foggy drizzly boring looking town realistic.  Great, I guess.

The Order_ 1886_20150301133648

WE DID IT EVERYBODY, OUR REAL TIME RENDERING TECHNOLOGY NOW HAS NOSE HAIR.

This game is perma-letterboxed, I assume to increase the FPS after using so many shaders to create the ultimate in realistic drab.

If you ever want to make paintings of this game you can do it cheap because you only need to buy brown and gray.

Despite my complaints about the lack of variety in the scenery it’s well written and I enjoyed it.

Metacritic’s 65 rating seemed unfair.. until I finished the game, then I agreed with it.  The game ends when you emotionally feel like you’re at the halfway point.  Nothing is resolved.  Where is the third act? DLC?  You bastards.

The Evil Within (PS4)

I think this is a pretty good Resident Evil flavored game hampered by a poor framerate and horrible field of view (FOV).  And I’m talking about the post-patched version, not the “on disc” version that was reportedly much slower.

evilwithin

As a programmer who’s had to do similar evils, I can tell you that both of these things are usually done to increase the frame rate in a desperate last minute attempt to make the game playable at all.

With such a poor FOV you are constantly looking around to find switches and items right next to you despite a rather clumsy “an item is down there!” icon overlay.

Artistic intent my ass.

If the Order 1886 feels like half a game, this feels like double.  I was sure I was on the last mission but it turned out I was only about half way through the game.  Was a bit grueling but I finished it.

I recommend this if you can get the PC version on a beefy computer – if you can play at a decent framerate without the letterbox I’ll bet it’s worth your time.

inFAMOUS Second Son

inFAMOUS Second Son™_20140405211322

It’s ok.  You are sort of a super hero running around Seattle who can’t use vehicles. Gameplay does get a bit dull and samey after a while. I don’t hate it.

Watchdogs

Second place for most unlikable main character in a game has to be Aiden Pearce. He’s constantly trying to be brooding and cool but comes across as just a creepy stalker.

WATCH_DOGS™_20140528112659

As far as open world games go, it’s a nicely realized city and some of the NPC’s have surprisingly advanced behavior, like a group of kids kicking around a ball.  (Naturally I butted in and stole the ball)

I actually had a lot of fun with this one despite the bland story.

WATCH_DOGS™_20140622230426

Good ‘ol clipping bugs.

Wrap up

So there you go, proof I’ve been playing too much and programming too little. At least buying games is a write off.

Dev Diary: Fun with Arduino, Proton on the Raspberry Pi & PiTFT, GT Monitor

Is there one among us who hasn’t fantasized about inventing evil mechanical wonders?

Perhaps a synthetic life form that can navigate to the living room and shoots nerf projectiles at a surprised spouse?  Who hasn’t imagined creating an electroluminescent holiday masterpiece (like Phil Hassey did) or dreamed of becoming a kid’s hero for adding humble blinking lights to a birthday cake?

cheap_kit

So yeah, I bought a cheapo Arduino set. It was.. ok, I guess.  Some pins were bent and the .pdf I found online for it was difficult to understand.. how do I even use all this stuff? But my taste hath been whet and must be satiated so I splurged on the real Arduino starter kit ($100) which is much better for beginner fools like me.

arduino_setAn actual book!  It’s worth the extra cost. I did about half the tutorials – made lights blink, switches switch, and a piezo whine annoyingly. No way that Zoetrope was ever going to spin right, did anybody get that working?

For my first real project, I wanted to create a stand-alone monitor for Growtopia that would show me how many users are online, alert me about errors (“SERVER IS DOWN, WAKE UP FOOL!”), and display live sales data with audio.  (cha-ching, you made money!  Oh, don’t pretend you wouldn’t do (or have done) the same, it’s just for fun. Unless it’s silent, then it’s more depressing than fun really)

It had to be something I could carry to bed or a restaurant and would just work.

Doing something like that is really a challenge with an Arduino.  First, to play audio, I ordered the Arduino Wave Shield ($22) and was overly proud when my amateurish soldering actually worked. I can now play 12 bit .wav files, yay.

Have I mentioned I love Adafruit?  They don’t just sell you stuff, they also have fantastic tutorials on how to use the thing you just bought – so buy from them!

You know what? This Arduino Uno R3 is very limited. It’s ok at doing one thing – but when you start trying to stack things together you run into limitations very quick. Does the Wifi Shield even work with the Wave Shield? Would any pins be left over for lights? Would the program to do all this fit into 32k? You can forget about decoding mp3 audio unless you add hardware.

Enter the mighty Raspberry Pi

So I set that aside and got a CanaKit Raspberry Pi set ($70 as I write this).  Hey, wait a minute, it’s just a cheap, tiny computer! It’s marvelous. It can run linux, and has hardware pins to read/write to electronic things like lights and motors.  You don’t need a Wifi Shield or a silly Wave Shield because it plays audio out of the box and you can just plug a USB Wifi dongle in.

First thing I did was write a simple C++ program using gcc from the ssh command line. Next, I set things up so I could write/debug in Visual Studio on Windows, then had a .bat script running in the background to constantly rsync the entire directory to the Raspberry. You can download a neat package of linux-like tools that work with ssh and run on windows here.  You’ll probably want to setup SSH keys so you don’t need a password.

SET PATH=%PATH%;C:\tools\Grsync\bin
 :start
 rsync -avz linux/ root@192.168.1.46:/root/seth
 :pause
 #timeout /t 10
 goto start

On the Raspberry Pi linux side, I setup a .sh file to run cmake and make in a loop for a continuous compile. I feel mean making it work so hard, but whatever.

After compiling and running it in Windows, I just had to glance over at the ssh window to verify it worked under linux as well, or what the compile error was if not.

Don’t underestimate the value of setting up scripts that allow you to be lazy like this. Workflow is everything!

To get GPIO access (read/write the pins to control lights and motors) I used a C++ library I found called Wiring PI.  Naturally that part doesn’t work in Windows (could write a fake interface that mimicked it and.. nah), so I #ifdef’ed that part out for Visual Studio.

To play audio I cheated a bit and just ran a system program (called “aplay”) to play .wavs:

void PlaySound(string file)
{
     system( (string("aplay ")+file+" --quiet").c_str());
}

Real hard, right?

But if you want to run a system command and be able to also read the results it gives, you need something more like this:

//a bunch of linux headers you probably need for this, the above function, and more
#include <syslog.h>
#include <unistd.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>

string RunShell(string text)
{
string temp;
#ifndef WINAPI
//printf("running: %s\n",text.c_str());
 FILE *fpipe;
 char line[256];
if ( !(fpipe = (FILE*)popen(text.c_str(),"r")) )
 { // If fpipe is NULL
 return ("Problems with pipe, can't run shell");
 }
while ( fgets( line, sizeof(line), fpipe))
 {
 temp += string(line)+"\r";
 }
 pclose(fpipe);
#else
//well, on window let's pretend it worked as I don't have curl/etc setup here on windows
 temp = "(running "+text+")";
#endif
 return temp;
}

So how can I get data from the server?  Well, it’s linux, so I cheated and just have the C++ call the utility curl and grab what it returns:

string returnInfo = RunShell("curl -s http://somewebsite.com/myspecialstuff.php?start="+toString(g_lastOrderIDSeen)+"&max="+toString(max)+"");  //or whatever you want to send

Parse what it gives back, and there you go.

raspberrypi

In the above pic, it’s working.  The red light goes on for a normal Growtopia purchase (Gem’s Bag, etc), the green light flashes for a Tapjoy event. I have a little battery powered speaker connected to the Pi’s headphone jack to play audio for each event as well.  The button on the breadboard toggles audio for Tapjoy.

What about portable video?

Audio and blinking lights will only get you so far, this isn’t 1950s scifi. To show the active user count of the game I need a portable screen. The easiest would be a tiny monitor with an HDMI plug (raspberry has that built in), but I didn’t really see anything for sale that was cheap, tiny, and had low battery requirements.

On the other end of the spectrum, there is a tiny two line LCD like this. Nah.. oh hey, the Adafruit PiTFT, a 320X240 screen with touch controls for $35!  Perfect.

proton_pi

To get it going I had to install their special linux distribution for it. (they have a whole tutorial thing, it’s not hard)

Unfortunately we have no GLES acceleration.  So how do we do C++ graphics without GL? I considered trying to use something like Mesa (I use that on the Growtopia servers to render images, it’s a software GL solution) but.. meh, let’s be old school here.

You just draw bytes directly to the frame buffer, like your grandparents did! I found some great info on framebuffer access and handling touch events on ozzmaker.com.

Actually I guess there might be a version of SDL that will work with this screen (?), but I’d prefer to use my own stuff anyway so I created a “Proton-Pi” lite version of Proton SDK that is modified to work with only SoftSurface instead of Surface (which is GL/GLES only) and only includes a subset of features. I could maybe make a demo app and zip it up if anybody wants it.

It has no audio or Entity stuff. RTFont can now render directly to a 32 bit SoftSurface and then to update the screen you blit to the framebuffer. I think it gets like 15 fps.  Would be faster without the slow 32 bit to 16 bit conversion on the final blit… but meh, who cares for this.

server_monitor

So here is the final result.  Thanks for the 2.2 cents, kanyakk! You just plug it in to power (I’m using a $20 7800 mAh phone charger pack) and it will run quite a while. (I left it on overnight and the battery reported half charge)

The Linux stuff has been setup with the logon info of my home wifi as well as my iPhone’s hotspot wifi, this way it can be used anywhere, as long as I remember to turn on the hotspot sharing. After boot it automatically starts running the GT monitor program.

I took it to a restaurant, it worked! But I ended up hiding it because when people logged off and the numbers ticked down the whole thing sort of looked like a homemade bomb or something and I didn’t want to creep everyone out more than usual.

Final thoughts

Well, it was fun but .. but alas, the cold hard reality hit me; I could have just written an iPhone app to do the same thing. (or as Phil pointed out, a web page, which would be the ultimate in portability)  My end result has no cool physical buttons, servos, or even blinking lights.

I just fell right into the old comfortable “programmers groove” of doing it all through software.

Tips (?):

  • Copying a 16 GB (mostly empty) sdcard to a 8 GB for say, a second unit, is a big hassle due to linux card sizing/partition issues, so you might want to start with 8 GB microSD cards from the beginning unless you really need the space.  (They are only $5 a pop)
  • Raspberry Pi is cheap and amazing! Most useful if you are ok with linuxy stuff.. or at least willing to learn
  • Tried a BeagleBone too, it’s like a Raspberry Pi, but less popular so lacking hardware add-ons/tutorials for now
  • Even though it sounded like I’m bagging on the Arduino in this post it’s still the perfect thing to use if you need to control something simplish with no boot times and low battery usage.

But I’ve got a pretty cool idea for the next project…

Dev Dairy: Growtopia thoughts

What I’ve been up to

Working on Growtopia mostly.  Despite Growtopia being nearly two years old now it has just had its most profitable month!

Some stats:

Total user accounts: 5.6 million
Total worlds created: 95 million
Daily unique users: 337,000
Daily hours played: 550,000
Daily peak concurrent users: ~40,000

Sadly, that’s pretty much all I’ve been up to

As a self employed developer I’ve learned that when something does well, you focus on it and ride the money train while you can because it won’t last. You bank the extra to tide you over when things get slow.  Success dictates where you spend time because you’d be a big idiot not to.  Something like that.

This is why I worked on Legend Of The Dragon (off and on) for seven years.  As the BBS era came to a close, so did my updates.

Maintaining Growtopia is now less about programming/creating for me and more about isolating problems, fixing bugs, monitoring servers, answering the hardest support questions, scanning logs, putting out fires, figuring out why we have are having dropped packets, which incidentally, we are currently having an issue with.  Maybe a bad router, man I hate when it’s hardware.

Can I do this and still have the “emotional energy” to make something new (part time)?  To actually program again?  Hmm.

Dev Diary: A look at Visual Studio 2013, Unity, and UnityVS

oldman

I’m a bitter old man

When you’ve been making stuff as long as I have you get comfortable with your tools.

I am a greased ninja with Visual Studio 2005, VisualAssist, and C++.

I’m a snail drenched in chunky peanut butter working with anything else.

But yesterday I gave Visual Studio 2013 + Unity a shot and it actually wasn’t half bad, so here are my tips if that’s something you’re interested in.  Beats MonoDevelop by a mile as far as I can tell.

My tips for people upgrading from old VS versions:

  • First I downloaded Visual Studio 2013.   I guess it’s “Ultimate” and free for 90 days?  Fine.  After that we’ll see, but I’m pretty sure I’m not going to cough up $13,299 for Ultimate!
  • Set keys to the included VS 2005 layout.  Changed it so F7 will compile all.
  • MOST IMPORTANT: Enabled Options->Environment->Tabs and Windows->Floating tab wells always stay on top of the main window.  Without this I found VS 2013 totally unusable.
  • Turned off the silly all upper case menu fonts
  • Installed Productivity Power Tools 2013 (adds some stuff to make the IDE smarter, sort of like VisualAssist?)
  • Oh God, what are these vertical lines connecting every matching brace?!  Disabled that, FAST.
  • Stopped it from showing “References”
  • Turned off its funky new scroll bars, but ended up turning them on again, gotta see how that feels, they do have some interesting data
  • Installed UnityVS (MS did something very smart, they bought it and made it free)
  • Imported the “Visual Studio 2013 Tools.unitypackage” into a simple Unity project (this file gets installed by UnityVS  into C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\2013 or something, have to dig for it)
  • Inside Unity I double clicked a source code file and viola, it did load the project in VS 2013!  It wouldn’t start the Unity project when I hit F5, but it did connect to the process, so after manually starting the game in Unity it did perform debugging fine.  I think Visual Studio has THE BEST debugger around so this should come in handy.  Er, I mean, I’m guessing, since my code never has bugs of course. <awkward silence and then someone coughs in the back>
  • When you hit a breakpoint, the Unity editor side seems to completely freeze until you hit Resume, too bad, seems like it would be useful to tool around in there and look at objects during debugging.
  • Anyway, everything works and doesn’t feel half bad.  So far.  I assume the crashing,  freezing, and constant reboots that also plagued my experience with MonoDevelop/Unity will start soon though.

Anyway, here’s a picture of what debugging looks like.  I think it would be handy to be able to write non-Unity specific C# code and simultaneously have Unity and non-Unity VS projects open using it, maybe C++ as well as I still like that for my server backend code.  (See my Space Taxi Multiplayer test)  (Uhh, ignore that code in the screenshot, it’s uh, an exercise for the reader to figure out how to make that less stupid looking and redundant)

unity_and_visual_studio