Category Archives: Sandbox

More Setup Over the Weekend

Played with some commercial motion capture software last Friday, more here.

I’ve upgraded most of my RPi machines to scratch and I believe I have the process of building OpenCV 4.0.1 on them to the point where it is reliable.

I have realized that I can’t push the full, unprocessed output of these webcams over the ethernet links. I’ll have to pre-process the data to reduce total size in order to make things work. Not sure whether the ARM CPUs have the necessary performance or not. I’ll have to look at this and see what I can see.

OPenCV Build on Ubuntu Worked

This time I pasted all of the pieces into a single shell script (instead of running it piecemeal) and things went smoothly. Still took a while, even on the Core-i5 system with an SSD and 32 GB of physical memory. I specifically pulled 4.0.1 from git rather than the default choice from the source of the instructions that built ‘master’.

Tonight I’ll have to write a bit of code to use the library and see if I can get streams of images programmatically from one or more of the webcams I’m working with.

At some point I may bump up the swap space on another of my RPi systems to see if the same script works there as well.

Working towards an OpenCV build on Ubuntu

Well…almost got OpenCV building on my main Ubuntu machine at home. I was copying fragments from the directions on the OpenCV site into an SSH session and clearly missed something along the way. I’ll have to build a single, large shell script up front next time and then run that. Unfortunately it seems as if (I may learn better later on) once CMake has done its magic, lots of things get baked into the files that drive the build in ways that really, really want a rebuild if things don’t go quite right.

I was working from the instructions here. (Other instructions here).

I was surprised to see that the github repo and contrib did not have a branch tag for release 4. It looks as if there’s a stable release out there, but 3.4 and master seemed like the available choices.

The main site clearly indicates that version 4 has been released with pre-built windows and ios downloads and documentation. I’m not sure currently how to pull that stable release code from git though.

I expect to take another run at the 4.0 build on Ubuntu tonight. Other than script grabbing issues, the build went smoothly…32 GB of memory and a Core-i5 CPU work better than an low-end ARM and 1 GB swapping on a micro-SD card.

Hmm…more github presence for version 4 here and here. Looks like OpenCV 4.0.1 is the latest. Ah…tags not branches here…need to look at pulling the appropriate tag for the build. Easy enough…just list the tags, find the 4.0.1 tag and check that out.

Bouncing Around a Bit Today

Building C++ supporting libraries on my small dev machine. Looking at another pass of C++/CLI work and some more thinking about motion capture options.

I’ve built zlib and bzlib2 yesterday. To get these building with VS 2017 I built them with their standard build procedures (which appeared to build 32 bit libraries) and then created visual studio 2017 projects to build the same pieces using fresh settings.

I’ve got boost, openssl, opencv and the mongodb c and c++ libraries on my list for today. The mongodb libraries are my primary target here though all of the above are of interest. This is also what is driving my CMake reading as several of these libraries use CMake for their builds.

I’m pretty interested in C++/CLI as a way to get access to C and C++ functionality from C#. Given the productivity that C# provides, access to C and C++ APIs and libraries from that environment would help quite a bit. My primary driver was access to the Win32 file ID API for some file management work, but Win32 APIs keep coming up now and again. I do need to take a look as some newer C# libraries that Malcolm suggested that may provide pre-packaged access here.

In the past, I’ve run into build issues when combining C# and C++/CLI in the same project. I expect this was setup issues so I’m now looking to take a more serious look at this.

The motion capture work will start out with OpenCV and getting my web cams running with code behind them to process the images. I’m thinking that pre-recording things and then post processing might be a good idea…using a light strobe to synchronize things could simplify time sync as well. Much to consider…

Next Steps

I’ve got boost, zlib and libbz2 built on boojum now. Next step will be to test the installs with a small program or two. Hoping that all went well and I have usable, native, win64 libraries available.

Once those have been checked out I’ll take another run at building the MongoDB drivers…this time on boojum rather than chaos. Boojum has a shorter history and is distinctly less cluttered than chaos so I’m hoping that this just works. Expecting less than that though…I’ll probably need to dig deeper into he CMake configs to get where I want to go. I’ll update as I move forward…now off to lunch though.

