Tuesday, April 18, 2017

ProductiveGame Beta Release 1.0.5!

Get it on Google Play
ProductiveGame Beta 1.0.5 Released!
You can download it on Google Play.  Additionally, since it's an open Beta, you don't have to sign up to test it, you can just download it!



Changelog:
-The biggest feature from this new release is a task screen that you can reach by rotating your phone to portrait.  Rotate back to landscape to get back to the gamescreen.
-The second biggest feature, on the task screen, todos have an additional edit button.  In edit mode, you can rename your task, delete your task, or set your task to repeating.  Repeating tasks never get deleted unless you delete them yourself, or change them back to a todo and check them.
-Also, on the task screen is settings button.  So far it only includes an instructions button and a multiplier button, but it may get more buttons later.
-Build Points are no longer used automatically to build the level.  Instead you must tap the Build Game button to use them.
-The sound button now has a checkmark on it to show you if it is on or off, and the sound only plays -when the level has been fully built.
-The exit button has been removed, but the back button on your android device now functions the same way as the exit button did.


I fixed a lot of bugs and added some major new features, as well as some minor ones.  I took pretty extensive notes, but I didn't post them here.  I also made a lot of git commits but they are all private on bitbucket.

I'm currently active in the a community project for Double Fine's Amnesia Fortnight, but once I feel I've made satisfactory progress on what I'm working on for that, I will get some webgl and desktop builds built and place them on itch.io, of the Productive Game.

Thursday, July 21, 2016

Productive Game Alpha Test Released on Google Play

I've been working on the Productive Game Prototype, but have neglected to post here.



My app is now going through Open Alpha testing on the Google Play store!  If you would like to sign up to be a tester, you can find that here:
https://play.google.com/apps/testing/com.ProductiveGaming.PGP_Roguelike


After you have signed up to be a tester, you can get the app by going here:
Get it on Google Play

Here are the changelogs from my Android releases:


-1.0 Fixed newly instantiated tasks.  They weren't sizing properly.

- 1.0.1 Changed Canvas Scaling to Screen Size instead of Physical size in an attempt to make UI look right on Mobile.

-1.0.2 Bug Fixes:
Fixed Blurry Game Panel
Fixed Reset Game Button

Next up:
GUI elements are still too small on some devices.

-1.0.3 Bug Fixes:
Modified GUI elements so they should be the same size across all devices.  I also increased their size and spacing to, hopefully, make them easier to tap.

Let me know if I need to improve the sizing some more, on buttons, checkboxes, text, etc.

Notice:  Apparently Unity 5 no longer supports Tegra 2 devices.  This includes, but is not limited to, some Galaxy s2 devices, the first Galaxy Tab 10.2", and the atrix 4g.  In order to fix this, I would need to switch to Unity 4.6.  blegh.

- 1.0.4 Changelog:
Fixed the Pause Button
Attempts to improve clarity:
Renamed "Unused Todos" to "Build Points"
Renamed "Speed" to "Multiplier", and increased max from 4 to 9, and changed default from 1 to 3.
Scaled up Instructions so they are easier to read, and implemented scrolling for them.
Rewrote instructions somewhat.

More Details about the change log


- 1.0
 I decided to get the mobile app ready for a proper mobile release.  I switched the Canvas Scaling from Constant Pixel Size to Scale with Screen Size, and also tried Constant Physical Size, but with both of them the instantiated objects would not scale correctly.  I tried everything for weeks to try to find a solution, but to no avail.  Then I just happened to stumble on the solution here  Apparently,  I needed to set WorldPositionStays to false when instantiating my object.

so:
newTodo.transform.SetParent(todoPanel);
changed to:
newTodo.transform.SetParent(todoPanel, false);
And that seemed to fix it.  Since that was finally fixed, I decided to release my app for Android on the Google Play Store, because it has the lowest barrier to entry(lowest one time fee to be a developer, easiest to build for, simplest approval).  By doing that, I could get feedback from testers.

-1.0.1  This one's pretty self explanatory, but it still didn't exactly work right.  See release 1.0.3

-1.0.2  For some reason I had to turn mipmaps off for the Sprites in order to make them look clear, instead of blurry.  Previous builds weren't blurry so I'm not sure why it suddenly became necessary.

I created a duplicate of my scene when I started working on Android, so I wouldn't break anything.  The code that resets the game calls on the scene, so I just had the change the scene name in the code to fix the reset game button.

I manually resized many UI elements in order for them to be easier to use on Mobile.

-1.0.3  None of Unity's Canvas Scaling methods created a constant physical size across all devices, there was always some sort of variation, so I turned off the Canvas Scaler and switched to a script made by Tess Snider so that I could use Constant DP Size, or "Device-independent Pixels".  You can find that script here.  I then had to change Reference Pixels Per Unit to 60 in order for all of the UI elements to look correct around the edges.

-1.0.4  For some reason, the Pause Button was disabled.  I have no idea why.  The rest of this is pretty self explanatory in the changelog


What's Next

I'm continually improving it every day.  I haven't had any issues with stability at all, so I could push to Beta test status, but I want to add some more features.  

I plan on adding another page or more to the User Interface to accommodate better managing of todos, such as editing, deleting, and  completed todos;  to accommodate a score page;  and to accommodate settings and configuration.

I would also like to add some sort of "Story Events" to the game.








Thursday, July 7, 2016

Why I'm doing this.

What am I trying to do?


I'm trying to create a Productive Game Industry


