Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Tic-Tac-Tut" Unity Genre Tutorial support thread.

Discussion in 'Assets and Asset Store' started by stimarco, Jun 11, 2012.

  1. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    UPDATED: Tic-Tac-Two is now live in the Asset Store and replaces the older Tic-Tac-Tut.



    Hi folks,

    This thread is the support channel for my "Tic-Tac-Two" (v2.1!) turn-based game tutorial. (And its predecessor.)

    This is the replacement for my older "Tic-Tac-Tut" tutorial, which is included in the new version as a ZIP file.

    $0.00 - free! - gets you a complete turn-based Tic-Tac-Toe game, now with over 140 pages of documentation, in both PDF and ePub formats.

    If you have any support queries, tutorial requests, etc. please post them here. I've set the thread to notify me automatically by email of any new posts.

    I do have a day-job, but I'll try to reply to questions and queries within 24 hours. (My job often takes me away from a decent data connection, so I'm not always online.)

    The new version of the tutorial includes a customised preview version of an ebook on computers and programming.

    NOTES:
    The reviews currently visible on the Asset Store are for the previous version.
    If you have time, please leave a review!

    All feedback is welcome. If you find a typo in the docs, or a bug in the code, please either post here, or PM me with the filename and page number, (or filename and line number for code issues) and I'll fix it in the next revision.
     
    Last edited: Mar 11, 2016
  2. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Bought it to ̶t̶r̶o̶l̶l̶ check out the documentation :p
     
  3. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    This is a v1.0 release, so I'm expecting some typos and the odd obsolete comment to have slipped through, so do let me know if you've spotted any.


    I'm also very new to the whole promotion and marketing thing, so... any danger of a review? :)
     
  4. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Be great if you had this sort of package for a checkers game. Would be handy...
     
  5. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    The Tic-Tac-Tut tutorial is primarily intended to show how to write a turn-based game, so that aspect is already covered. On the other hand, Chess is the usual choice for demonstrating how to write an AI, so checkers would at least have the benefit of being a more original choice.

    For a checkers game, I'd need to write a more substantial AI, so that would most likely be the focus of such a project. (I can reuse and modify the Tic-Tac-Tut GameBoard code, which will save a bit of time.)

    If anyone else is interested, it's certainly doable, but I'd need more than one request! :)

    I'm also considering a different tutorial that looks at how to compile and run C# scripts at runtime, while the game is already in play, so gamers can write their own scripts too. I think it's possible in C#, but it's very much at the R&D stage.
     
  6. AstaSyneri

    AstaSyneri

    Joined:
    May 12, 2012
    Posts:
    25
    Excellent Tutorial! Just bought it and I am extremely please with how you documented the code (I saw the first "free" version previously, but the extra $5.00 are well spent). What I liked is how you explained how you try to match the MVC model - among other things.

    Now working on a glowing review, then i'll be back with more requests ;-).
     
  7. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    A Checkers tutorial is definitely a possibility.

    I would, however, prefer to include the (free) nGUI package too, as it'd save me having to use the Unity GUI. I've seen other tutorials that include the free version, so I'll need to contact nGUI's author to check the procedure for doing so.
     
  8. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi AstaSyneri,

    Thanks! I could do with a review or two!
     
  9. AstaSyneri

    AstaSyneri

    Joined:
    May 12, 2012
    Posts:
    25
    It's already up instead of checkers I'd rather have "Mensch ärgere Dich nicht" with an irregular gameboard (or a ladder game), to show us identifying game pieces out of several choices and how to move them around on a not so easy gameboard.

    Also one very annoying topic is saving games. PlayerPrefs are extremely limited in that, and if you have ressources you don't want easily duplicated (think of Diablo-like items), XML doesn't cut it either. What is one to do when you create a random, non-limited number of items (or rather highly limited). Example: XCOM (the old one) - you'd have items on each soldier as well as a common "warehouse".
     
  10. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    A cross-and-circle game? That's doable. (I'm not a fan of Checkers, so any excuse to make something else...)

    I'm not sure what the patent / trademark / copyright issues are for Ludo and Mensch ärgere Dich nicht are, but the rules aren't that far removed from Pachisi, so I can just make my own. I like Celtic art, so using a Celtic Cross as the basis for the board's layout should work.

    And this gives me an excellent testbed for learning NGUI too. (Apparently, it's fine to include the Free version for educational uses—the Asset Store is explicitly mentioned.)

    A good question. I wonder if I could create a more complex variation of Pachisi and include an 'inventory' of some sort. There's no need to just simulate a traditional board game...

    I'll have a think and try sketching something out over the weekend.
     
  11. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    A thought just occurred to me: I could create a published game based on the (above) concept, then release it on the Asset Store as a tutorial with placeholder art instead of the published art. And, of course, plenty of docs.

    I need to design the game first though.
     
  12. AstaSyneri

    AstaSyneri

    Joined:
    May 12, 2012
    Posts:
    25
    Hi!

    Working through the tutorial I have a few questions.

    1. In GameController.cs why is gameStates outside the Class?

    Code (csharp):
    1. public enum gameStates { Idling, PlayerX, PlayerO, VictoryAnimation};
    2.  
    3. public class GameController : MonoBehaviour {
    2. When I try to take the framework of MVC out of the tutorial to build my own code, I do get an error message "NullReferenceException: Object reference not set to an instance of an object
    MissionView.OnGUI () (at Assets/_Scenes/MissionView.cs:82)
    "

    There really is not much to MissionView.cs :

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class MissionView : MonoBehaviour {
    5.    
    6.     public MissionController controller;
    7.     public MissionMap map;
    8.     public bool playerTurn;
    9.  
    10.     void Start () {
    11.    
    12.         playerTurn = true;
    13.            
    14.     }
    15.    
    16.     void Update () {
    17.        
    18.     }
    19.    
    20.     void OnGUI()
    21.     {
    22.         if ( playerTurn ) {
    23.        
    24.             GUI.BeginGroup (new Rect (0, Screen.height / 2, 200, 200));
    25.             GUI.Box (new Rect (0,0,180,145),"");
    26.             if (GUI.Button (new Rect (50, 5, 80, 50), "Forward"))  
    27.                 Debug.Log ("Clicked Forward");
    28.             if (GUI.Button (new Rect (5, 5, 40, 135), "<-")) {
    29.                 Debug.Log ("Left Turn");   
    30.             }
    31.             if (GUI.Button (new Rect (135, 5, 40, 135), "->"))
    32.                 Debug.Log ("Right Turn");      
    33.             if (GUI.Button (new Rect (50, 60, 80, 80), "FIRE!")) {
    34.                 Debug.Log ("FIRE!");       
    35.             }
    36.            
    37.             GUI.EndGroup ();
    38.         } // end if
    39.  
    40.         Debug.Log (controller.missionState); /***********************************/
    41.  
    42.     }
    43. }
    44.  
    I cleaned out a lot of comments - line 82 is the "marked" debug statement in line 40 now. Basically I am trying to access the missionState from the MissionController.cs script to find out whether it's the player's turn and then hide/show the UI.

    What am I missing? I really have trouble with dividing up the code into separate classes. :(

    This is MissionController.cs:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public enum missionStates { alienTurn, trooperTurn, MissionOver };
    5.  
    6. public class MissionController : MonoBehaviour {
    7.    
    8.     public missionStates _missionState;
    9.    
    10.     public missionStates missionState
    11.     {
    12.         get
    13.         {
    14.             return _missionState;
    15.         }
    16.         set
    17.         {  
    18.             if (value != _missionState) // This ensures we only call GameStateHasChanged() if it's actually changed.
    19.             {
    20.                 _missionState = value;
    21.                 MissionStateHasChanged();
    22.             }
    23.         }
    24.     }
    25.    
    26.     public MissionView missionView;
    27.     public MissionMap map;
    28.    
    29.    
    30.    
    31.     void Start () {
    32.    
    33.         missionState = missionStates.trooperTurn;
    34.        
    35.     }
    36.    
    37.    
    38.     void Update () {
    39.    
    40.     }
    41.    
    42.     public void MissionStateHasChanged ()
    43.     {
    44.         Debug.Log ("MissionStateHasChanged() has been called");
    45.     } // end method MissionStateHasChanged
    46.    
    47. } // end method MissionController
    48.  
     
  13. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi AstaSyneri,

    Just a heads-up: my laptop is broken at the moment, so I'm relying on my iPad and my memory...

    By placing the enum outside the class, I don't need to qualify "gameStates" by adding the class name in front of it (e.g. "GameController.gameStates.PlayerX". It puts the enum in the global namespace, so all the scripts can see it and use it as if it were defined in their own file.

    Looking at the OnGUI code, the only reason I can think of for that error is that the controller variable hasn't been assigned anything. You need to drag a MissionController script onto it in the Inspector if you don't set it up in the Start() function.

    In the tutorial, I tend to grab the relevant script links using GetComponent<COMPONENT_NAME_HERE>()

    I try not to rely on remembering to drag things into the Inspector if I can avoid it as I usually forget to do so.
     
  14. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    hi, would this work on iOS as well and is it local or online turn based?
    thanks
     
  15. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi ProjectOne,

    If you're asking whether the 'Tic-Tac-Tut' project runs on iOS: yes, it does, but I only have an iPhone 4 and a 3rd generation iPad for testing, so I don't know how it looks on non-Retina models. In theory, it should run on Android too.

    As long as you're not using multitouch input, the usual checks for "Fire1" for clicks seems to work fine, as does the Unity GUI.

    I'm afraid there's no online turn-based support; it's local only.
     
  16. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Right, my laptop's working properly again and seems to be behaving itself. (Note to anyone who's got a Crucial M4 SSD fitted to their computer: some older versions of that drive's firmware have a very nasty bug that only kicks in after just over 5100 hours of use!)

    So... I've decided to make my next project a "turn-based board game tutorial / framework". I'm aiming for something pretty generic, so it'll come with a "race" game demo, and probably something based on the cross-and-circle board game genre (like "Ludo"). I'll throw in some computer-specific features to show how a traditional board game can be jazzed up with incidental animations and other stuff.

    One minor issue: As the new Unity GUI appears to be some way off yet—it's unlikely to make it into the 4.0 release, for example—I've decided to switch to the NGUI package for all future tutorials. (Why NGUI? There's a free version of this available which can be freely used in tutorials and frameworks.) Anyone wanting to make a full game with the end result will need to buy the full version of NGUI as this removes the DOG that appears with the free version. Or you can rip it out and replace it with your own. The principles should remain the same.

    All this will take me about a couple of weeks to write. I'm also considering using the framework for a couple of actual games to be sold in the various App Stores later on.

    I'm open to artwork contributions and suggestions for the tutorial demo projects. (Please PM me rather than posting here as I'd prefer not to clutter this thread with discussions about another tutorial.)
     
    Last edited: Jul 8, 2012
  17. davidoux

    davidoux

    Joined:
    Nov 14, 2012
    Posts:
    3
    Dear Sean,

    I bought your tutorial several days ago and I love it; I am curently trying to move smoothly the camera to the the clicked cell, for this I am using a coroutine called MoveObject and I update the SmoothFollow script.target with the interpolated position
    (cf my code below) but that just don''t work, it's like everything is moving (you can see the GameModel moving together with the camera) so everything looks static in the game view.

    Can you help ? Thanks

    Code (csharp):
    1. void Update () {    
    2.  
    3.                 if (Input.GetButtonDown ("Fire1"))
    4.  
    5.                 {
    6.  
    7.                     // Construct a ray from the current mouse coordinates
    8.  
    9.                     Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    10.  
    11.                     RaycastHit hit;
    12.  
    13.                     if (Physics.Raycast (ray, out hit))
    14.  
    15.                         {
    16.  
    17.                            
    18.  
    19.                             BoardCellState cellScript = hit.collider.GetComponent<BoardCellState>();
    20.  
    21.                             if (cellScript)
    22.  
    23.                             {
    24.  
    25.                                 SmoothFollow script = Camera.main.GetComponent<SmoothFollow>();
    26.  
    27.                                 Vector3 startPos = new Vector3(script.target.position.x, script.target.position.y, script.target.position.z);
    28.  
    29.                            
    30.  
    31.                                
    32.  
    33.                                 Vector3 endPos = new Vector3(cellScript.transform.position.x, cellScript.transform.position.y, cellScript.transform.position.z);
    34.  
    35.                             ;
    36.  
    37.                            
    38.  
    39.                                 if (!m_Moving){
    40.  
    41.                                     StartCoroutine(MoveObject(script.target, startPos, endPos, 1.0f));
    42.  
    43.                                 }
    44.  
    45.                             }
    46.  
    47.                         }
    48.  
    49.              }
    50.  
    51.         }
    52.  
    53.         IEnumerator MoveObject (Transform thisTransform, Vector3 startPos, Vector3 endPos, float time){
    54.  
    55.             m_Moving = true;
    56.  
    57.             float i = 0;
    58.  
    59.             float rate = 1/time;
    60.  
    61.             while (i < 1)         {
    62.  
    63.                 i += Time.deltaTime * rate;
    64.  
    65.                 thisTransform.position = Vector3.Lerp(startPos, endPos, i);
    66.  
    67.                
    68.  
    69.                 yield return 0;
    70.  
    71.             }
    72.  
    73.             m_Moving = false; // MoveObject ended
    74.  
    75.         }
     
  18. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi Davidoux,

    I'm not sure what's happening as it's been a while since I had a chance to look at this project. (I'm a translator by day and haven't had much free time lately.)

    I'll take a look this evening and get back to you.
     
  19. sbaggaley

    sbaggaley

    Joined:
    Nov 17, 2012
    Posts:
    4
    Just a heads-up: I've been struck by a UDN problem that's preventing me from 'claiming' my "stimarco" username. I've emailed UT support to see if this can be resolved, but I can't access any PMs sent to "stimarco" in the meantime.

    @Davidoux: I'm looking into the problem, but have had to upgrade my project to Unity 4, so it's going to take me a bit longer to investigate your issues than I hoped.
     
  20. davidoux

    davidoux

    Joined:
    Nov 14, 2012
    Posts:
    3
    OK. Let me know when you are ready and thanks for the heads-up.

    PS : I also emailed you about your nex project "turn-based board game tutorial / framework", any heads up on this ? thanks !
     
  21. sbaggaley

    sbaggaley

    Joined:
    Nov 17, 2012
    Posts:
    4
    Er, yes. That's still on my to-do list, but it's been held up by the aforementioned personal and work stuff. I'm hoping to get back into it over the holiday season, but I can't make any guarantees at the moment. My day-job is translation (and occasional technical authoring / writing work), but it's not as regular as I'd like and it's very hard to plan around. I might get nothing for a days, followed by a flurry of work that requires all-nighters through the weekend. (I'll be looking for full-time employment next year, I think. The freelancing lifestyle can be very stressful.)
     
  22. sbaggaley

    sbaggaley

    Joined:
    Nov 17, 2012
    Posts:
    4
    Right, that's the translation project from hell out of the way...

    I discovered last week that I'd started work on the v1.1 release, which is to include a player vs. player mode (as well as some tidying up of the docs). My memory being the useless black hole that it is, I've managed to completely forget how I planned to do this, so I've had to start over to work out why I'm seeing errors everywhere. Until that's done, I can't actually run the thing.

    (Yes, I know, "backups", yadda yadda, etc. I do, in fact, back up my stuff pretty often. But... this particular project was archived onto an external drive. Somewhere... at my parents' house. Which is some distance away and locked up*– in the space of three weeks, I've gained two new nieces and a nephew, so they're off doing the predictable "Oooh! She's got your eyes!" grandparent schtick. Let that be a lesson to me: off-site backups aren't much use if said site is inaccessible when you really, really need it.)

    However...

    ... I do remember the camera being a particularly frustrating component to get working properly. (I'm not a natural mathematician; my brain is much more comfortable with words and music. Maths makes it dive under the nearest table and stay there, quivering like a particularly terrified jelly.)

    My suspicion is that your code is accessing the BoardCellState's location, but that's a child of the entire GameBoard object, and thus the coordinates you get may need to be converted to "world space" coordinates first, otherwise they'll be relative to the GameBoard object. If you don't do that conversion, you'll get weird results.
     
  23. sbaggaley

    sbaggaley

    Joined:
    Nov 17, 2012
    Posts:
    4
    Test to see if login issues have been fixed...

    (Edit) Looks like they have. I can finally access my Asset Store account too! :)
     
    Last edited: Jan 2, 2013
  24. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Okay folks, my UDN problems appear to have (finally!) been resolved. I've even got my original username back!

    Hopefully, what follows may be of interest to some of you...

    I've decided to rewrite this tutorial rather than simply update it. Partly, because updating it will require some painful Unity GUI work – and I'm really not a fan of the present GUI system –*but also because the 3D elements are very distracting from the core purpose of the tutorial.

    I intend to switch to NGUI for the GUI elements, in preparation for the forthcoming new Unity GUI system, which is likely to have a similar architecture. (NGUI has a free runtime library specifically for tutorials like these, so you won't need to buy it yourselves unless you want to use it in your own projects.)

    Crucially, NGUI has a drag-and-drop UI designer component, which saves me a lot of pain and aggravation: what passes for my memory simply doesn't "do" numbers. I much prefer dragging stuff around a screen than typing numbers in and trying to calculate offsets and things. Boring stuff is what computers were invented for; I shouldn't be doing it myself!

    I therefore intend to rebuild the entire Tic-Tac-Toe game entirely in the GUI rather than using procedurally generated 3D elements as in the original release. This is because the purpose of the tutorial is to show how to create a turn-based "Tic-Tac-Toe" game in Unity, rather than explaining how to create procedural models and imagery. The 3D stuff is distracting and bloats the code. The 3D stuff is also tricky for me personally as I'm not a trained 3D modeller and my attempts at it tend to look very bleak and ugly. I am, however, pretty good at graphic design, and I also know a proper (2D) artist...

    One further advantage to this GUI-based approach is that I can show how to adapt the GUI for mobile platforms, handling different aspect ratios, display resolutions, orientations, etc. This is arguably much more useful for newcomers to Unity than learning how to create a 3 x 3 grid of flattened cubes.

    So... if anyone has any comments or suggestions, please speak (type?) up! I won't be starting in on this before the weekend.
     
    Last edited: Jan 14, 2013
  25. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    How's the update/re-write progressing Sean?
     
  26. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Far too slowly.

    Not because any technical difficulties, but because life got in the way. I'm hoping to tackle it over the coming weekend.

    However, my previous post regarding NGUI / Unity GUI can be ignored. I'm going to start over from the original, but will also offer a version that uses a single, complex, Substance to provide the entire board and pieces.
     
  27. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Okay, time for a sitrep.

    I did manage to get some work done on updating this project, but Real Life® has gotten in the way once more: I have to relocate before April. That's going to hammer my free time down to almost nothing. I'm currently in full-on Mercenary Mode and focusing on building up enough money to pay for a deposit, etc.

    I've always preferred renting to owning a property outright as I don't like living in the same place for more than a couple of years or so, so this isn't an unusual situation for me, but I'd intended to move out near the end of the summer rather than now. I'm currently taking on all the translation work I can get, which will leave me with very little free time until after the move.

    So... I'm going to focus on making a "v1.1" release, which will include only a player vs. player mode, correct some typos in the documentation, and add the relevant new documentation to explain the changes I've made. I only have a few hours each Sunday to work on this, and I have to spend some of that time reminding myself how the game worked, but I think it's doable. If I can't get it done by Monday, it'll be the Monday after.

    The silver lining is that this means I can probably justify holding off on a more wide-ranging update until the next release of Unity –*hopefully, this will include the long-awaited new GUI system, which is a much better technology for a simple board game like this than using a full 3D environment.
     
  28. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Quick update:

    It seems this a new release is indeed imminent, if recent announcements by Allegorithmic are accurate. Sometime before the end of April seems likely.

    Fingers crossed, this will include the new GUI too. (The Allegorithmic announcement only mentions improved support for Substances on mobile devices, but I wouldn't expect them to discuss non-Allegorithmic features in an upcoming release anyway.)
     
  29. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    Can you link to the Allegorithmic announcement?
     
  30. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi Toad,

    I saw the info in their latest newsletter. You can sign up for it on their website (the link is at the top right of the main page); I can't seem to find a direct link to the newsletter for viewing online.

    The implication seemed to be that an update to Unity 4 is due sooner rather than later, and that it will include an upgraded Substance engine that (I think) will support some mobile platforms too. I.e. you should get most, possibly all, of the features of the full fat version on mobile platforms, rather than having to 'bake' them when building the project.

    (I suspect performance will be an important factor when deciding whether to use it, or stick with pre-baked Substances. There's a lot of variation in mobile platform CPU and GPU power today.)

    It seems likely to me –but I should stress that this was not mentioned at all in the Allegorithmic newsletter – that the new Unity GUI may also be appearing in the new release. My reasoning being that one of the new GUI's architects, Nicholas Francis, has just announced his departure from Unity Technologies to focus on making games again. Finishing work on such a difficult project would be a natural point to make such a big decision.

    But I may, of course, be wildly wrong.
     
    Last edited: Mar 2, 2013
  31. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    OK, cool - thanks for letting me know.

    I've been waiting for mobile support to come to Substance materials for some time. And even longer for the new Unity GUI! :0)
     
  32. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    You and me both!

    Full mobile support for Substances would be a big plus: I think it's possible to replace the entire Tic-Tac-Toe "board" with a single Substance, for example. That would reduce the memory footprint and download size of the game and could lead to a useful Substance Designer 3 tutorial as well. (There's a hell of a lot of power behind their "FX-Maps" nodes that is barely even touched upon in the docs. Which is embarrassing as I wrote most of them.)

    The new GUI would also let me bin all that camera stuff, which adds nothing but confusion to the tutorial.

    My plan is to get a two-player (v1.1) release done this week, then roll that all up into a ZIP file and include it with a rewritten 2.0 version that would use the new GUI and Substances for pretty much everything. (I'll need to do some R&D on the Substance-based board first though. It's been a while since I played with SD.)
     
  33. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Well, looks like the Unity 4.1 release doesn't include the new GUI, so I've got (at least) two months before that turns up.

    I've done most of the coding for the 1.1 release of Tic-Tac-Tut; I still have to clean up some of the code and then there's the documentation to update. So another week or so at least.

    (I've had a flurry of translation work to do of late, so my free time is even more limited at the moment. It is coming though.)
     
  34. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    And it looks like Life™ is getting in the way again.

    I have the project mostly rewritten. I've decided to replace the rather poor graphics too. However, I'm tied up with some big translation jobs, flat-hunting (my tenancy runs out next month, so I have to save up a bunch of money as Italians typically let apartments that have _nothing_ in them at all, not even a kitchen!) and a bunch of family-related stuff as well. Hence the seeming lack of progress. For which I can only apologise. I've had maybe 12 hours to devote to this in nearly 2 months.

    Things should ease up a little after I relocate, but that will be close to, if not after, the next Unity release, so I may yet skip v1.1 and jump straight on to v2.0, which will be built entirely using the new Unity GUI system—assuming that actually appears in the Unity v4.2 release. (If it doesn't, I'll stick with Plan A.)

    Existing users will get any and all future updates for free, but I might bump the price up to around $7-ish with the next release (v1.1 or v2.0) as both involve an almost complete rewrite with new graphics. I've also decided that each update will include the previous version(s) in a ZIP file, should anyone be interested. There's enough educational value in the differences and the reasons for changes that it would be a shame not to, I think.

    So, yes, I'm still working on this, but I'm not able to do much more than basic support at the moment.
     
    Last edited: Apr 25, 2013
  35. Toad

    Toad

    Joined:
    Aug 14, 2010
    Posts:
    298
    Hi Sean, any update on this?

    The other day Aras tweeted that 4.2 is very close to release...
     
  36. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi Toad,

    Yes: I'm basically waiting on the new Unity GUI. If I'm going to have to do a substantial rewrite of the original code, it doesn't make sense to do so twice in quick succession, so until that new GUI comes out—and I really do hope it appears in the next release—I'm just doing support. I already know how the new version will look and it will definitely support all player combinations.

    (I'm also tempted to add multiplayer support as well. A full client-server setup is overkill in theory for a tic-tac-toe game, but this project would make for an excellent illustration of exactly which code should be in the client and which on the server. All the basics would be there.)

    I used to be active as a game designer and developer back in the 1990s and have generally preferred 2D (or isometric) games myself. I would like to work on some of my own, (including a major remake of that one I linked to), but if Unity doesn't get a release with better 2D support baked-in, it's going to make the process more complicated than it should be.
     
  37. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    It's been a while...

    It looks like the upcoming 4.3 release will (finally!) include some solid 2D support. I've played around with NGUI and a few other extensions, but I'm not really comfortable with requiring such things for what is, after all, a tutorial built around one of the simplest games known to humanity.

    The new 2D features look very interesting. Still no new GUI, but I might be able to live without that if the 2D stuff is good enough.
     
  38. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    4.3 is out. I wasn't on the beta list, so I need to do some reading tonight.

    Buffering... please wait.
     
  39. Alert123

    Alert123

    Joined:
    Nov 17, 2013
    Posts:
    2
    I noob in Unity, bought "Tic-Tac-Tut" as first tutorial to learn how to create simple 2d turnbased game.
    Build and run it - I see only empty blue screen. Read "Tic-Tac-Tut" pdf documentation - it's a lot about inner implementation but nothing about how to run imported project or recreate from emty project step-by step.
    What should I do to run it? I expected it is "tutorial" of 2d game creating for Unity but not examples of C# scripting.
     
  40. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Hi Alert123,

    My tutorials are intended to be used after you've followed the basic tutorial series provided by Unity themselves. This is stated explicitly in the PDF. They're not designed to be your first ever tutorial.

    My tutorials are aimed at users who have learned the basics of how Unity works and would now like to understand specifics, like how to create a turn-based game in Unity. (Unity can make any kind of game, but most tutorials are still biased towards real-time action games.)

    If every tutorial assumed no knowledge at all on the user's part, it would make every tutorial much longer –*and time-consuming –*than it needs to be.

    My apologies if you feel you were misled.
     
  41. Alert123

    Alert123

    Joined:
    Nov 17, 2013
    Posts:
    2
    >> My tutorials are intended to be used after you've followed the basic tutorial series provided by Unity themselves. This is stated explicitly in the PDF.

    PDF available after you bought package.

    I saw basic tutorials but they are about 3D and I do not interested in 3D at all. So I looking for 2D tutorials only.
    Today I saw other tutorials on youtube, try to create sprites, set sprite images and box colliders, set scripts with OnMouseDown and it doesn't work - first 10-20 clicks on same object not working, then suddenly start working. Very strange behavior. It looks like Unity so buggy even if have 4 version.
     
  42. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    A point. I could have sworn this was mentioned in the description text too; I'll rewrite that for the new 2D version.

    The current "Tic-Tac-Tut" tutorial is 3D-based too. The new one will be a major rewrite and use the new 2D features as the 3D bits got in the way. (I prefer 2D myself.)

    One point worth mentioning is that my current tutorial uses mostly procedural graphics –*the board and other bits are generated when you run the tutorial, so there's very little to see in the Editor. I wasn't happy about doing it that way, but I'm a terrible 3D graphics artist, so had little choice. The new version will be more conventional and probably look a little like "Letterpress" in style.

    I've not noticed any bugginess myself, but if you're running Windows, you might want to check your computer's drivers are up to date. (Such problems are less common on Macs as Apple tend to provide most of the drivers themselves, but they're not always perfect either.)
     
  43. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Okay, I've done the research and created the graphics. I know how it's going to look, how it'll work, etc.

    I need to clear my remaining translation work so I'll be free to get stuck in over the holiday period. (I find it impossible to concentrate on anything else when I have a project deadline looming over me. Multi-tasking is something that happens to other people.)
     
  44. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    This is taking me a lot longer than I'd hoped. I've had a total of two weekends for this project since early December –ironically, the two months when I expected to have the least translation work have been my busiest ever. (Which could come in handy as my old car needs some expensive work done on it soon.)

    But here's a glimpse at what's coming soon, to a computer near you...

    $Screen Shot 2014-02-10 at 10.17.43.png

    I know the graphics aren't the point of a tutorial like this, but I'm quite pleased with how this is looking now. And good graphics don't hurt either. The code will be essentially a complete rewrite, with only a small section of the old AI code retained. I wasn't happy with the old tutorial's attempt at a Model-View-Controller approach as it turned out to be a poor fit for a game. I've written some of the code already, though there's nothing much to see at the moment.

    At the moment, I'm experimenting with the GUI. I'd hoped the new GUI system would have appeared with the 2D features in 4.3, but it didn't. I really don't want to use a third-party GUI library as it makes the tutorial much more complicated, and I'd have to strip it out again once that new GUI system does get released. I'm not happy about it, but it looks like I'll have to use the old Immediate Mode GUI again for now. It's not ideal, but I can do it in a way that should make it easy to replace.

    My plan is for the existing project to be replaced by this one, with the old one included as a ZIP file for hardcore nostalgia freaks, (and people who really like to punish their eyes). Existing owners will therefore not pay a penny for the update –*it'll be free.

    I'm not sure if the price will stay the same though; that's something I'll decide on when I absolutely need to. It may fluctuate a bit as I experiment to see what the sweet spot should be, but not by so much that any of you feel like you've been cheated in some way.

    Anyway, I need to get back to work.
     
  45. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Update:

    I now have a fully working GUI, including basic logic for the board. It looks like this now:

    $Screen Shot 2014-03-02 at 23.10.20.png

    The main GUI is still there, as in my previous post, but I removed the option to change the cell colour as that feature isn't worth adding to this release for reasons explained below. In play, you see only the current player shown + their symbol, to let you know whose turn it is.

    Unlike the previous version, player vs. player and even AI vs. AI will be possible. I've decided to only include the one AI this time around as the "random move" AI wasn't really an AI. Instead, I'll just have the 'good' AI with two settings: Easy and Hard. "Hard" always plays a good move; "Easy" will make the AI play a random cell about 50% of the time.

    *

    The GUI is entirely faked using 2D sprites and 2D box colliders, ray casting and the like. It's not that difficult to follow, but it's not pretty either. A lot of the stuff that would normally be hidden in a 'normal' GUI system has had to be done the hard way, with all its gory details exposed. I'll redo this when the new Unity GUI system is released as it should dramatically reduce the amount of programming required. (This is the reason I dropped the "change cell colour" option: it just doesn't add anything of value to the tutorial in its present form.)

    As the new GUI system will also likely require another rewrite of the accompanying tutorial documentation, that won't happen for a few months after this release is done, unless Unity Technologies decide to release the new GUI system within the next week or so.

    Pretty much all there is left to do is add the AI code and write the new tutorial doc. Fingers crossed, I'll be able to have this done in a couple of weeks. (I've only had a few hours on Sundays free for this lately, but March is often a quiet month for translation work.)
     
    Last edited: Mar 2, 2014
  46. bitmaker

    bitmaker

    Joined:
    Jun 12, 2013
    Posts:
    2
    Sean,

    How is the rewrite coming? I am ready to get it when it's complete.
     
  47. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Getting there, but very slowly.

    It's not that it's hard to do – I've already done this once before – so much as finding the time: My day job is translation, which isn't physically hard, but does require me to stay focused for hours on end. I'm also getting a lot more work than I did this time last year, which is nice and all – we all need to pay the bills – but it's very draining mentally. I feel absolutely knackered by the evening. I'm sitting, typing, in front of a computer all day, so that's the last thing my brain wants me to do in my down-time, and it's also not good for my RSI either. I'm left with weekends – usually the Sunday as I often work Saturdays too. But that's also the only day I get to go out and socialise, so it's a battle.

    I have decided that this will be my final year as a translator though. It doesn't pay well enough for me and I'd much rather be doing something more creative than translating manuals for factory machinery.

    This weekend, I plan to complete something I'd completely forgotten about: the "Player X Wins / Loses / Draw" stuff. I'll also add the basic win/lose/draw rules to the relevant code module while I'm at it, as well as some utility functions I'll need for the AI. That I intend to write next week.

    It also looks like the new Unity GUI might be just around the corner, so I may have to go back and strip out the GUI I just wrote, but I may just leave it as-is and do another release over Easter instead (assuming 4.6 comes out in time for that).

    After all that, there's still the 40+ pages of tutorial docs to write, as well as a short intro to computer programming doc that I plan on expanding into a complete e-book this year.
     
    Last edited: Mar 20, 2014
  48. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Okay, it's been two weeks since my last update...

    First, I've got the foundations in for the AI, so not a totally lost fortnight, but I've been very busy with translation work due to some unexpectedly large bills. (Translation doesn't pay particularly well. As Bernard Black once said: 'The pay's not great, but the work is hard.')

    It appears Unity Technologies intend to release Unity v4.5 before their v4.6 version. The latter is the one that includes the new GUI, so going by UT's history, I suspect 4.6 is at least a couple of months away. So I will use my own GUI for this release. I'll do another release later for the new GUI.

    The AI will be the next thing I finish. Once that's done, it's "just" polishing and the write-up. This time, I've dropped the Model-View-Controller design pattern, so it shouldn't be quite as complicated to follow.
     
  49. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Another progress update:

    The AI seems to be working. Also, human vs. human, human vs. AI and AI vs. AI are all working too.

    It looks like I only need to add some final polish –*at the moment, you just get dumped back to the main GUI when a game ends; there's no animation or anything yet. I did draw up some simple graphics, but they're not very good I think it needs something with more visual impact.

    And then it's on to the writing.

    Fingers crossed, touch wood, etc., I should have everything done in about a week or so. Always assuming the day-job doesn't get in the way. (There is another national holiday coming up on the 1st of May next week, so that should give me some breathing space.)

    Note: I won't be able to test this on any mobile / tablet devices for a month or so yet. I'll make a note to that effect in the blurb when I upload.
     
  50. stimarco

    stimarco

    Joined:
    Oct 17, 2007
    Posts:
    721
    Okay, I got the game-over graphics in.

    I've also done quite a bit of testing, which resulted in my making some modifications to the AI code as it wasn't working very well. Some other bugs have also been nailed. I've also added a debugging mode that changes the cell tile colour brightness according to the AI scoring. Which helped greatly with the debugging and testing. It's not a 'perfect' AI, but it's good enough to be challenging without being boring.

    AI vs. AI works, as do other combinations. You can even swap the pieces ("O" and "X") between players, although Player 1 always plays the first move. See screenshot below.

    $Screen Shot 2014-04-27 at 22.28.45.png

    So, the coding's finally done. I'll focus on the writing side now. My next day off – fingers crossed – is Thursday (1st May), which is a national holiday over here. I may still get some translation work in, but the weekend at least should be clear.

    Nearly done!