Looking at 3D location of Objects with Multiple Cameras

We tried doing some motion capture with a kinect 2 today. Results were mixed though less than ideal.

I am thinking of using OpenCV to acquire images and use them to register locations in three-space. I currently have two high quality cameras and a lower quality one to play with…I expect that if things go well I’ll likely pick up a third higher quality camera to work with along with some hard-mounts for them in the basement. Ideally I’d love to be able to code up some decent motion capture functionality using cameras and reference marks on limbs.

A bit of experimentation will be required in order to get there though.

I am wondering whether a faster, lower resolution webcam might do better for this. There are some $20.00 a piece cameras with USB-2 interface out there (Microsoft Lifecam-3000 or Logitech C270) instead of the higher-end, USB-3 autofocus Logitech C930e. Both wondering whether the lower resolution and USB-2 may provide a higher frame rate and whether fixed focus will stay consistent without periodic refocus hits.

Giving up on MongoDB from C++ for now

I’ve tried building this thing using CMake and Visual Studio and CMake seems to keep picking up cygwin headers for Visual Studio builds and I can’t seem to make things better. For now not worth the pain. I’m probably going back to C# with C++/CLI to get this working with C APIs and C# for MongoDB access.

I’m certain that I could get this building with enough effort. The code looks reasonable and I can put together the projects myself. I’m not all that inclined to go there though as I’d have to re-do this every time through. I’m not familiar enough with CMake to try modifying that part of the process.

Ok…not quite giving up. I did find that CMake appears to be adding a cygwin header folder to the projects. If I manually remove this from them the build goes further. The default build configuration appears to be 32 bit which is also an issue for me. Perhaps I’ll do a little more before I completely give up.

C++ MongoDB Driver Circles within Circles…

Looking at getting a bit of C++ file processing code done for some home sandbox tooling reasons. Grabbed the source code.

Source code asks for boost as a polyfill for C++ 2017 (optional and something else) with MSVC 2017. Grabbed boost. Got to build boost, really would like to build the full kit if I’m going to build it at all. Grabber zlib and libbz2. Now looking at any other dependencies needed to build a reasonably complete boost build locally.

Heading off to see the Captain Marvel movie and will continue with this (along with some presentation prep I need to do this weekend and some overflow work items I need to look into). Should be an interesting if busy weekend…

This is once again reminding me why C# and Java are so much more productive than C++ for many things. In C# I’d nuget the mongodb drivers. Up to date versions of any supporting libraries would be pulled in as needed and I’d be writing code in short order. I love C++ for its power and flexibility, but as a tool to get higher level logic in place it is not holding up well…