Why am I trying to do this?


People motivated by greed and self interest have no lack of self motivation.  I believe this is one reason the world is in the state that it is today.  The good people of the world who care about others and society, see the state of the world and become disillusioned or bitter or escape into the virtual world of music, books, video, or video games because it's a much more comfortable place to live.

So, I'm trying to take the best aspects of video game technology mixed with productivity applications to create a video game that empowers and motivates the good people of the world to do more with their lives, and to be more.  When the good people of the world have the tools they need in order to rise up an make the world a better place, the world will become a better place.

Productive Game Technology has a tremendous potential that has only just barely been tapped.  There's some more information about what can be done in the about section of this website, and I have notebooks filled with other possibilities that I would like to one day compile into a cohesive narrative or design document and publish.

So far, I mostly work alone and take shortcuts where I can, but there's only so much that one person can do.  I'm trying to create a product that shows the potential of Productive Games in such a way that other people will compelled to join me, or build upon my work.  This is what I mean when I say that I'm trying to build an Industry(that currently does not exist), and not just a product.


What's next?


I'm working on getting the Productive Game Prototype ready to publish on the major app and game stores(Steam, Apple store, Android Store, Windows Store).

I don't know yet whether I will use a simple todo list structure or combine the Productive Game Prototype with my work making a Habitica Client(the Habit Engine).  This first product I will release for free to garner interest, and then I will set to work on the next Productive Game.  I already have a lot of the game aspects planned out and details will be forthcoming.





Tuesday, November 17, 2015

ProductivityGame Prototype: Roguelike Released!

PGP Roguelike Released!


This is the first release of the Productivity Game Prototype: Roguelike

In the link below I've provided builds for Windows, Linux, OSX and Android.  The Android build is barely usable on my phone because all of the UI elements need to be resized for the smaller screen size.

Download here

More info about using the Productivity Game can be found in this video:


Rename?

 I'm considering changing the name of the project from Productivity Game to Productive Game, but I'm just not sure which is better.  Please let me know what you think in the comments below or send an email to stewart@productivegaming.com

Also, I moved this blog from fragmentalstew.com to productivegaming.com.  Fragmentalstew.com still redirects here, though.  I thought productivegaming indicates better what I'm trying to create.

Also, I added a page for the Habit Engine, a page for the Productivity Game, and I added a lot more info to the About page, about what I'm trying to accomplish.  I encourage you to click the tabs at the top to read more.  I also changed the Template of the website.

Sunday, November 15, 2015

Dev Update #18 Ready for Release, Fixed Slow/Drunken Movement Bug, Found New Bug in Saving/Loading


Fixed Slow/Drunken Movement Bug


I finally fixed the Slow/Drunken movement Bug that has been plaguing me for weeks.  As near as I can tell there wasn't any bugs in my code, but there was some buggy weirdness in the project itself.  So, I created a new project.  Exported all of the assets with dependencies from my old project, copied over the tagmanager.asset from the projectsettings folder, and everything was fixed.  This created a new issue with horizontal lines on the edges of the tiles of the board, but this doesn't seem to show up in builds so it's not really an issue.  With this issue resolved, I should have been ready to release today except I did some more testing and...

Fixed Saving and Loading Bug


During testing for release I noticed that saving and loading was working correctly.  I was pretty certain it had been working right, but after examining the code, I noticed that I had missed some crucial lines of code.  Random.seed was being saved when the program began, but not when a new level was loaded.  When the new level was loaded, Random.seed had a different value, but that value wasn't being saved so restarting the level would give you a different level layout.

I added the needed code, which should have resolved the issue, but it did not.  In order to debug, I decided to use the unmodified version of the Roguelike tutorial.  I made the necessary changes and saving and loading still wasn't working correctly.

Each time a Random value is called, the Random.Seed changes.  As long as all of those calls are in exactly the same order, and you start with the same value for Random.Seed you should get the same Random values every time.  But for some reason, this wasn't happening.

In order to fix it I added this line:
Random.seed = Random.seed;
Let that sink in for a moment...
Yes, I am aware that it makes no sense.  Yes, it really does fix the issue with the Random values being different every time.

So, after making that change in the unmodified project, I made that change in my modified project, and lo and behold it did not work.  I realized that this was being caused by my use of coroutines instead of functions.  In code, the first function has to finish before the rest of the code runs.  With coroutines, the code starts the coroutine and then continues execution.  Each coroutine was making a call to Random.Range at it's beginning.  When the level is loading, those calls to Random.Range are in order, and then the other calls to Random.Range happen when a todo is clicked. Since, when the level is loaded, it skips the while loops that wait for each todo to be checked, that caused the order to be different.

So, I created some bools and added some more while wait loops between the running of the coroutines that setup the level.  After the level is loaded, the finished bool is set to true so that the next coroutine is run and this solved the execution order issue so that levels should finally load exactly the same whether they are being loaded sequentially after each todo or whether they are loading all at once.

Then I realized that I could have just used "yield return StartCoroutine" to call each coroutine, and that would make code execution wait for the coroutine to finish before continuing.

I feel kind of silly for not doing that from the beginning.  Live and learn, I guess.

Ready for Release


And with those last bug fixes, I feel confident in releasing the prototype.   I would like to do a little work on the website and might get a new domain as well.   Stay tuned. 





Monday, November 2, 2015

Dev Update #17 Broken Release

Broken Release

