Multi-Player Tiny Trek for Arduino

TinyTrekBasicListingWhen I set about creating the Half-Byte Computer/Console, one of the things I, personally, wanted to do with it was create a small, easy to program, micro-micro computer that harkened back to my childhood, otherwise known as the 1970’s.  In order to do so, I needed the language that I learned back then, Tiny Basic, to work on the device.  I did both and it works great.  However, one of my goals with this combo was to play Tiny Trek.

Now, Tiny Trek is small, compared to its big brothers that ran on computers with gobs of memory (you know, 8k) and something called ‘Microsoft Basic’ or ‘Microsoft Basic-80’.  These behemoth Treks’’ would clock in at around 4k to 7k or more. Tiny Trek, however, was small, about 1.5k.

1.5k.

Wow, that’s BIG!  At least, it is when you have less than 1024 bytes (1k) of RAM to work with. 

I am still looking for a solution to the RAM squeeze.

Anyway,  My goal of running Tiny Trek in Tiny Basic is yet to be resolved. HOWEVER…I have decided to code it in Arduino C.  This way, the code can be what ever size it needs and I can have more memory for graphics.  I am also considering making it multiplayer, instead of the computer being the Klingons, one player can be Klingon and one can be the Federation.

Only problem is time, which is in very short supply right now and I’ve got several other things ahead of this, but, I can still plan it out, right?

So…here’s my thoughts on multiplayer Tiny Trek for Arduino.  You won’t need a Half-Byte computer, but if you do….let me know!

Input and Output

11268362_10204228141446944_697530416473282760_oSince this is supposed to be a simulator, I’m thinking we don’t need a full keyboard, so a keypad will work just fine.  I have a few sticky back keypads that I can use. They have 0-9 and a-d and few other keys.  They should work just fine.  I was also thinking of using the Wii Nunchuk, but I am thinking that is overkill and limited in use.  But, I may have dedicated buttons for phaser/photon torpedo and shields up/down.

I’m going to use video and audio, but I am also thinking that a small status display is in order. I have a few 2×16 lcd panels, but they use the serial I/O, which will be used for communication between the two computers, so I may use the little Nokia 5110 LCD’s.  They are similar in resolution to the video, so I could swap screens if needed.  I’m thinking the little screen could show energy, torpedo inventory, shield status and other info.  Video would show the short range/long range display.

Communication

For now, serial will be used to communicate with the two computers.  As each computer will be running independently, I’m thinking code in each version of the game will have to have a main loop that will then monitor communication from the other computer and alert the user accordingly. It also needs to ‘run’ the ships functions and service the UI.  Our snappy 328’s are perfect for this. Oh, it also has to monitor the keypad and update the secondary screen. No problem.

Game

The game, as stated above, will start and run in a loop.  This loop will simply call various functions that will then control the game.  This main loop will:

  • monitor serial i/o
  • update the video
  • monitor the keypad
  • update the secondary screen
  • run each game module
  • do it all over and over until game won or ship is destroyed

The game modules contain the library computer, short and long range scanners, battle mode, navigation, ships condition.

Game Play

Game play will be very similar to the 1970’s version in which you have to seek out and destroy the dreaded Klingons. Instead, however, of having to destroy x number, you have to only get one…but that can be hard as that one is another player who will play unpredictably AND it will be much more difficult to destroy the ships.  There will be only one starbase for the Federation and one for the Klingon.  You must protect your base as it CAN be attacked.  You cannot, however, use phasers or torpedos while ‘docked’.  The Klingon CAN, however, attack while you are docked. Undocking will use one move and you will be vulnerable while doing so.  Klingon bases can cloak for a short time.

Victory is achieved when you destroy your opponent.  You do so by: forcing them to use up all shields and power.  When both are depleted, they will be given the opportunity to surrender. If they do not, you must destroy them. If you do not, they can escape and the game will end in a draw.

Hardware

In addition to the keypads and secondary screens, I’m thinking the PIN 13 LED can be used for the RED ALERT.  It blinks when your opponent is in range.  Some cool things that can be done…the previously mentioned buttons for phaser/photon torpedo control and shield control, there could also be a self destruct (have not thought much about it, though.)  You could get as complicated as you want, provided you have enough pins.

