Remember that Pebble I was talking about the other day? Well despite the fact that half the time the display looks like this:
I’ve managed to compile and run this:
The key to being able to use the screen is to hold the Down button quite hard… But unfortunately this isn’t always practical, like when I want to use the Down button repeatedly on a list. I have contacted Support but have yet to receive a reply…
But in the meantime I can keep writing watchfaces, just can’t use ’em.
But what if we wanted to change it? Well, here’s how you’d go about it:
- Load up Ubuntu Linux or a suitable VM, download the Pebble SDK (including dependencies and libraries) and set it all up as described here.
- Write the source file, with guidance from the SDK documentation. I’ve already done this (and you can read it in full here).
- Change this line to whatever you want this very basic watchface to say.
- Navigate to the watchface’s directory in a Terminal. For example:
cd ./~pebble-dev/myWatchfaces/TextTest and build the watchface using
./waf configure build
- Find the resulting package file in the ‘build’ directory. For example:
- Copy this file from Ubuntu to Windows if you’re using a VM (I couldn’t get the next step to work when inside a VM.)
- You need to get to the package file directly on the phone. The suggested method is to use a Python HTTP Server, which comes pre-written as part of the Python distribution.
- On the phone, open a Browser and go to the LAN address of the computer running the server. On my network this would be
- There you will find the file. Tap the file name and the Pebble app will open and install the watchface in seconds.
- Now you should see the watchface with its changes on the watch!
Now to work on some other ideas I’ve had…
Today is an exciting day. Why? Because I played a game with someone in Germany.
Why is this exciting you may ask? Good question. It wasn’t just any game. It was a ‘game’ I wrote! That makes it special, even if it is just moving a red circle around.
When another red circle appears with another player’s name above it, that circle is elevated beyond mere geometry and into an extension of that person.
How it is moved by that person becomes the first form of expression, beyond any language.
Anyway, dramatics aside, here’s a screenie of me playing against myself. When I have one of a proper multiplayer session I’ll add it:
Brief details for those interested:
- When a player is moved locally, it sends “#playerposition”, followed by its location x and y to the server.
- This information is then sent to all connected clients in the form “#playerupdate”, followed by that player’s name, x and y. The name of each player is associated with each listening thread on the server.
- When each client receives “#playerupdate”, it updates that player’s local entity’s target position with the new x and y. If that player doesn’t exist, it is spawned and immediately given its current target.
- Each frame, every local entity representing another network player is moved linearly towards its last target position received from the server. This gets around continuously streaming all positions all over the place, and each client need only send data when the local player actually moves.
- When a player disconnects, it sends “#disconnect”. The server then issues a “#despawn” command to all connected clients, followed by the disconnecting player’s name. Each client then removes the corresponding local entity.
I am aware that this is a very crude ‘move to target’ system that will only really work in obstruction free scenes. Anything more complicated like an environment made of corridors and squares like ‘dungeons‘ and pathfinding will have to rear its ugly head once again.
But thats okay, because it seems to get easier and simpler to implement each time it comes around.
If you’d like to help me test this, send me a tweet and we can arrange something!
"toClient.print(message);" != "toClient.println(message);"
Even though the watch isn’t here yet, I’ve gone and managed to compile a simple watchface anyway. All it does is show the text ‘Text’. I did warn you it wasn’t very exciting!
Source code: here.
If you haven’t heard, this is a Pebble Smartwatch. Mine is in the post somewhere between Heathrow and my house… But there is no post on weekends!
Instead, I’ve spent a lot of today setting up the Pebble SDK toolchain and dependencies on a Ubuntu Virtual Machine, and brushing up on my C++ so that when it arrives, I can make my own watch apps!
The fantastic thing about it is that it is completely open, and there are lots of code examples, which I can understand thanks to my tinkering with C and Java.
As a sample of what the community has already achieved, here is John Cleese as a watchface app. Source here.
John Cleese Silly Walks Watchface
Working on the server software some more, with some help from a friend, it now accepts up to an arbitrary (currently 10) connections, each one handled in its own thread. When the server manager gets a new connection, it passes the
Socket to the new thread, which then handles all the I/O for that connection. When that client disconnects, it sets a ‘in use’ flag, which the server manager can then use to re-allocate it if all the other threads are busy.
Here’s a demo image! I’ll also release some source code for this stage, as a simple proof of concept before it gets too much more complicated.
The next step is to set up server sending messages from one client to another, and become a real server! At the moment its just a listener…
Here’s a link to the source code.
The next step in any game development methodology is investigating networked games, ones that run on multiple computers and communicate to coordinate a shared experience for players. To this end, I started looking into
java.net for communicating in Java program. This yielded good results, and after about an hour of tinkering, I can show the fruits of this surprisingly easy labor:
Eagle eyed readers will be able to figure out the chronology of events. Simply, its a brief back and forth, with me entering commands in the bottom window, and the server program on top reporting the reception of these commands. The client also shows the time taken for the round trip. I have tested this on another computer in my local network and it works!
Next step, a networked game! But first I think I should clean up the format of the messages here, as it maybe a tad confusing…