Game controller issues …

Control issues persisting with 3d rudder & leap motion for fine motorskills in gaming.

Primary issue is learning the controls.

Learning controls as well as instinctive keyboard mashing with no fine controls.

Example … when playing a tense game & surprised you naturally seize up slightly as you beginning frantically tapping the required keys – that reaction will in a system like 3d rudder will just send your character/vehicle spinning in place, breaking immersion & killing any fun as you die without control of the game.

Learning seems to be impeded without (traditionally) physical feedback or resistance to allow the user to feel via the legs (3drudder) or in the hands for the leapmotion.  Both controllers are currently in the gimmick stage unless a user commits serious time to unlearning their normal keyboard controls and learning new reflexive motions.

To explain this more fully …

Several scenarios exist for movement.  Each requiring their own set of motions to satisfy the in game movement controls.

  • Micro adjustments
    • At rest doing fine controls
      • turning
      • advancing incrementally – like inching forward or back
  • Dealing with rate of change increase or decrease
    • mid range speeds if the game as them
      • toggle speed modes walk/run/scope up
      • throttle style speeds based on percent of pushing control

Solutions to the training issue?

On the physical side, we

Leap motion or other body scanning-style or non-physical controllers

  • I’ve taken to using a large hard surface mouse pad/plate to hold the leap motion controller, with taped down lines of where the sensitivity boundaries are
    • this requires a player to look down at the desk occasionally
    • the leapmotion plate be within peripheral vision with the arm be farther forward & strains nature body posture, can’t do it long without being
    • both options break game immersion experience
  • Visual
    • Overlays of the game
      • Gamewave provides out of bounds feedback in it’s app
      • perhaps copying this into an existing gaming program with an overlay
        • mumble uses overwolf, ts3
        • windows 8 & 10 have built in overlay in windowed mode for xbox – must have a UI hook I could build for
    • if not done right this could break immersion too
    • 2nd screen on computer running visual feedback
  • Vibrating haptic feed back on the hand / wrist / arm
    • any smart watch with blue tooth can sync an app
      • sense boundaries setup by devices on desk
        • nfc?
        • lower level protocol?
  • Sound feedback
    • low grade tones
    • voice assistant
      • Halo type voice
      • i18n implementation to setup voice mapping
      • voiceattack style bindings
    • Directly interferes with game sound, hard break in immersion

3D Rudder

  • Physical feedback
    • A foam pad to add resistance?
      • Maybe two levels of resistance
  • gyros already exist
    • figure out an overlay option like in the visual section of the Leap Motion
Advertisements

Testing ideas

Doing more Ruby on Rails today.

For ensuring data is good …

Anyone ever try using a scope to drop bad results and streamline view presentation?

Then just show the malformed entries on a different view where it doesn’t bork everything up?

Example I hit …

- if pet.user_detail 
  %td= pet.user_detail.name 
- else 
  %td= "Crap"

Revealed I had a single bad piece of data in my test results.

I’ve been playing around with rescue strategies etc for a year when something is missing.

Something like this guy does, though I used another’s idea last year … Link

Having struggled with this several times, I am considering the viability of a scope or series of them that presents only data that is valid & present.  Something tells me there is probably a better way in code to do this, but the “If you absolutely & completely must be sure nothing should get to the view unless the record is good…” part of me is going “HRRRRMM”.

From time as a database admin, I would solve this issue in the DB, as a well formed one would have checks against bad data, but from a coders perspective there are more tools available and the database won’t always know what constitutes good data.

NFC collector page

The near field communication (NFC) was hitting back in 2012.

I lost the last of my chips during my move, after donating two or three to the household I left.  We left them at the door to toggle at home mode (power settings off, WIFI on + password, toggle off cell data, notification volumes & settings, screen brightness, pair to wireless home speakers).

Some setup stuff as I get ready to order new ones.

  • Using trigger to toggle stuff – Link – perhaps the easiest way
  • Basic how to do NFC tags – Link
  • Android programming phone to toggle your wireless (you can set it to change multiple things at once with a single scan too) – Link
  • Android Apps for programming NFC chips – Link
There are pre-formatted & not formatted types of tags - so read before you buy to same some hassle!
Also, these cards do have 10,000 write limits generally - which you should never hit, but can be circumvented by assigning unique id