Serial is the best way to talk to the computers, but that does not mean they have to be wired.  There are cheap bluetooth modules that communicate serially and then there is the super cool and super cheap ESP8266 WiFi boards.  And, the best part is that you only need a few lines of code to set them up, no additional libraries are needed.

So, there you go, a multiplayer, interactive Tiny Trek for Arduino.  What do you think? Leave your ideas, suggestions, whatever in the comments below.

Hoping it wont be too long before I can start this. Of course, I need someone to play with…maybe an Internet option too….hmmm….

Life goes on

1988.  I was working two jobs, one at a company that made the front end gear for pocket paging systems and a part time job at a local video store (remember them?) I was content, for a change.  I was making a little money, had an automobile and … not much else.  Later in the summer, I was laid off from my full time job (who buys paging equipment anyway?) and went full time at the video store. In management.  Which, for me, was kind of funny.

My first assignment was at a store in Colonial Heights. It was a very busy store and a challenging position. Second Assistant Manager.  Oh boy. I was a MANAGER! I was there for a few months and was transferred to a store in Richmond’s west end. This store, as I was told, was a mess.  I was to help straighten it out.  I was promoted to ASSISTANT MANAGER too.  A plus, since it meant a raise.

Well, my first day at the store was uneventful except for my introduction to one of the staff.  A perky and young person, she was very friendly and seemed to get along with everyone.  I was smitten.  Toward the end of her shift, she asks if she can leave a little early. Jokingly, I look at my watch and said ‘yeah, I suppose so!’.  She gave me an odd look, thanked me and left.

After a few months, I was completely taken with this person and gathered up enough courage to ask her out. She turned me down. Not once, but several times.  One day, though, she said sure.  Now, today, I probably would have gotten into trouble for asking a subordinate out, but it was a different time then. 

That first date? Well, it was terrible. We saw the movie ‘Ghost’ and both had had bad days.  We did agree, however, to try it again.  That second date was way better, though I could not tell you what we did or where we went.  I’m sure it was dinner and something, but I forget.  That first date, though? I still remember it.  Unfortunately, nothing remains today of that date.  The restaurant is history. The movie theater is now a Kroger. The cars we had? Both are gone. 

We went on to more dates and I eventually married her.  We bought a house, which is now someone else’s home.  We had a child, who is now graduating high school and is no longer my ‘little’ buddy. 

June 7, 2015 marks the fifth anniversary of Jo Ellen’s passing.  And, while I do miss her, I know that she is no longer in the bad spot that trapped her  for the last two years of her life.  That life is gone, but the happier memories remain.  As I go through boxes that have lay dormant for four years now, I find pictures, yearbooks and other mementos from that part of my life. I am happy to find them and I realize that life, my life, has gone on.

And, so too is my desire to write about it. This will, likely, be the last time I write about that part of my life. I have another wonderful wife, two more wonderful kids and look forward to making more memories with them. 

Jo Ellen’s death was devastating for me, my family and our friends.  It was unexpected and seemingly out of nowhere.  One day she is in the hospital for muscular problems and, then…the ICU and she’s gone.  I will never forget the lifeless stare or having to tell my then 12 years old son he has lost his mother.  It is seared in my memory forever.  The decisions I had to make that day will haunt me as well.  But, there is a bright side.  She is no longer in pain. She is no longer suffering the deep depression she had fallen into and she is at peace. 

After five years, my life is completely different. While I do miss her, I have gone forward with life.  I have married another wonderful woman who has accepted my son as hers and given me another biological son and a really cool step-son.  Jo Ellen would approve, she always told me I needed to remarry if something ever happened to her because Chase needed a Mom and I needed someone who could tell me where my socks were and what day it was.  She was right.

Oh, and the comment I made to her that first day and the odd look? Well, I found out, years later, that she thought I was an ogre! She did not realize I was just having some fun. I’m glad she, eventually, realized that.

Windows 10, coming July 29…what you need to know