Add in building bjam to build boost with and then grabbing CMake to build the mongodb drivers with…making sure that the build processes find the right compiler (I’ve had at least one run where my build grabbed the g++ compiler out of the path even though the visual studio tools were there as well.

Unity Investigations…

I’ve been splitting my experiments with Unity between this blog and pandamallet.com (where I put ‘creative’ things.

More graphical content and thoughts on game design possibilities have lived on the creative side while more technical, C# coding and Unity script coding bits have lived here.

I’m going to move to keeping everything in one place for convenience and accessibility. From here on, I’m going to put all of the game programming related content on the creative side and keep my career blog for more directly coding related items and similar things.

As pandamallet.com does not share with linked-in at this time, this will mean that anyone who was watching these goings-on through linked-in notifications will need to pop over to pandamallet to see what’s up going forward. I will look at making sure that all of my sites (pandamallet, my main blog and my career blog) are publishing to my twitter feed when something new is added to make this (perhaps) a bit easier.

Unity Editor Activity and Digging Deeper

More after hours digging into Unity (slowed down by some necessary after hours work related items…probably going to continue for the balance of the week as we wrap up a tight sprint 🙂 ).

Cross Platform VR and Flat Display

I am coming to the conclusion that I need to dig deeper into the prefabs provided with the various VR SDKs that matter to me (daydream, vive and cardboard). It appears that the different vendors implemented their own event systems that aren’t necessarily interoperable. If we want to build code that plugs into any of these systems, we’ll need to address this.

I’m not currently sure how best to deal with this. Trying to build wrappers sounds nice for compatibility but has potential limitations. Changing the prefabs in-place provides more leverage but means potentially having to make the changes repeatedly as new versions appear with other features that we want. This won’t be resolved without some digging into the code and experimentation.

Unity Editing Support

I was recently playing with some asset generation scripting. Malcolm had commented that it would be nice to have a way to quickly create a room of any desired size with appropriate wall textures and texture scaling. I whipped up a very quick and simple script to take a wall, floor and ceiling prefab and build a complete room out of the set.

This worked quite nicely (though many details to be added such as the texture management) but had no visibility in the editor. You added an invisible GameObject to the scene, set its parameters and then when you ran the game you got a magically created room.

I was looking at the editor side options last night and it appears to be relatively straightforward to make the script do its thing in the editor as well as at game run time.

I’m going to play with some of this soon to see what I can put together. Being able to build more complicated, programmatically generated items in the editor would be a great capability to have available. Prefabs are fine for simple things but I’d rather have the option of generating a family of possible items from a script. Editor side visibility is a key part of making something like this useful.

Having fun playing with this stuff as work projects at the moment are in stabilization and thus mostly running down defects and back-filling missed requirements rather than building new architecture and the code to support it.

Unity and Multiple Platforms

I tried to get a single Unity project to build for multiple platforms over the weekend. The code I’m writing is probably best suited to a flat screen with mouse and keyboard quite honestly. That said, I’m interested in working with VR systems and thus intend it to run on the platforms that I have available. This gives me:

  • Flat screen with keyboard and mouse.
  • Google Daydream VR with Daydream controller.
  • HTC Vive with two Vive controllers
  • Possible Google cardboard with no controller (perhaps a game controller as a stretch?).

Multiple Platforms from One Project

Sam had run across a couple of projects that claimed to work across platforms last week and sent me a link. Over the weekend I pulled the projects down and ran them on the Daydream without problems. They were a bit awkward to use as neither of them used the daydream controller effectively (one seemed to be built as a cardboard app, using the sight axis for selection).

I took the project that had been targeted on the Daydream and re-targeted it to the PC with a Vive headset attached. I got errors (don’t have the exact form) that suggested that I needed to load the Steam VR SDK in order to make things work. In the end I loaded the SDK from the asset store. This did allow the Vive headset to connect but did not display the information panels that the project was designed to show. At that point I shelved the project…I’ll probably return at some point to look deeper into the implementation, but for now I’ve had enough.

Switching Platforms in a Project (the hard way)

Later in the weekend I tried simply creating a project with a few simple assets and adding in the two SDKs. I was able to get the Daydream up and running (tried that first) by making the usual additions to the scene for that SDK and setting up the platform. To get the Vive running I had to delete all of the Daydream items from the scene and add in the usual Vive content. That too worked as expected.

The surprise came when I switched back to Daydream again. I continued to get errors indicating that the Vive input mapper json file was missing. It appears that something Vive related was still attached to the project and looking for Vive specific assets. This is another area where I may dig deeper at some point. For the moment I’m moving on.

Modular and Layered

I did dig through a good bit of content over the weekend (both video and online blogs/documentation) that suggested Unity supports external code assemblies linked in. This leads me down the road to a more modular approach.

  • Provide multiple .NET core assemblies that aren’t Unity specific code to implement the ‘business logic’ of the game. This keeps the complex code (game rules, world generation and storage) and other such items in a place where they can be unit tested and managed as pure code assemblies.
  • Manage all Unity assets that aren’t target specific in free-standing packages that get bolted into a target specific frame at the last moment.
  • Build the SDK specific parts of the game as thin wrappers over these other assets. These will be asset packages and projects that contain only target specific items and user facing elements.

I’m going to head down this road next and try structuring a new version of my Cluster game to support this approach. I started coding up the game generation part on Sunday and will likely try bolting a version of that into a VR frame as soon as it is complete enough to be usable.