So I’m in the process of looking to order new ones.  My considerations …

  • I prefer already formatted NFC cards, as less steps to get setup
  • I like the stickers on the back, though I have some 3M double tape
  • Last time I used uses harder plastic ones with sticky backs – Link
    • Was very happy with them
      • PVC harder to wear out
      • Sticky back side
      • Con,  30% more, which is a big for my project when I might be ordering 10 cards per kid & some spares for ~100 cards
  • App Inventor NFC reader by MIT – Link
  • Trading card game simulation
    • There are some that are size of trading cards with blank surfaces – Link
      • The cards are either 7×5″ or 3×2″
      • 67 cents / card or 62 cents for smaller circles
    • I could shove in sleeves with little pre-printed designs or just use a bubblejet on clear trading card sleeves.
    • Might be safer legally to have the kids just print their own designs on paper, cut them out & then fold them to make the sleeves
  • Adventure game
    • Each card is an action or each card is a direction?

leap motion – 12/31/17

More research in leapmotion

My calibration painting isn’t working … there are two issues …

First it goes up to 30ish then resets the count to 0 instantly.   Second it seems that after like 20 or 30 seconds the paint strokes start to be forgotten.  I’m over 20 checks of 2 – 3 minutes a piece.

My only thoughts are what if it’s a memory issue, but I’m running 12gigs with only ~3gig used.

Tried …

  • everything on official documentation & trouble shooting
    • wiping screen
    • lights (see below)
    • distance from screen (see below)
    • glossy desktop
    • the newer version auto disables the reading stream during calibration, but I checked it everytime after the first 12 tests.
  • lights
    • on / off
    • 20 watt bulbs behind me
    • single bulb behind the monitor
    • bright bulbs with a sheet between myself & computer
  • motion
    • left/right
    • up/down
    • clockwise / counter clockwise circles
    • 8 combinations of the above
  • distance
    • 4″ away
    • 2″ away like guide on tomshardware said instead of 4″ like guide says

Then of course i did various lighting schemes along with combining different types of motions & distances.

Notes on Xpath / XML with css

Xpath adventures!

I was using a chunk of code that I found to be rather brittle for testing Xpath with Capybara in a ruby on rails integration test.  Originally I was just calling click_link on the first link within the .body tag.

The problem is that’s really brittle.  Any other links put in there before that will mess up the process.  Also, if I make that page a partial so I can reuse that particular list on other pages, then my test is broken.

So my practice now is to add a class or div to the top of all partials or pages even if I have the body & nothing else is in that page.

An example:

The partial _campaign.html.haml would have a .campaigns at the top wrapping it.  Then my html/css parsing with Xpath would be `.campaigns` to get into the section of the list I want to affect.

For my purposes that’s enough.  If you want to go deeper though – as you have more elements inside & need to be selective, then you would add more path hierarchy … .campaigns/.list-group/.list-group-item[1] … with the last [1] being select the first item in the list group.

Xpath best practices is to not stack too many or any nested items so they use within.  Still, probably best to only use two within‘s one to grab the first unique class/div name & the next to grab the last div or element before running the method against the result.

  • Instead the previous campaigns example, using the within would be combined with something else….
within('.campaigns') do
  first('.list-group-item').click_link('Join') 
end

Also, as a bonus I had to figure out the calls for using spaces in the names/titles.  There are two methods I like.

  • Exact matching with “multiple class selectors”… .something/.something_else – Link.
  • Matching Xpath to just search a string for a partial match with the xml/css  – Link.  I would still scope the search/match pattern (2nd method) by using a .within anyways as the whole point is avoiding brittle tests.

First time unity video game development Tic Tac Toe

Doing the Unity3D engine for video game development.  Link

I’m an hour & a half in now … just about to implement the win conditions on the Tic Tac Toe tutorial.

  • Explanation of the UI behaviors from Unity professionals – Link – not necessary for the Tic Tac Toe demo – would skip till later if you like to move fast, as it’s not needed for simple games.
  • Tic Tac Toe game tutorial using UI only – some limited scripting – Link
    • UY studio’s – Computer read version of the tutorial with mouse demo’ing where to click & explain several necessary items. – Link

 


First 20 watched & read ahead of demo on the UI behaviors