edgenewtabWindows 10. Microsoft’s apology for Windows 8.  Currently in testing and ‘Insider Preview’ modes, the operating system from Redmond now has a date…and a price.  The date? July 29,2015. The price, err prices? $119 for Home and $199 for Pro for consumers who are purchasing the operating system for a system that does not have Windows 7 or Windows 8.1. If it has Windows 8, the user will need to update it to Windows 8.1 (a free upgrade) and THEN to Windows 10.  The $119 would be for people who:

  • built a computer
  • got a computer with no operating system
  • has a computer with Linux or Windows XP
  • An Intel Macintosh that does not have either Windows 8.1 or Windows 7
  • Wants to use it in a virtual machine

These same scenarios also work for PRO. 

You CAN upgrade your tablet or PC to Windows 10, in its first year of release, for free IF you are ALREADY running Windows 7 or Windows 8.1 

Now that we cleared that up…

Here are some things you will LOSE IF you upgrade from Windows 7 and, in some cases, Windows 8.1:

  • Windows Media Center
  • Windows DVD Movie playback (third party applications are not affected, ONLY Microsoft applications, like Windows Media Player and XBox Video will lose the DVD playback. Gabe Aul of Microsoft says A Microsoft alternative ‘may’ arrive later.)
  • Windows 7 desktop gadgets
  • The ability to hold off updates for Windows Home users (pro and Enterprise will have full control)
  • The Windows LIve OneDrive application
  • Solitaire, Minesweeper and Hearts. These have been replaced by Windows Store versions. You will have to download them.

So, Which version will you get? Well if you have…

  • Windows 7 Starter, Windows 7 Home or Home Premium, you get Windows 10 Home. If you have Windows 7 Ultimate or Pro, you get Windows 10 Pro.
  • Windows 8.1, Windows 8.1 with Bing, you get Windows 10 Home. Windows 8.1 Pro and Pro for Students, get Windows 10 Pro.
  • Windows RT…sorry, you get a minor update to RT and that’s it.

How to get the upgrade…

Microsoft has an application that allows you to ‘reserve’ your copy of Windows 10.  You will do so via a dialog box that explains the benefits of the new OS and allows you to enter your email address.  Microsoft will send you an email when the OS becomes available (July 29) and will pre-download the install files for you.  How sweet of them, eh?

This is all great, but will my computer run the new OS?

Yes, if…

  • You are running or capable of running Windows 7 SP1 or Windows 8.1
  • A 1 gigahertz or faster processor
  • At least 1 gigabyte of RAM (2 gigabytes for Windows 10 64bit)
  • At least 16 GB HDD Space for 32 bit, 20 GB HDD Space for 64 bit
  • Direct X 9 or higher and WDDM 1.0 graphics driver and video card
  • Graphics card capable of 1024 by 600 minimum

In addition, your configuration and location will have an affect on features that get installed:

  • Cortana is only available in the US, UK, China, France, Italy, Germany and Spain at the time of this writing
  • Windows Hello requires special hardware
  • Continuum is for tablets
  • Audio and Video streaming via XBOX Music and Video applications are only available in certain regions
  • Speech recognition will vary by hardware quality
  • Application snapping is resolution dependent
  • A Microsoft account is required for some functionality
  • Secure boot requires UEFI 2.3.1
  • Bitlocker requires TPM 1.2, 2.0 or a USB flash drive
  • Hyper V requires a 64 bit system and an extra 2 GB of RAM
  • Miracast requires a display adapter which supports WDDM 1.3 and a Wi-Fi adapter that supports Wi-Fi direct
  • and more. See Microsoft. com for a more complete list.

There you have it, important things to know about the forthcoming operating system.  I’ll show you some of the new features in upcoming posts.

Windows 10: Living with the Insider Previews

So, I’ve been on the Insider ‘Fast Track’ for a few months now. That means as soon as Microsoft releases a new build in the Insider Preview, I get it. Those on the ‘slow ring’ will get it when a new fast track build is released. 

edgenewtabGetting new builds this quickly is both a cool thing and a real point of pain. Some of the builds have been just awesome and other just awful.  Mostly, they are just…not ready.  For a product that is supposedly going to ‘RTM’ in July and be generally available a short time later, they sure have a lot of work left.