I had the game all finished up.  Then I built and tested the game, and for some reason that I don't understand, all character movement moves very, very slowly.  One move takes about two full seconds, which is far too slow.  I have no idea why this is happening.  Also, there is far too much CPU being used.  It jumped from less than 10% CPU usage to between 40 and 60%.  And it doesn't seem consistent.  Sometimes the build will run with less CPU or it will have lower cpu usage and then jump higher.

Here is a video showing the slow movement in the build:


Even in the editor there seems to be some issues with movement.  The characters move at full speed(as far as I can tell), but the player will weave around and not stay within the tiles.  This seems highly inconsistent, because sometimes the player will move normally with absolutely no changes made.

Here is an example of the weaving when run in the editor:



Again, I don't know why any of this happening.  There doesn't seem to be any bugs in my code that would cause this, and I don't know why movement would be so much slower in the build rather than the editor, or why cpu usage would jump.

This issue with movement and cpu usage is the only thing preventing me from making a release.

If anyone thinks they can help with this issue, or with development of the project, I can give access to the bitbucket project or a link to download an archive.

Monday, October 26, 2015

Dev Update #16 Speed, Tweaked UI, Modified Player Pause, P and M Key, Random Pausing, Build Mode

Changed Button Presses So They Don't Interfere With Typing

I set the "M" key press to only work when the game is paused.  This prevents "M" from pausing the music when typing a todo.  I had to entirely disable the "P" key press for pausing the game, because there was no elegant way to change it using the current code. There's probably some way to do it involving the AddTodo field focus, but it's relatively minor and I'm just going to leave it out for now.

Modified The Way Player is Paused During Level Loading

I was disabling the Player object during board setup, and then reenabling when board setup was finished. I have suspected that having the player game object disabled may interfere somewhat with the movement of the enemies.  It gives me no errors, but just to be sure, I decided to disable just the sprite and then set the Player script to paused.  I wasn't able to access the Player.player.paused(player is a reference to the instance) variable from BoardManager, even though I can access it fine from other scripts.  I get a "null reference error" - this gave me a lot of grief in the past.  I suspect it has something to do with the BoardManager being instantiated, whereas the other scripts that are accessing Player.player.paused are not being instantiated.  They just exist within the scene.

So, instead, I used:

        playerObj = GameObject.Find("Player");
        playerScript = playerObj.GetComponent<Player>();
        playerScript.paused = true;

 It's less elegant than "Player.player.paused = true;", but it works.  I'm not sure if it makes any difference.  The enemies do seem a little more responsive in their attacks, but it's hard to tell. They still seem to move in roughly the same pattern.

Tweaked UI elements

I tweaked a lot of the different UI elements - adding padding and slightly modifying shape.  I changed the font on many UI elements to PressStart2P-Regular, that came with the Unity Rogue 2d Tutorial.  I chose to continue using Arial on the Todos, because Arial looks better at a smaller font size, and I didn't want to make the fonts big enough to look good use the PressStart font.  I made the text darker on the todos and the other UI elements with grey backgrounds

Random Pausing Fixed

I fixed the Inputfield from (seemingly randomly) being selected while you're moving the character.  It turns out is wasn't random at all, it was the UI navigating between UI elements until it hit the input field.  I turned the input field navigation to off, which should solve that.

Speed

I added a speed modal.  It sets each todo to complete 1, 2, 3, or 4 tiles when they are checked.  I would go into more detail about how I did this, but the actual creation of the modal was a bit complex.  It's not really a modal as much as a configuration window that pops up on the right panel.  In order to activate and deactivate the  modal, I had to create a separate script that mostly just keeps track of the "speed" variable, that is never deactivated.

Build Mode

I also added an image and text that says "Build Mode" instead of "Paused" when the level is building.


What's Next

I think I'm going to add some kind of instructions.  I'm debating whether or not I want to implement any kind of deleting or editing of todos before release.



Tuesday, October 20, 2015

Dev Update #15 - Almost Done. Exit Game Button. Confirmation Dialog Boxes

Exit Game Button

10/18/2015 I added an Exit game button using Application.Quit(); and also moved the Right Panel Buttons off of a Scrollview that wasn't doing anything and redid the anchors for the buttons so they would scale correctly.

Confirmation Dialog Boxes (Modal Windows)

10/20/2015   I added some Modal windows for 6 Reset Game and Exit Game.  I started by watching the part 1 of 3 of the Unity tutorial/live session UI TOOLS: MAKING A GENERIC MODAL WINDOW, and then decided I didn't need such a complex solution for just 2 modal windows, so I hacked together some panels and buttons, copied them, and then modified my original Exit Game and Reset Game button scripts.

The ExitGame script looks like this:

using UnityEngine;
using System.Collections;
public class ExitButton : MonoBehaviour
{
    public GameObject exitModal;
    public GameObject resetModal;
     public void ExitGamePressed()
        {
            if (resetModal.activeSelf == false)
            exitModal.SetActive(true);
        }
     public void ExitGame()
     {
         Application.Quit();
   
     }
     public void ClosePanel()
     {
         exitModal.SetActive(false);
     }
}

The ResetGame script is mostly the same except with "Reset" in place of "Exit" and instead of Application.Quit, it calls the ResetGame function from BoardManager.  All the code I added to the two scripts is almost the same between both scripts, which seems wasteful and I'm sure there's a better way, but I'm more concerned with getting it functional. I may rewrite later.

The appropriate functions are then assigned to the appropriate button's onClick events and the appropriate GameObjects are assigned to the scripts.  Both exitModal and ResetModal are set to inactive in the editor.

