September 3, 2016

Counter Strike and Pebble

Hey all, it’s been a while! I’ve been busy. Combining my enthusiasm to CS and the usefulness of a pebble watch to create you CSontheGO

Being able to keep up to date with CS matches from your watch. I decided to do this because I: 1. wanted to Learn a php framework 2. Enjoy developing things in my spare time

This project had to be split into 2 parts, the backend/data store, and the pebble watch. Surprisingly I had a pretty much a beta version of the app running in about 45hours of dev time. This is probably mostly due to the paths I took with each part of the project

the backend

So I wanted to learn a php framework (because I like php) and laravel and lumen came to me highly recommended. All I have to say is amazing

So I needed a backend/data store for this project because there were no publicly consumable APIs from any sites that report on Counter Strike, so I had to make my own. For something the pebble app can use to give you information at your wrist

Currently I am getting the data I need by scraping a well known e Sports website. The plan is to add other sites, for redundancy, incase I get blocked, or that particular site doesn’t provide updates for unknown reasons

I ended up using lumen, as I didn’t need the full laravel install to make my idea come to life, this data store would only provide an API for the pebble app to connect to anyway, and the scraping is all done via headless cli scripts. Perfect

IDE choice

So because this was the first “big” personal project I was making, I decided to try out an IDE that supports PHP I have created various things in php previously, but they have never been big, so I just stuck to using vim which has suited my needs fine

The choices only really come down to

PHP storm If I had the cash to splash, I would have bought this. I used the 30 day trial, and its pretty amazing. Has all the bells and whistles you’d expect from an IDE and it does really well at on the fly suggestions and hints while developing, even with lumen. I was quite impressed with it. I’ve used the base product before though, while developing on an Android app. Android studio uses the indelij platform underneath it, which is the same as php storm

Eclipse I switched over to eclipse after my trial of above had finished. Eclipse was fine, but it was lacking in the suggestions and hints during development. It didn’t seem as robust and complete as php storm. I found myself having to just look up the docs more often then not when I was using eclipse. To see what parameters where etc.

And that is why I ended up just using atom. It has a decent enough support for PHP to give me syntax errors, and if I’m using the docs anyway, I may as well use something a little more light weight. I’ve used atom previously, mainly as just a text editor of choice (after vim) but it’s come a long way since I last used it so it was quite pleasant. And does exactly what i need it to do. I know I’m missing the big IDE features like integrated testing, integrated environments and things like that, but that’s okay with me

pebble app

There were 2 paths I could have taken with this. Write in c, with the pebble c framework, or use pebblejs, a framework that allows you to write the app in JavaScript. I chose pebblejs. There were a few downfalls with pebblejs, namely, it “runs” on the phone and sends all the data to the watch, causing more BT round trips, using more battery. The good thing about it was it was very quick to get an app up and running. No worrying about appmessage and dealing with all that in c. Although I will eventually rewrite in c to support all watches and the new APIs, which pebblejs doesn’t support (and probably won’t)

Writing this was pretty neat, JavaScript is super powerful and includes all the things I needed (pulling data from the API and showing it in a menu) and I could utilise things like timeline pins via the rest API too.

All in all, I’ve had fun! I’ve learnt alot, both in PHP frameworks and development in general. I have a long list of fixes/feature I want to add but don’t exactly have the usage of the app to really continue :( I will certainly leave the backend up for those (and myself) that are currently using it. I guess there isn’t much of a user base that like CSGO and have a Pebble!