Friday, August 31, 2018

ProductiveGame 2 - Trees Version 0.012 Released - First Person Forest, Continuous Mode, and Bug Fixes

Big update to my Tree Timer.  I can't decide whether to continue posting Development Logs here or just post them on, or copy and paste logs to both or just link to the log on the other.  I don't know if any reads my development logs, anyway, or I might make them more informative, and more often.

Anyway, until I decide what I'm doing, here is a link to the changelog.

Edit: The latest version 0.012 includes a 3d scene of your forest to give some weight and physicality to the time you've spent working. You can walk with WASD and use mouse to look. Hold shift to run and press space to jump. Right mouse button, and Enter button will toggle mouse/cursor focus(Escape button also works on all but the Web Browser version). There are also very quiet grassy footfall sounds.  You can pick up where you left off when you return from the forest scene.


Monday, July 16, 2018

Productive Game 2 - Trees Public release

On June 24th, I made my first public release of Productive Game 2 Trees.  It's a timer / time boxing / Pomodoro app that creates a virtual tree for each completed timer, with optional syncing with

I have been neglecting to update this website, and instead have been posting my updates to my twitter at .  I probably need to be more diligent in keeping this website up to date,  and should probably improve the layout. I also think cross posting my dev logs to would be a good idea.

Here's the changelog since the last post

Added scrolling to History.
Added a session reminder when program starts.
Added offline functionality:
When connection is lost to the Habitica server, for any reason, upscores are saved and then sent when connection is reestablished.
Added a light that is green when connection is working, and turns red when connection is lost.  The light is also a button, and clicking the button rechecks the habitica connection.
An error message displays when connection is lost, and a different message displays when the connection is reestablished

Added tree count to Adjustment config
store uid, token, and bactchcount in player prefs
added a user login UI to the config UI with API and username/email login
with settings to remember or forget login info

I removed a message box in the forest screen that had a reference to a joke that contained a curse.  It was brought to my attention that is inappropriate for some audiences, so I removed it.  I may add the message box back later, with the option of creating your own message.  For now I've just removed it.

And here is a sneak preview of what I'm working on next

Friday, May 4, 2018

ProductiveGame 2 Trees Update #1

Making a tooltip implementation has been on my todo list for years, for multiple project.  I finally buckled down and made one for ProducteGame 2 - Trees.

It's not perfect, but it works pretty well.   It took much longer to get working right than I had anticipated.  There were many hurdles I didn't expect.  There is one panel prefab, with a text object, and a content size fitter, and a horizontal layout group.  It also has a script that makes the prefab instance a public static.  Another script attached to the other ui objects, sets the initial position of the tooltip based upon the center of it's parent.  Then it waits for half a second.  If the cursor is still within the parent object,  it enables the tooltip.  If the tooltip edges are within the game window, it stays in the same position.  If the tooltip edges are outside the game window it repositions the tooltip and saves the new position to be reused.  Whenever the cursor leaves the parent UI object, the tooltip disables.

Multiline text is kind of hacky, but it works.  The text is assigned in the inspector, and in the Windows Unity Editor, "\n" for new line doesn't work when it is typed in the editor for some reason.  So instead I use "\\n" with some code that replaces the text in the string, at runtime.  Like this:
tooltipText = tooltipText.Replace("\\n", "\n");

Because the code finds the tooltip position based upon its size, and its size is being driven by the  unity ui(content size fitter and horizontal layout group), the code has to wait until the end of the frame to find the position.  This causes the tooltip to sort of pop in to place, which is noticeable.  However, the code stores the position, so this only happens when the game first starts, or when the window is resized.  There might be a way I could calculate if the tooltip will fall outside the window beforehand, but I don't know how to do that, and the pop-in isn't very noticeable since it only happens once after a resize, or at start.

Added Hover over text.
Messed around with font sizes for the header, to try to make things a little more compact and a little more uniform

Monday, April 16, 2018

ProductiveGame 2 Trees

I've started working on a new project. I've been using the Forest APP to help me stay focused, and to help me start working when I'm not really feeling it. Mostly it's just a timer, that I use like a pomodoro timer. However, when I'm working on the pc, I'd rather just not mess with my phone at all. Luckily there is a chrome extension. However the chrome extension has no audible alert when it finishes. I also wanted to show people on my steam friends list that I was working in the Unity game engine. However, after adding Unity as non-steam game and starting Unity through steam, steam seemed to think Unity was still open even after it was shut down. It was all a hassle. So I decided to create my own rudimentary version of the forest app with Unity. Thus "ProductiveGame 2 - Trees" was born.

Screenshot of Version 0.001:

(A gif of the latest build is at the bottom of this post)

I use it like a Pomodoro tracker.  So for each 25 minute increment, the Trees Planted number increases.  I have also added a tree count for the current session, and I create a new session at the start of each work day.  There is a history of those sessions as well so I can compare how many "trees" I created for each session, and when I created them.  An audio alert sounds when the timer has finished, and a volume slider lets me set the volume of the alert.  The sound I'm using is the "PointScore" sound from Pongball, created by Kyle Wynn.  I added the productive game to my steam, and launch it from steam so all my steam friends can see it.

 I've been developing it organically, with the target audience as myself, and adding features that I felt would be most useful to me.

I plan on releasing it to the public (soon?), but some work needs to be done to get it ready.  Specifically, the current version has very basic syncing with that is hard-coded for my API UID and Token and I need to create a login screen to handles that elegantly.

The current changelog is listed below:
Version 0.001
Initial version.
Basic clone of Forest App.
Working Timer,  image of tree does nothing,  type in number of minutes and click start to start timer.  Previous time is saved, so typing in time is unnecessary if time is correct.  Sound when timer finishes.  Volume control via Control Panel/Button represented by gear image.  Previous volume is saved.
I had to switch from Unity 2017.4.0f1 LTS to 2018.0b12 because, in Windows 10, there was a bug with the resize icon

Version 0.002
Added break timer and pause.  Break timer starts automatic 5 minute timer.  Tree count does not increase.  Press start a second time to pause.

Added "Current Session" count, Next Session button that resets Current Session, and adds Current Session Count to history of Previous Sessions.
Added History Panel and button to show list of Previous Session counts.  Still need scroll bar for when list gets longer than the panel can show.

Added date array to keep track of the date each Session was created, and added that information to History Panel
Added FPS limiter for 30 fps.  Should reduce CPU usage

Added simple integration.
Added script that handles scoring a Habitica habit when a tree is completed.
If the habit does not exist, the habit is created.
Attempted to use built-in json and webrequest from unity.  Had some difficulties.
JsonUtility does not handle nested objects, which prevented the processing of some JSON data.  Particularly getting the api user id and token by using the login username and password.
The API uid and token are currently hard coded.
REST POST is working, but it required a workaround use a custom UploadHandler, as UnityWebRequest applies URL encoding to POST message payloads, which mangles the JSON.

Added plus and minus buttons to adjust the number of trees.  Added so I could adjust the tree count when I forget to click "next" at the beginning of a new sessions.
adjustment buttons do not UpScore Habitica
Adjusted the inputfield so that it clears at the end of an edit.

Added a rudimentary tree scene
clicking the tree on the timer screen will change to it, but the tree can only be clicked when the timer is not active.
If you have paused the timer, your current time will be lost.