What's Next

I'm pretty much done.  I've made a build and I'm testing it.  Currently the key press "P" will pause/unpause and "M" will pause/unpause the music which is a problem when typing in todos, so I'll fix that.  I'll readjust a few things in the UI to try to make them look a little more professional.  I don't really like the way the text looks. I might try to make that look a little nicer.  Some graphics on the UI elements would be nice, but I don't think I'm going to touch that for the prototype.

There's always more I could do, but as far as I'm concerned, I've accomplished all my goals.  So once, I've polished things up a little, and done a little testing, I'm going to make Windows, Mac OSX, linux, and maybe Android builds and release them all simultaneously on this website.  That should be very soon.
Running in a Build

Saturday, October 17, 2015

Dev Update #14 Reset Button Fixed(Again), Pausing Works, Window Scaling Fixed, Unused Todos Usable

Reset Button Fixed(Again)

In my attempt to get Pause to work today, I discovered in issue with the Reset Button I should have noticed the first time.

I was using a checkedOff variable in my TodosHandler script to pass a variable to the BoardManager script, that manages the game board.  The TodoScript attached to the TodoButton sets the checkedOff variable in the TodosHandler to true.  Update() in BoardManager waits for the checkedOff variable in TodosHandler to be true, and then it sets the "clicked" variable in BoardManager to true.  This signals a while loop to stop, which then loads the next tile in BoardManager.

Originally, I thought this wasn't working when the game was paused because Update() wasn't running when time.TimeScale was set to 0.  This, however was false, but I didn't know that at the time.  To fix this, I gave the TodoScript direct access to the "clicked" variable in the BoardManager script, and let it set "clicked" directly.  This was changing the variable to true, but it did not trigger the while loop to stop.

The reason for this, I eventually discovered, was that I had multiple instances of BoardManager.  I discovered this by using:
Debug.Log("Parent of this BoardManager is " + transform.parent.gameObject);
Debug.Log("Root parent of this BoardManager is " + transform.root.gameObject);

I'm not entirely sure why my previous fix for the ResetButton worked.  I'm guessing that the change I made allowed the ResetButton script to find only one copy of the BoardManager instance instead of two, or maybe it found the correct instance instead of the wrong one.

So I removed the copy of BoardManager from the ResetButton and changed the ResetButton code to:
        BoardManager.boardManager.ResetBoard();
In order to access the variable directly from TodoScript, I had previously added to my list of variables:
    public static BoardManager boardManager = null; 
and then also added, to the "void Awake();" function:

         boardManager = this;
 This allowed me to access the ResetBoard() function directly as well.

However,  after implementing this code, I came to discover that tiles are still not loaded when the game is paused.  Apparently Update() is still called while Time.timeScale is 0, but
while (!clicked)
                {
                    yield return new WaitForSeconds(0.01f);
                                     
                }
never completes, because time has stopped.

Pausing Works

Since setting Time.timeScale to 0 doesn't work with WaitForSeconds, I instead decided to pause the player by making a "paused" variable in the Player script.  I made that variable accessible by other scripts so that those scripts can pause the player.

The player moves through:

            horizontal = (int)Input.GetAxisRaw("Horizontal");
            vertical = (int)Input.GetAxisRaw("Vertical");
and some other scripts in Update() of the Player script, so I added "if (!paused)" before that.

I then added code to the Pause button script to set Player.player.pause to true or false and I added an "Event Trigger" component to the Todo field.  I then added a Select and Deselect even to the event trigger, added a PausePlayer and UnpausePlayer function to the Pause script, and assigned those to Select and Deselect so that the player is paused when the field is selected and unpaused when the field is deselected.  This keeps the player movement from being effected when typing in todo names and keeps todos from being typed in when the player is moving.

I also added a black image, with an alpha, with the word "Paused" overlayed on top of the game as a visual queue.


I also added a gameActive variable to the boardManager so that the pause scripts can check to see if the game is Active.  The game is by default, paused when the level is loading, so this prevents the scripts from trying to unpause the game when the level is still loading.

Currently music doesn't pause with the game, but it can be paused separately by clicking the music button.  I did this intentionally to give players more control over whether the music is, or is not playing.  The music does start by default when the level is finished loading.

Window Scaling Fixed(sort of)

I (sort of) fixed scaling.  I set the aspect ratio to 16:9 and then set the windows to stretch vertically, with their anchors set to the bound of the panel.  This makes the panels scale correctly.  However, the aspect ratio is stuck at 16:9

Unused Todos

Previously, all todos you did while the game was active would not be counted.  I changed this, so that there is now a counter in BoardManager that keeps track of those unused todos.  There is also a panel that tell you how many unused todos you have, and a button you can click that will use those unused todo points as if they were a todo you were clicking on the left panel.  I could give more technical information, but this post is already a bit long.

What's Next

I may add some kind of confirmation popup for the Reset Game button that asks whether you are sure you want to reset the game, and maybe some hover over tooltips if that's possible, but that's the only thing I can think of right now. 

I'll take a little time to think about whether there is anything else I want to add before release.  I'll also do some testing and make some builds.  Then I will release a working build for everyone to download.





Thursday, October 15, 2015

Dev Update #13 Fixed Reset Game Bug

Fixed Reset Game Bug

I set out to fix the reset game bug, today, and was successful.