The latest build, 10130, while better, still has showstopper issues.  The START MENU/PAGE for one. This thing is such a turd.  The concept is cool, the execution, not so much.  If Microsoft is going to insist on the damned desktop still being there, they need to nail the start page and nail it tight. For example, when you click/press/swipe the start button, the page need to pop right up, no delay. And, it needs to be complete. So far, this seems to have eluded them and is a huge step back from both Windows 7 and 8.1.  I have four computers, two desktops, a laptop and a tablet, that have the same version of Windows 10. All of them have Start Menu/Page problems. 

newstartpage2All four of those devices also have rendering issues. After a time, things just disappear.  This is mostly  a problem with Windows Store apps, like Mail, Edge, Health and others. Tonight, though, it happened with Firefox, a desktop application. Other nagging things include Windows Store applications that do not resize well and the half baked hamburger menus. Now, I don’t have a problem with the widget itself, I don’t care what it looks like, but the content needs to be responsive and it is not.

So, what do I like? The concept. I like the notion of the combined Start Page and Menu.  I like the icons.  I like the typography. I like the boot speed.  Overall, I like Windows 10.  I realize these are incomplete builds, but some of the issues, like the Start menu/page, have been there since that first insider release. Surely, I am not the only one who has experienced this, so, why not fix it?

I am looking forward to the ‘final bits’. I will eagerly upgrade my machines. I just hope they get these things fixed.

Retro Computer: Arduino Pro Mini stuffed in a keyboard

WP_20150325_16_25_02_ProSo, during the Half-Byte Console project, I purchased quite a few PS/2 style PC keyboards.  Since the project is pretty much over, I have a few of these keyboards still. They are actually fairly decent keyboards for the price.  Well, I had envisioned a future Half-Byte Computer living in something like a keyboard, like the old Commodore 64 or Vic 20.  So, I set out to build one.

I wanted to use one of my Half-Byte Console boards, alas, though, it is too big. Since I ordered a truckload of Arduino Mini Pro’s, and they are really small, I used one of them.

The first thing I had to do was figure out what I wanted in this thing and where to put the parts.WP_20150325_15_44_57_Pro

I grabbed one of the keyboards and took it apart. It is really simple, a standard membrane matrix with full travel keys.  However, even though it is a full size keyboard. there isn’t much room inside.  However, there’s enough for the mini pro, wires and not much else.  I had to cut holes for the power connector and video out.

WP_20150325_15_44_49_ProWhat I was not going to do this iteration was include sound, nunchuck or FTDI connectors.  That can all come later. I’m putting HB Tiny Basic  on the this one, so I won’t need to be programming it often. The nunchuck will be easy enough to add later, as will sound. Just not that industrious at the moment.

I cut the cable from the keyboard as the pc board inside is marked and easily accessible.  I wired it directly to the pro mini: data to pin 5 and clock to pin 4.

I decided to put the video jack on the left side,  but first had to cut a hole for the connector.WP_20150325_16_24_37_Pro  Next, I put the power jack on the bottom, where the keyboard’s cable came out. I had to enlarge that opening and super glue the connector.  Next, I wired up the video out jack and the two resistors (470 ohm and 1kohm) to the pro mini (470 ohm to pin  9 and 1k to pin 7 see my previous postings on the video out subject.)  Then the power was wired up and I tested the whole thing.  Amazingly, it worked.  It took two attempts at laying out the wire and board to get the case to  go back together and for all of the keys to work. 

WP_20150325_16_20_05_ProI now have my true retro computer, complete with Tiny Basic and blocky graphics.  Truly, an awe inspiring device.  Yep. Awe inspiring.

NOTE: yes, the wiring  is a bit sloppy, but I’m no Ben Heckendorn and this was for me.  I will clean it up when I add the other connectors.

Coach Wayne Hoy

I have been fortunate enough to have met some truly great and influential people in my life.  People such as Oliver North, Chuck Robb, Richard and Kyle Petty, Ward Burton and Wayne Hoy.  If you are into politics, you know the first two. I had the honor to see Mr. North up close and shake his hand. Mr. Robb I met during a meeting of a handicapped persons advocate group.  Richard and Kyle Petty, of NASCAR fame, I met at a visit to Victory Junction Gang Camp and Mr. Burton, another NASCAR driver, I met at a race.

And, then, there is Coach Hoy.