Next hour – followed along with the youtube link by automated reading voice to get a board fleshed out & some of the Game Controller scripts.

Next half hour – followed along with UY Studio’s to create scripting for GameEngine in 3 videos.

Next half hour – made my own C# script to simplify the end game checks (as they looked scary) …

void check3InRow(string button1, string button2, string button3)
 {
  if (button1 == button2 && button1 == button3)
   {
    if (playerSide == button1)
     {
      GameOver();
     }
   }
 }

I then fed in the win conditions with this chunk of code …

public void EndTurn()
 {
 /* Test row wins */
 check3InRow(buttonList[1].text, buttonList[2].text, buttonList[3].text);
 check3InRow(buttonList[0].text, buttonList[4].text, buttonList[8].text);
 check3InRow(buttonList[5].text, buttonList[6].text, buttonList[7].text);

/* Test column wins */
 check3InRow(buttonList[1].text, buttonList[7].text, buttonList[8].text);
 check3InRow(buttonList[0].text, buttonList[2].text, buttonList[6].text);
 check3InRow(buttonList[3].text, buttonList[4].text, buttonList[5].text);

/* Test diagnal wins */
 check3InRow(buttonList[0].text, buttonList[1].text, buttonList[5].text);
 check3InRow(buttonList[0].text, buttonList[3].text, buttonList[7].text);
 }

Next 10 minutes researching.

Finding the class based on an object instance of the object in Rails with Constantize

Trying to write a rails method to count the rows in a table.

The twist:  I want to do it in such a way that I can call the method from any object and it will automatically determine the name of the table to count the rows from.

Basic outline of the flow … I want to use Rails Way to identify the table & count the resulting table name’s rows.

Model.count

To do so I need the name of the model.  As my test object, I cleverly naming it anObject

2.3.1 :040 > anObject = Player.first
 Player Load (2.4ms) SELECT "players".* FROM "players" ORDER BY "players"."id" ASC LIMIT $1 [["LIMIT", 1]]
 => #<Player id: 1, screenname: "Serena Mitchell I", motto: "Wyaaaaaa.", country_id: nil, created_at: "2017-09-01 12:52:27", updated_at: "2017-09-01 12:52:27">

Rails has several definitions which hold that information in various states.  I chose to use .class …

2.3.1 :043 > anObject.class
 => Player(id: integer, screenname: string, motto: string, country_id: integer, created_at: datetime, updated_at: datetime)

When we look at this, it’s more information than we need.    The Rails Way is to call the .name method out of the class method …

2.3.1 :046 > anObject.class.name
 => "Player"

As a bonus .name gives us access to .constantize which is the goal.

2.3.1 :048 > anObject.class.name.constantize
 => Player(id: integer, screenname: string, motto: string, country_id: integer, created_at: datetime, updated_at: datetime)

Now we can put .constantize to search all the Rails app’s constants …

2.3.1 :050 > anObject.class.name.constantize
 => Player(id: integer, screenname: string, motto: string, country_id: integer, created_at: datetime, updated_at: datetime)

… which when proceeded by the .class.name will give the activerecord model as an object which we can then .count against …

2.3.1 :052 > anObject.class.name.constantize.count
 (0.8ms) SELECT COUNT(*) FROM "players"
 => 46

At this point .class.name.constantize should net us what we need, so I wrap it in a method for easy reuse …

#  gets name of constant to get a count of model
def row_count(ar_object)
  ar_object.class.name.constantize.count
end

This of course isn’t perfect, if ever you had an conflict in the naming scheme, scope issues or an orphaned object from the inheritance tree, the .constantize search up the object inheritance tree would fail even though your object exists.

Note there is another way, that if you are only doing ActiveRecord objects works too … Link.  My example is slightly more generic example as you can use it to find other types of objectives – though you can’t use the count method with most of them.

The reason you would use it, is that it’s more self documenting, thus more in line with the Rails Way ….

# .model_name.name is basically the same as .class.name for this purpose
ar_object.model_name.name.constantize.count

My studies from other authors which I found helpful, in no particular order …

  • Failure points & discussions for constantize – Link
  • Implementing in a custom module from Stackoverflow – Link
  • Implementing the constantize lookup in depth & use – Link
  • Safelty constantize in forms, aka don’t – Link
  • Metaprogramming & testing with constantize – Link