After resetting the game, the tiles would continue to load even after the game had started.  I thought this might be caused by having a second instance of the BoardManager script attached to the ResetButton script.  I did that, because assigning the BoardManager script, that was already in the scenne to the ResetButton script wasn't working.  First, I tried uncommenting my previous code to see why it didn't work and it worked perfectly fine.  I don't have a clue why it didn't work the first time, I'm just glad it's working now.

The code looks like this:
boardScript = FindObjectOfType(typeof(BoardManager)) as BoardManager;

Next up: Bug Fixing Pause 

Next up, I need to get some sort of pausing of the game working.  Currently, pausing the game prevents tiles from being loaded when they're checked off.  Currently, to pause the game, I'm using:
if (Time.timeScale == 1)
             {
                 Time.timeScale = 0;
                 AudioListener.pause = true;
             }
             else
             {
                 Time.timeScale = 1;
                 AudioListener.pause = false;
             }
this prevents all of the Update() events from triggering in the game.  The code that triggers the next tile to be loaded looks like this:

    void Update()
    {
        if (TodosHandler.todosHandler.checkedOff)
            clicked = true;
    }

And this is why tiles are not loaded when the game is paused.  I now have to either rewrite my code so that I am not using Update() to wait for a checkedOff event, or I have to rewrite the pause so that the player is turned off.  I know how to do that latter.  I have a vague idea about how to do the former.  I'm not sure which is best.  I was going to work on that today, but then I had personal matters to attend to.

On the Backburner: Window Scaling (yet again)

As it turns out, though I thought I had fixed the window scaling, in the last post, it turns out I had only fixed the gaps when scaling the game window horizontally.  When scaling vertically they reappeared.  I'm not entirely sure how to fix this.  I think I may need to make an actual build of the game, which I haven't done yet, and then see how scaling the window works in the actual build.  I would like to make the game fully scalable in all directions, with a limit on how small the window can get, however I may have the make the game a fixed aspect ratio.   Hopefully I won't have the make the game a fixed resolution/resolutions.

Tuesday, October 13, 2015

Dev Update # 12: Pausing Audio, UI Elements Correctly Scaling


I've decided to add  more pictures and more technical information into my dev updates.  I've also decided to do a write up on my progress/lack thereof immediately after I've made the progress/lack thereof.  Instead of making a lot of dev updates, I will add to them until I feel like I have enough material before posting.

10/12/2015 I found a way to pause and play the music in the game, using "AudioListener.pause" instead of turning on and off the SoundManager object. One benefit to this, is that the music will begin playing where it left off instead of restarting every time. Also, Unity can't find an object when it's not active, and this is why the sound breaks using my current "reset game" code. One downside the AudioListener pauses all of the audio including the music and sound effects. Apparently can "set the ignoreListenerPause property" to true for sound effects, to prevent this, but I'm not entirely sure how to do this yet. A snippet of my code is below. This is the body of a function I have that runs when the music button is pressed, or the "M" button is pressed.
if (AudioListener.pause == false)
        { AudioListener.pause = true; }
        else
        { AudioListener.pause = false; }

10/13/2015  I readjusted some of the UI elements that weren't scaling with everything else, so they would scale correctly.  I changed the anchors to top horizontal stretch(not sure if the top part is important, but I know that adding vertical stretch will generally break everything. see Image 1).  Anchors and pivots with the new UI system are a bit confusing.  I think maybe I'm starting to understand them a little.

I was having trouble getting the left and right panels to scale with the game board in the middle.  I created a panel that mimics the game board, to make it easier.  The game board is always square, 1x1, so as the window scales the game board gets bigger or smaller in the middle.  Initially, the left and right panels stayed the same width, because there was no width scaling which would create large black areas on the left and right of the game board(see image 2), or the panels would overlap the game board.  Every time I changed the anchors, the panels would scale, but they would scale incorrectly.

To fix this, after a LOT of trial and error, I set the inside anchors to the middle of the screen.  Don't ask me why this works or how I thought of trying it.  I have a very vague idea, but I couldn't explain it.
Success!!! UI Elements scale correctly.

Image 1: vertical scaling breaking UI elements, before I fixed it

Image 2: Gaps between Game Board and Panels

Sunday, October 11, 2015

Tech info: ArrayPrefs2



09/28  I added saving and loading of the todoList array today.
I'm using PlayerPrefs to save and load single variables and ArrayPrefs2 to save and load arrays.  Since I'm using Lists, I have to convert the lists to and from arrays when using ArrayPrefs2, but I plan on creating a more robust system later.  Possibly using XML.  Ideally, I would save individual entries in the todoList, instead of the entire array, but saving the whole array every time a todoList item is removed or added may not be too resource intensive.  I'm really not sure.  Right now I'm mainly focused on getting everything running and released.  I'll focus on optimization later.


Dev Update #11 - Continuing work on Productivity Game - Rogue-Like Prototype

Game in mid-level load

Game on Day 2
What works:
-Adding and completing tasks.
-Completing a task adds a tile to the level.
-The level can then be played once all tiles are complete.
-Todo buttons fit the size of their text.
-The level, the number of tiles added to the level, and the remaining todos are all saved when the game is closed and reopened.
-  The actual game portion works

What doesn't work:
I added those buttons along the right side to test some features.  Currently they're all a little broken.  I'm pretty sure I know how to fix the music button to turn music on and off.  The pause button technically works, but tiles are not added to the level when a todo is completed, when paused, which defeats the purpose of the pause.  The reset game button resets the game, but you also have to immediately turn the game off and back on again or it will break all kinds of things.