This is a man who not only rose above those five gentlemen, he was, truly, a very special person who touched many lives. Now, you may not have heard of him, and that’s OK. Coach Hoy was a teacher at Douglas S. Freeman High School in Henrico County, Virginia.

Mr. Hoy, who was a coach at that High School as well as a physics teacher, was one of those rare people who, no matter what was thrown at him, manage to smile, tell a joke and make you feel good.  And, he was thrown many curve balls. 

He had diabetes that pretty much took over his body and slowly killed him. It cost him, at first, a foot and then part of a leg, much of his sight, his kidneys and put him on dialysis. Ultimately, coach paid the ultimate price.

Before all of that, however, he was a very active man.  A Mason-a clown, to be specific, he was one of the most honorable people I have ever met. He rarely, if ever, said an unkind word about anybody and whenever I needed advice, I knew exactly who to go to.  As did most people.

Because he taught, he touched many lives and people never forgot him.  I’m telling you, the man could anywhere on the planet and meet someone he taught or worked with or just knew.  ANYWHERE.  And, those people treated him with the utmost respect.  His son is very much like him in this and many other respects.

As we come up on the eighth anniversary of his death, I have thought, quite a bit, about what we lost.  The coach was my father in law but I always considered him my second dad.  I miss our talks, his jokes (and, yes, those dreadful cornball jokes too) and his advice. I could always count on him giving me sound advice.

Most of all, however, I just miss him. 

PROGMEM issues with Arduino 1.6.x and how to fix them

WP_20140826_22_20_46_ProThere is a new version of the Arduino IDE out, version 1.6.1. If you do not have, you can go to the Arduino web site and grab yourself a copy.  It is much faster than the older versions.  Overall, it seems to be better in most aspects. Except for one…the new compiler breaks some of your code.

I installed it and then tried to compile Half-Byte Tiny Basic.  Expecting a clean compile, I was surprised by the errors it generated.  Upon investigation, I found that the references to PROGMEM was the cuprit. Further research revealed a fairly easy remedy, but one that was difficult to find, so I thought I’d make it easier.

Error:  variable ‘message’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))

So, this was the first error, which led to a second error that isn’t really an error (it goes away when you fix this) so I’m not going to talk about it, it is one that is safe to ignore.  Now, simply changing ‘Static’ to ‘Const’ does not actually fix the problem. No, like the error says, you need to specify the SECTION to put it in.  Look at the old way below, then check out the new way.

OLD WAY:
/***********************************************************/
// Keyword table and constants – the last character has 0x80 added to it
static unsigned char keywords[] PROGMEM = {
‘L’,’I’,’S’,’T’+0x80,
‘L’,’O’,’A’,’D’+0x80,
‘N’,’E’,’W’+0x80,
‘R’,’U’,’N’+0x80,
‘S’,’A’,’V’,’E’+0x80,
….
‘S’,’C’,’R’,’O’,’L’,’L’+0x80,
0
};
NEW WAY:
/***********************************************************/
// Keyword table and constants – the last character has 0x80 added to it
static unsigned char __attribute((section(“.progmem.data“))) keywords[] = {
‘L’, ‘I’, ‘S’, ‘T’ + 0x80,
‘L’, ‘O’, ‘A’, ‘D’ + 0x80,
‘N’, ‘E’, ‘W’ + 0x80,
‘R’, ‘U’, ‘N’ + 0x80,
‘S’, ‘A’, ‘V’, ‘E’ + 0x80,

‘S’,’C’,’R’,’O’,’L’,’L’+0x80,
0
};

Fixing this killed the second error that was showing up.  BUT…

ANOTHER error (third overall) reared its head:

Error: <variable> causes a section type conflict with <section>

Specifying the attribute did the trick, simply using PROGMEM causes issues. While the original error went away (along with that secondary error), the section type error appeared.  This one, though, was simple. I was stuffing two TYPES into the same section and that is a no-no in the new world.  Just adding the code below AND specifying a different section of PROGMEM did the trick. This way allows you to segment your data as well.

// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
‪#‎ifdef‬ PROGMEM
‪#‎undef‬ PROGMEM
‪#‎define‬ PROGMEM __attribute__((section(“.progmem.vars”)))
‪#‎endif‬

Once I made these changes, my code compiled and uploaded just fine.  I hope this saves you some time.