Scrolling table body

In the practice log web application, I had a large table of data to display. I wanted to table to scroll, but I didn’t want the table header row to scroll off the screen. Especially since users will be looking at the most recent data at the bottom of the table most of the time.

The key to making this work is to put the table into a containing div and to set a hard coded height for the table and header. The containing div needs to have a specific height and an overflow of hidden. The table body needs to have a height that is smaller than the containing div by the height of the header. It needs to have a display of block, overflow of auto and vertical-align of middle:

Continue reading “Scrolling table body”

Practice Log Webapp

I have spent the last couple days working on my Practice Log application. I make the website for downloading the application nicer looking, wrote some documentation, created a simple web application and added a couple features to the android app.

The website: weissoft.com/practicelog looked pretty bad and may have been discouraging people from downloading the software. The new look is better:

I am not a web designer, so it is still lacking some polish. I used some of the css from the wordpress theme that this blog is using and the free icon that the application itself uses.

Continue reading “Practice Log Webapp”

Wits and Wagers playable

I have completed the base game of Wits and Wagers. This conversion went fairly smoothly, at least compared to Yacht. I am getting used to the torque scripting language, though there is still a lot to learn.

The login screen is similar to the screen for the Concentration Sweep game that William created. I have added the player colors to the login spots so that you can tell what color you will be during the game. We are planning to have a common login system that will also you to pick a color and enter your name for a high score table.

The game is played in seven rounds. In each round you read a question from the boxed game. Once the question has been read, each player’s region displays a panel to enter their answer:

The player uses the touchscreen to type in their guess and then clicks the ready button. The ready button is a toggle, so if you change your mind before the timer runs out, or everyone else is done, you can flip the toggle and change your guess. In order to make sorting the guesses, I decided to stick with purely numeric guesses. This means that everyone has to use the same units. Most of the time there is no ambiguity about what units to use, but if there are, everyone has to use the same units.

Once all the guesses have been entered, the central area shows the guesses on the payout regions and the player area changes to a betting area. Each player gets a small copy of the central area where they can place their bets. It would have been possible to have everyone drag their bet out to the central area, but with a lot of players there could be finger collisions. We also would like to have the option to make all the bets private.

On this panel, the player selects one of the three chip sizes and then clicks on the guess/bet regions to place a bet. A bet can be moved from one column to another by dragging and also dragged off the area to clear the bet.

While the players are betting, the central area is showing the player’s guesses and the payouts and is being updated with their bets as they are made:

Continue reading “Wits and Wagers playable”

Wits and Wagers

After taking a few days to start up this blog, I am ready to go back to game development. The next game that I am going to convert for the touch table is Wits and Wagers.

Wits and Wagers is a casual trivia and betting game. A game consists of seven questions. After the question is read, all players secretly answer. All the questions have a numerical answer and the answers are sorted and placed on the betting table. All players then bet chips on the one or two ranges that they think are correct. The answer is read and the correct range is paid out, all other chips return to the bank except for two permanent chips per player.

It is a fun game where having knowledge of the trivia is not nearly as important as betting well. There are several things that make this a good option for conversion.

  • It is a popular game that is still getting a lot of plays.
  • Everyone acts at the same time when writing their answer and placing their bets.
  • Chip management when doing payouts is a bit of a pain.
  • We would like to be able to have hidden bets and an enforced time limit as options.

The one big problem with this conversion is that we don’t want to type in all the questions. Instead, the original questions from the game will be used and one player will read the question and push a “start round” button on the game.

William and I have already started work on the board layout. As usual, the space is tight. It is a seven player game and each player needs their own numeric keypad and betting table. Plus we need a lot of space in the middle to display the potentially large numeric answers and up to seven different player’s bets.

I am going to write this game with the Torque 2D engine. I am guessing that there wont be any additional C++ code required and that it can all be done in script.

Assistant to the Lounge-About

On the advice of a friend, I am starting a blog. I am well aware of how late I am joining the blogging scene. And I have very low expectations of the level of interest that the rest of the world will have in most of the things that I am doing.