So, I'm basically just bug fixing right now.

I thought I made at least one post, if not multiple posts since the last one, but they don't appear to exist :/

Wednesday, September 9, 2015

Dev Update #10

2d Roguelike Prototype:
I've completed saving and loading using random.seed, a couple of simple integer variables, and player prefs.  This was actually much easier than I anticipated.

Now I'm back to where I left off with the Habit Engine...The GUI.

I'm not looking forward to this, but I know it's necessary and highly important.  I'm hoping to build the "One GUI to rule them all!" or, in other words, a flexible, customizable GUI I can continue to reuse on all projects.

I may do a more indepth write up of my work so far, eventually, but I wasn't planning on posting until I had the prototype finished.  I basically looked at the GUI once and got a migraine and decided to come back to it.  I plan on starting work on it this week.  Since I have no idea how long the GUI will take me, I decided to post now.   At least the game part is basically finished.

Maybe I'll post a video so I can show its current state.

Tuesday, September 1, 2015

Next Dev Update very soon

I'm planning on posting a new update on the first of every month.  I may make interim posts as well, but new updates should always be posted on the first of the month.

Today's update, however, is late, because it's not finished and I need to leave for work(crappy call center job) at this moment.

I've made some very exciting progress on the 2d rogue prototype and may be able to get it working and published within one to four weeks.  Sequential level loading is working, and I've moved on to saving and loading.

Check back here within the next few days for a more thorough write up.

Thursday, July 30, 2015

Dev Update #9 Productivity Game - Rogue-Like Prototyping

I did a tutorial for Unity for a 2d Roguelike
I decided to modify this Game so that every time you do a task, another tile/part of the level loads and then once all tiles/parts are loaded, you can play the level.

I've made some progress in this.

I used:

while (!clicked)
{
yield return new WaitForSeconds(0.01f);
}
clicked = false;

To make each piece of the level wait for a click until loading the next piece.