However, the multi-touch table we just got is still a fairly new technology, and there may be some interest in our experiences with the hardware itself and our attempt to convert board games to play on it.

I have started this blog by creating a bunch of back-dated entries. These entries come from things that I have written on my web site, Facebook, and Google+. There are also some new entries that I created just for this blog.

I expect most of the entries to be about my programming projects and the multitouch table. But I will also create entries for trips that we take and other things that interest me.

The title of this blog comes from the business cards that William and I created when we left Solidyn. Lacking a “title” to fill in, William became the Lounge-About and taking a cue from “The Office,” I chose Assistant to the Lounge-About.

Practice Log published

The PracticeLog application has been released as freeware and the Android version is available on the Marketplace!

After using the program and app for a week and really enjoying the convenience, I have decided to  make it available to the public. In the unlikely scenario where this application becomes popular, I am worried that it may cause too much load on my web server. So I wanted to have some kind of potential revenue stream to offset this risk, but didn’t want to try to sell the software. So I have gone over to the dark side and added an ad to my Android App.

My first attempt to add the ad was a failure. I thought that I would use the Webkit GUI element to display an ad from my website. To that end I tried to setup Google AdWords but was rejected because the PracticeLog page had insufficient content. (At the time it wasn’t linked to the rest of my site). I know now that this isn’t the right way to put a Google ad in an Android App. The right way is AdMob. This is a free an painless system and they have an SDK that you add to the android app. (Note that you do have to be building the app with the latest version of the Android SDK to use AdMob.)

Putting the app onto the Android Marketplace was a bit of a pain. First you have to pay Google $25 for the privilege. This is a one-time fee to register as a developer, but it did make me hesitate, since I doubt I will ever make enough in ad revenue to pay for it. Then the app has to be digitally signed and you have to have perfectly sized screen shots and icons. This was all a hassle, especially through the slightly buggy VirtualBox VM.

Publishing the C# application was a little easier, the main hassle being adding it to various freeware sites. Fortunately, several of them accept .PAD files. This is a file that describes an application and the developer that the freeware sites can read to fill in their submission forms. It had been a long time since I had visited some of these sites, so I also took the time to let them know about the latest version of the MediaDB program.

So far I have 9 downloads and 7 users, 39 ad views, 0 ad clicks and so $0 in revenue. Of course it is still early and I am not really expecting this program to be very popular. Most people who are keeping a practice log are children who don’t have Android phones.

If it does become popular, I will add a “teacher” mode so that a teacher can have access to the practice logs of their students. The teacher could track their practice time and use the notes to assign tasks for the week.

You can get the C# application on my site: http://chadweisshaar.com/weissoft/practicelog and the Android app from the Marketplace.

Yacht Completed

William and I have completed the Yacht game.

It ended up being harder than I expected it to be (which seems to always be the case). There are a lot of different ways that the game can move forward – the timer, the user scoring, or the user saying that they are ready for the next roll. And keeping track of the state of the game and the players we messier than I expected.

I also had trouble organizing and designing my script code. The lack of an enforced structure made it difficult to decide what file/class/namespace would have each bit of logic. Between that and my lack of experience with the script language, I spent a lot of time looking for code and moving things around.

It was also somewhat difficult to get used to the more event and schedule driven game flow. For things to animate nicely, we needed to introduce delays where there normally wouldn’t be. For example, the game rolls the dice, the dice animate, then then game tells the players what the roll was and the player class unlocks the player GUI and displays the ready button. In application software, the dice wouldn’t be animating, and that would all be one flow of function calls. For the game, there had to be a scheduled delay between starting the dice animation and telling the players what the result of the roll was.

Space was also a more limiting factor than we thought it would be. On the 46″ 1920×1080 screen, the smallest button that the user can feel confident pushing on the first try is 32×32. To get things to fit, the scoring regions ended up being only 24 high.

Here is a screen shot of the completed game:

Touch table construction

The IR sensor for the touch table arrived today (Actually, it arrived Friday afternoon. FedEx failed to leave a note.) Here is a link to the product page at Mesa Mundi. This is the third post about the touch table. Here are the others: MultiTouch, Demo/TV

It came in a large tube:

The tube contained:

 

The four sides attach to each other with an HDMI plug and one corner has the USB cable. Once connected, the corners each have two screws to lock them together. It is powered through USB and is quite thin. We wont be using the included tape since we want the minimum spacing between the sensor and the TV. Overall, the assembly was simple.

The next step is to place the sensor on the TV, attach it to the computer and install the driver. After installing the driver, and rebooting the computer, the sensor was detected and the control panel allowed us to calibrate the screen.

We assembled the screen upstairs next to a bright window and the light was too high for the sensor. We found a setting in the control panel for bright light later, so it may have worked upstairs, but we had planned to set it up downstairs anyway, so we went ahead and moved it down.

Here is a picture of the current setup. Installing the software was also easy. The control panel has options for palm detection, speed vs accuracy, and lighting levels. The touch detections can be sent out as either TUIO events or windows events. The computer is currently running Windows Vista, which doesn’t support multitouch, so we haven’t tried that out yet. In windows mode the touches are converted to mouse clicks. In TUIO mode, we were able to get about 30 simultaneous touches registered.

A friend is planning to build a custom frame for the TV and sensor and we are eventually going to replace the PC with a laptop.

Hansa Teutonica – Update 1

There has been a lot of progress made on the Hansa Teutonica conversion. The model is done, though the testing has been pretty light. Many of the graphics have been created and the GUI code for interacting with the player is started.

Here is a small portion of the board. The cites, offices, roads and houses are all on. The roads are being built programatically based on a source and destination city and a source and destination direction vector. The board still needs to show the upgrades that can be gotten at some of the cities.

Here is the player board. This is for the active player. Inactive players wont have the buttons at the bottom. It still needs to show the cubes covering the non-upgraded ability levels.

Here is a code snippet of two functions that I wrote to try out the new C++ 11 features. They are both doing the same basic thing: Given the value of a member variable, find the object in a vector that matches that value. First, here is what it would have looked like before:

Item* Object::findItem(const string& itemAttribute)
{
  for ( vector<Object*>::iterator oIter = myItems.begin();
        oIter != myItems.end(); ++oIter )
  {
    if ( (*oIter)->attribute() == itemAttribute )
      return *oIter;
  }
  return nullptr;
}

Here is the same basic idea using the new “for each” syntax. Notice that it is much cleaner. And I don’t have to create the iterator variable at all. There are certainly cases where you are going to need the iterator, but this isn’t one of them.

City* Board::findCity(const string& name)
{
  for each ( City* city in myCities )
    if ( city->name() == name ) return city;
  return nullptr;
}

Finally, here is the version using lambda functions. I’d had high hopes for this approach and was a bit disappointed with the results. There are certainly cases for using lambda functions, but this isn’t really one of them. Though, if this were in a performance critical part of the code, the lambda function might be a bit faster. Also notice the use of the “auto” keyword to declare the iterator. This is another new feature, and is a great benefit. Using either of the two new approaches, I don’t have to know what kind of collection I have to use the collection.

Player* Board::findPlayer(const string& name)
{
  auto pIter =
    find_if(myPlayers.begin(), myPlayers.end(),
            [&name](Player* p){ return p->name() == name; });
  if ( pIter == myPlayers.end() ) return nullptr;
  else return *pIter;
}

Yacht

I have started a new project for the Touch table called Yacht. It is a public domain version of Yatzee. To take advantage of the multi touch screen, and to make the game faster, I am doing a “shared-dice” variant where all the players share the same die rolls. As a player locks/selects dice, they no longer use the shared roll of those die.

It is going to be eight player with each person having a score and dice region.

I am trying to pick a simple game in order to learn the Torque 2D scripting and game builder. The Hansa Teutonica project used Torque 2D as well, but William is handling all of the script and GUI parts. He has been using Torque for years and is going to help me learn the scripting sytems. He is also going to build the graphics that the game will use.