(I'm finding it difficult to properly format the code on blogger.)

Then I tried to make the Sound and Player Object wait to load until after the level was loaded, but I've had some difficulty.

First, I thought I would just turn them off in the inspector and then turn them on with a script.  It turns out, accessing a deactivated object is difficult in Unity, because most of the easy ways to access an object require the object to be active.

Second, I thought I would try to create a script that had a reference to the Object, and then I could access the reference from the script.  I spent a long time trying, but could never get it to work.  It might not be possible.

Then I decided to leave the Player Object active and simply toggle the Player Script and and Player SpriteRenderer.  This worked on the first level, but after the next level loaded, there was some code that was trying to use the Play Script, but couldn't because it was deactivated.

I'm not yet sure how I will solve this.

Dev Update #8 UnityUI Tests

I've been streaming some of my work on http://www.twitch.tv/fragmentalstew. Unfortunately the stream is too low quality to see what's going on. Mostly it's me trying things and then them not working. I do make a little progress, though. Also I don't have a webcam or mic hooked up currently so my only means of communication is through wordpad.

 I made a simple mockup of the UI with a prefab of a toggle. I tried to dynamically instantiate a list of those prefabs but I had trouble making the new instantiated toggles children of the canvas. I found a video about it on https://www.youtube.com/watch?v=TRLsmuYMs8Q and downloaded the video using firefox's video downloadhelper addon so I could control playback speed. I used the code that was linked to this video, with a slight modification to use SetParent instead of Parent, to display a list of toggles that are children of the canvas. They scroll correctly and everything. Now I just have to apply this to my own project and I should be able to create a mockup for the new UI. I'm still not entirely sure what everything in the code does, but I'll figure it out.


 Update: I made a draft of this post a while ago but never posted it. After this post, I created 4 separate lists of toggles and connected them to the same scrollbar. They don't scroll evenly. Each list is centered instead of starting at the top and the longer the list, the faster it scrolls, but I moved on to something else which I'll describe in my next post.  I also added rudimentary health/xp/mana bars.

 

Thursday, June 25, 2015

Dev Update #7 And we're back!

Lost the domain for a little while, because the registrar wanted to renew it for a much heftier price that I was willing to pay.  I wanted to switch do a different registrar but never got around to it.

Luckily, this domain was available for registration with google domains for a reasonable price, with free identity protection and email forwarding.

I put off work on the HabitEngine for a while, but I've started back.

I transferred the project to Unity 5.  In the process, I didn't transfer all the folders, so what I thought was a bug was really only a problem I created.  However, in the process of trying to fix the bug I created, I found the solution for the scroll bar not being clickable, so I fixed that.  I also cleaned up my HabitRPG avatar code so it's not clogging up the console with warnings.

I'm working on recreating the GUI using Unity's new UI tools.  There should be many advantages to this.  Hopefully I will be able to create a more dynamic, customizable, efficient UI that runs well on all devices.

Learning the new unity UI is a chore, and I'm working 40 hours a week, so it will probably take me a while.

Here's a picture of The Habit Engine, with old GUI, running in Unity 5, with working scroll bar, and minus the console clogging avatar code.









So, I thought I might get a habitengine domain if it was available, but apparently a Finnish guy named Janne Haonperä, Chief Marketing Officer for http://www.cloudriven.fi/, has bought up all the domains.  I might try to contact him about it.  Janne, if you're reading this, can haz?

Fell free to suggest name changes, in case it has to come to that one day.

Tuesday, October 7, 2014

Dev Update #6 New Builds! (And Flying Voxel Pigs)

Go to the link below and download the executable for your desktop operating system.  There are builds for Linux, Windows, and Mac OSX
https://drive.google.com/folderview?id=0B6yn-RDuOpqhSTdoNkhCdFZXRTA&usp=sharing

This is the first build with the bug fix that makes it work with habitrpg.com(again).  I also added Jennifer Phillips' Voxelated pigs, from the concept art competition, to the login screen.



Notes:

-Functionality-
-You can login with either username or api.  Click the buttons on the login screen to switch between them.
-You can add habits,dailies, todos, and rewards.
-You can view and check tasks and checklist items.
-Checklist items appear as other tasks except with numbers in front of them (1,1) for example.
-There is no edit functionality, or reorder.
-Todos that have been done still display.

-Sprites-
-I haven't added pets.
-Only your costume currently displays.  If you're not using a costume your character won't display.
-Adding sprites is a very manual process.  If the sprite/gear you're using was added after the date that I added the sprites, it cannot display.

Sunday, September 21, 2014

Wednesday, September 3, 2014

Dev Update #4 First of the Month

I planned to update on the first of every month and I'm late this month. My apologies.

UnityHTTP is working, and I'm working towards an open source release.  If all goes as planned, I should be able to release on github within the week.  Possibly Sunday. Sunday is usually my dev day.

Wednesday, August 20, 2014

Dev Update #3 - It works again!!!

Good news!  The release that contained my bug fix came out on the 12th.  I could have updated then, but I waited until now to post about it.  With this bug fix, the Habit Engine finally works with habitrpg.com again.

I've been trying to update at roughly the same time every month, but I kind of dropped the ball this time.  I'll probably start updating at the beginning of the month, just to make it easier to check.

Since the last update, I have been trying to get unityhttp to work.  Uniweb works great, and it's a steal at $25, but if I'm going to open source Habit Engine, I can't expect everyone to buy it.  In fact, if I decide to use a gpl license, which I am leaning towards, I think that sort of breaks the license.  For that reason I have posted a simple test project at https://github.com/fragmental/HE_Rest_Test in order to test unityhttp.

If you are a programmer, interested in helping, you can clone this repo, and then clone unityhttp into the assets folder, and help me find out what the problem is.

In other good news, Unity 2.6 open beta is out!  This contains the new GUI elements, which means that my workload went from a few things to a hundred.  I'm not ready :/

Stay tuned for more info, and if you're interested in helping in this endeavor, please don't be shy about messaging me.


Tuesday, July 15, 2014

Dev Update #2: And we're still waiting; Waiting on the code to change

https://github.com/Unity-Technologies/mono/pull/141

Update X509Certificate.cs is my commit to Unity's Mono, that fixes the SSL bug I mentioned in the last post.  It was finally merged 4 days ago, and it's only a matter of time before the release that features the bug fix.

I'm not sure when it will come.  I get excited, and then subsequently disappointed after every minor release.  If I was feeling adventurous, I could probably compile the code myself, but I'm just not sure it's worth the effort.  I mean, I could spend hours getting the code to compile just to find that it won't work, and I still have to wait.  I just don't have that kind of time to waste.

Once the bug fix finally drops, there will probably still be a relatively long wait for Unity 4.6, which contains the new Unity GUI.  In that time, I plan on using the Habit Engine myself with my habitRPG.com account, and then progressively adding the features that I find most useful.  I will probably stick with the current gui code, even though performance may suffer as I add more gui elements;  then I will rewrite the gui after 4.6.

Code Updates:
I recently added HabitRPG sprites.  It still need some polishing up, but it's otherwise fully implemented.  Ignore the lack of data;  I turned that off while working on the GUI.




Friday, June 13, 2014

Development update #1

I decided to rename the project from "Habit Media Engine" to just "Habit Engine".

Development has had its ups and downs.  



First, the good news:

1.On the near horizon, the next release of Unity includes a new GUI system, which I should be able to leverage to really improve the UI.
2. Entry on Enter is working.
3. Task colors partially work.
4. Checklists work, though adding and editing them has not be implemented, and their ui could use some work(see #1).
5.  I tested builds for Android and Iphone using "Good ol' Sockets" and they both worked, though the UI would need to be changed for mobile(see #1) and the performance needs to be improved.
6.  I added a 3d character with animations that trigger during certain events.  When a positive habit is clicked, or a daily or todo is checked, the character smiles.  When a negative habit is clicked, or a daily or todo is unchecked, the character frowns.  When you reach a new level, the character jumps.(For more information, see the end of this post)



Next, the bad news:

Currently, there is a bug in Unity's mono ssl runtime that prevents  Habit Engine from communicating with the HabitRPG server.  HabitRPG's certification used a different algorithm until they updated it.  The bug does not exist in Unity 5, but Unity 5 probably won't be released until sometime in 2015.  I'm currently not sure what to do to resolve this in the meantime.  I've created a bug report, and even a pull request, and I'm not sure if there is much else I can do.  This bug is the only thing that prevents me from making a second release.  It also breaks the first release.


More on Character Animations


I spent a lot of time working on importing 3d animations into Unity.  I used a character I had previously made called "Piggly", because I thought that would make the process much simpler and quicker.  Piggly is not a biped.  He's more like a blob with eyes, ears, nose, and mouth.  Supposedly, bipeds are much easier to work with in Unity.

 I created him at a Skills USA National competition, for a short film.
Bad Piggies Director's Cut from Stewart Martin on Vimeo.


I imported Piggly, with a morpher(3dsMax equivalent of blend shapes) and a stretch deformer from 3dsMax.  I then found out that Unity doesn't support deformers.  Additionally something about the morpher was causing the skin to be affected by light differently.

So, I abandoned 3dsMax, imported my meshes into a single Maya scene, made new textures, and tried again.  All of the blendshapes and the main character shape in Maya were simple low poly with a quick smooth applied.  Turbosmooth  with a morpher, from 3dsMax, imports properly into Unity(except for the problem above) but quick smooth from Maya does not.  In Maya, you can use a smooth mesh on the main shape, and it will properly apply the vertex changes to all of the blend shapes, but in Unity, this causes terrible distortions in the skin.

Because of this,  in Maya, I had to apply a smooth mesh, and then remake the blend shapes from scratch using the higher poly meshes.  I did this quickly, and the results were not as good as the previous blend shapes.

After doing a little research, I read that the best way to do squash and stretch on a character in Maya, for use in Unity, was to create a squash and stretch rig like the one outlined in the tutorial here.  So, I spent hours following the first 6 tutorials, and then followed them a second time, applying those steps to my own character.  After creating a jump animation and importing it into Unity, there was a(nother) terrible distortion in the skin, because Unity doesn't support scale compensation.


At this point, I had spent many hours, and the majority of that time was spent trying to import a simple squash and stretch into Unity.  It was then that I realized that, all along, I could have just animated the scaling by hand, and baked the animation.  The scaling is not mathematically accurate for squash and stretch, but it does the job.

After that, I worked on triggering the animations in Unity.  Eventually I was successful using the "legacy" rig type.  I posted an explanation of the process to Unity Answers here.  However, when I first finished the animation didn't work.  It wasn't until I realized I needed to assign my script, that was calling the animations, to the object that owned the animations that it finally worked.

I live streamed some of this process on twitch.  I made a highlight video of the moment I figured it out.  The epiphany happens at 1:15.  I still had to fix a few bugs, but I got it all working.  The pig finally jumps at 4:19.

I would like to create new animations involving bipeds, but I haven't found or created a biped that I want to use.  I'm working on that.

Bonus picture:  I imported the maya piggly rig into 3dsMax, and it looks funny.
Dat Chin Tho



Friday, March 7, 2014

Habit Desktop Pre Alpha 001

This is the initial release of the Desktop version of Habit Media Engine, a HabitRPG client.

Habit Media Engine is created using the Unity game engine.  By using Unity, Habit Media Engine  can be built for OSX, Windows, Linux, Android, IOS, Windows Phone, Blackberry and Web with only very minor modifications in the code base.  Mobile and web clients be released at a later date.




Downloads


PreAlpha 001 Linux Download(Broken)

PreAlpha 001 OSX Download(Broken)

PreAlpha 001 Windows Download(Broken)

What Does and Does Not Work

Habit Media Engine is currently missing a lot of functionality.  I have very little formal training in computer programming and none in C#.  

What does work:

UID and Username login.
Health and XP display.
Adding tasks
Checking and "plussing"/"minusing" tasks
Custom Rewards

What doesn't work:

Data entry when "enter" is pressed.  The button will have to be clicked.
Scrolling only works with the mouse wheel, and the scroll bar texture doesn't look the way it's supposed to.
Lots of functionality still needs to be added.  See roadmap below.

Bug Reporting

You can report bugs at the github here:
https://github.com/fragmental/HabitRPGDesktop/issues

Roadmap


Disclaimer:  There is no timeline for these features.

Short term

Input on Enter key
Proper looking and functioning scroll bar
Properly functioning task colors
Task Reorder
Offline functionality
HabitRPG sprites
Gear and potion buying
Revive


Medium Term

A fully functional HabitRPG client for all desktop and mobile target platforms.

Long Term

A modular system for new 3d, 2d, text, and video content to be created and added by content developers.

Third Party Software



Why I'm Creating This

All of my life, I have had goals and ambitions that I could never find the motivation or discipline to accomplish, and I know I'm not the only one.  I believe that HabitRPG has great potential as a tool for behavior modification, to help people like me accomplish their ambitions, and I am creating this client as an improvement to that system.

I believe that the meaning of human life is to contribute to the longevity of mankind, with the ultimate goal being the eternal physical existence of our descendants.  If that seems strange, consider this:  Any good parent can tell you that their goal is a better life for their children.  Multiply that by an untold generations of parents and untold generations of children.  Choices made today can affect lives that will come many generations from now.  Let's call it "Human Continuity".

What does Habit Media Engine have to do with Human Continuity?  Eternal Human Continuity is the ultimate goal, and Habit Media Engine(and HabitRPG) is a tool to help accomplish goals.

Who I am

My name is Stewart J. Martin, and I am the sole creator of Habit Media Engine(I did receive some help from my brother, Nathan Martin).  I created my first video game in Qbasic at the age of 16 or 17, a very easy, very basic maze game.  I then took a visual basic class for an electronic technology course.  After that I quit electronic technology and programming and started doing CADD and 3d Modeling and Animation.  I recently graduated from UAFS with a Bachelor's Degree in Animation Technology.  I'm currently looking for work.  Send serious inquiries to stewartjmartin (at) gmail (dot) com.  You can see a youtube playlist of some of my earlier work here.

Edits to this post:
3/13/2014.  Added Third party info.
9/23/2014   These binaries won't work anymore. I'll post some new ones soon.