Unity Next Steps

I’m realizing that once I have my star-field created, I need to figure out how best to run the mouse with a conventional mouse pointer and do hit-testing in the scene. I want to let the user click on a star and then quickly zoom in to a close-up of the star that shows its planets in some detail and any vessels that are in the system.

I’m hoping this is easy to do. It is a bit at odds with most action games, but crucial to any sort of interactive user interface created for the user.

I also hope to put up text floating near the graphical elements to add more information about them. This will include the number of ships of a given type in system, the relevant attributes of each planet and any items located on the planet. I’d like to use floating text with a transparent background and a contrasting outer edge (to ensure visibility even if something unexpected is in the background).

Looking at building a simple game with unity

I’m looking at building a game similar to stellar conquest (without borrowing any copyrighted content) using unity and then setting up a multiplayer capability through an internet connection (likely my hosting with some PHP persisting moves to a MySQL database).

I’ve got the basics figured out for laying out the playing surface and it looks as if prefabs work for creating stars, planets and ships. I can see how the player interface would work in VR (either room scale or three axis) but I’m going to have to dig in to work out hit-testing for on-screen mouse activity.

I’m going to be thinking about how to handle star generation. The game that is providing the inspiration used a fixed map with the star located at mostly symmetrical positions. I’m inclined to have my game place the stars using a random number generator but with a defined distribution of star types to ensure some level of balance.

I’m going to do the same sort of thing for planets…not cards from a deck as with the board game but again, randomized with appropriate probabilities to yield the right sorts of planet mix.

I think the next step is probably to build the star cluster and scatter some colored lights about through space…I’m really tempted to go with a three dimensional star cluster for the final version if VR is the main target.

Playing with Python

I was playing with Python a bit more over the weekend. It is a serviceable language but I am persistently amused/irritated by a few things.

The python 2/3 breaking incompatibility split seems to be persistent, entrenched and troubling. It appears that the .NET and java ports (jython and iron python) have still not made the transition to python 3. The cython baseline and web site are now confidently stating that python 3 is the present and python 2 is the past, yet I’d expect that if that were really true, the other python implementations would at least support python 3 and ideally would have the same position with regards to python 2.

I was watching a video discussing some python features and they mocked the curly brace languages for having religious wars about where to put the braces. I have a general aversion to using white space (a very poorly conserved type of text) for block scoping as far too many tools consider spaces and tabs to be adjustable and interchangeable. The thing I find amusing here is that I’ve seen far more friction in the python community between use of spaces or tabs and how many spaces per indent level than I’ve ever seen around the placement of curly braces.

I do expect to replace perl with python for various places and the OpenCV support looks quite interesting. I think that in time the style issues will feel less foreign and I very much hope that the 2/3 split will be dealt with in the overall community as JVM and CLR versions of the engine that implement a non-obsolete version of the language would be very nice to have.

More adventures with C++/CLI

I’ve been working with C++/CLI to get access to native API functionality from C# some more lately. I’ve been running into cases where something compiles flawlessly when I create the project but then fails miserably when pulled from GIT clean and rebuilt. I’m looking at various build issues that might be contributing to this and will hopefully find the right recipe soon.

Some notes here related to parts that matter and APIs that I’m looking to use…half of this for my own reference as I mess with solutions to see what works:

Marshaling strings the (relatively) easy way:

 #include <msclr/marshal.h>

System::String^ myPath = "ABC";
std::wstring path = msclr::interop::marshal_as(myPath);

File information:

typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO, *PFILE_ID_INFO;

FILE_ID_INFO info;

BOOL ok = GetFileInformationByHandleEx(myHandle, FileIdInfo, &info, sizeof(info));

Alternate string marshaling:

inline void MarshalString(String ^ s, std::wstring& os) {
using namespace Runtime::InteropServices;
const wchar_t* chars =
(const wchar_t)Marshal::StringToHGlobalUni(s)).ToPointer();
os = chars;
Marshal::FreeHGlobal(IntPtr((void)chars));
}

Volume information:

BOOL ok = GetVolumeInformationW(path.c_str(),
volumeNameBuffer, MAX_PATH + 1,
&serial,
&pathLength,
&flags,
filesSystemName, MAX_PATH + 1);

File attributes (can be used on c:\ to find things like volume creation time stamp)

WIN32_FILE_ATTRIBUTE_DATA info;     
BOOL ok(GetFileAttributesExW(path.c_str(),
  GetFileExInfoStandard,
static_cast<void *>(&info)));

creationDate = gcnew System::DateTime((long long)(info.ftCreationTime.dwLowDateTime) | ((long long)(info.ftCreationTime.dwHighDateTime) << 32));

Additional volume information:

    wchar_t volumeName[1024];     wchar_t fsName[1024];     DWORD vsn;     DWORD fsflags;     BOOL ok(GetVolumeInformationW(path.c_str(),         volumeName, 1024,         &vsn,         nullptr,         &fsflags,         fsName, 1024));

and

    ULARGE_INTEGER free;     ULARGE_INTEGER total;     ULARGE_INTEGER totalfree;     BOOL ok(GetDiskFreeSpaceExW(path.c_str(), &free, &total, &totalfree));

and basic info

FILE_BASIC_INFO info;
BOOL ok(GetFileInformationByHandleEx(handle, FileBasicInfo, static_cast(&info), sizeof(info)));

Busy week and weekend

…of work related C# and java code. Things stay busy and old projects need additional work as changes happen.

Spent a good chunk of the weekend and several nights last week making sure that work priorities were attended to.

Less fun than messing with sandbox projects, but work does generally come first at the end of the day. Toy projects can slip schedules almost indefinitely…

Started adding mongodb support to C# code

I started adding in concrete MongoDB support to the tool code I’m building. Last night I incorporated the drivers into the solution and set up the connection code for the database. My initial attempt to directly use the C++/CLI object to push a record into the database failed but I expect to add a class that is properly serializable to BSON tonight and get volume information persistence working. I still need to get a better handle on updates in MongoDB. I know there are various sorts of atomic test and set sorts of operations on documents and in order to make this work properly with concurrent access, I need to understand those operations and use them to ensure that updates don’t ‘walk’ on themselves.

When I have a bit more time to type, I’ll add in more details on the MongoDB driver work and the approaches I’m using.

Looking forward to 2019

Well, 2018 was a bit tumultuous. Lots of high points and a similar number of disappointments. I feel as if I’m ending this year about even with where I began it. Some wins, some losses, mostly evening out overall.

Hoping for more from the year coming up. The gyrations of the previous year have helped to shake out some things that needed shaking out. Expectations are set more reasonably and I think the coming year will move more steadily forward along a less erratic course.

I’m expecting a productive year with things better squared away and the path forward clearer that it has been for some time. Lots to get to…much of it potentially exciting.

This last year I wrapped up the program I had been running as software lead. Lots of C#, WPF and Angular running medical robotics with a team of three software engineers working for me. Since that rolled to a successful close I’ve been filling as as an individual contributor on a Java based instrumentation program. Hoping that the new year will bring in a new challenge as this program is wrapped up and handed off. Plenty of challenges to tackle and lots of diversity in the work ahead.

I’m looking to get my RapRap build rolling on the home front. I’ve had most of the relevant electronics around for some time but have always had other priorities bumping work on the 3D printer aside. This year I have friends who are willing to help out with the build and my basement work-bench cleared and ready for action. I’ll need to order parts and run through the build process, but I expect that things will go more smoothly at this point than they have in some time.

I’ve spent a chunk of time over the KMC holiday break (KMC usually keeps enough scheduled holidays in reserve to shut down for the week between Christmas and New Years) getting some progress on file management tools I’ve been playing with for some time. Hoping this time that I’ll get some completed tools running to assist in managing the current sprawl of files on my machines here.

I’m also hoping to get around to some real VR coding this year. I’ve had an HTC Vive here for some time. This year its time to lay down some code and play with this thing’s capabilities in a real way. I expect Unity will likely be a reasonable platform to build things on. I’m also expecting to put more time into learning blender and improving my drawing skills to support the effort. Time will tell where this might go, but there’s plenty to play with.

I’ve poked at VHDL a bit over the last year. I have a break-out board with a Xilinx FPGA on it in my drawer here. I’m not sure whether any more work on this front will happen this year as I expect other priorities to dominate…but again, time will tell.

I also expect to get back to doing more photography. I’ve fallen out of the habit of taking pictures just for the sake of making pretty shots. I need to spend a bit more time in the coming year making art in addition to building code and learning tools…need to find a balance here as with all things.

Monday, Dec 10, 2018

Trying to get back on track with sandbox work at home.

I’m taking another run at the tool for archive management and de-duplication processing that has been on the plate for some time. This tool wants to read files, determine uniqueness of files (based on content) and maintain an index (likely in MongoDB) of files that have been scanned and are expected to exist. I’m writing things in C# mostly. The current user interface approach involves WPF but may also make use of ASP.NET (probably core) at some point. Looking to solve a problem and play with some coding tools on this front.

I’ve got better versions of my interop C++/CLI code to provide access to Win32 volume and file information functions in place and tested. I have not yet pushed these up to github as they’re still just free-standing code without anything to actively run them.

I’m expecting to put in place some more helper code shortly and then build out a simple WPF interface to run things. I also want/need to build a more capable MongoDB back end to hold file scan results as part of the process,

Holidays are a busy time…

Haven’t gotten much done on a technical front (aside from work items) in a while as other things have been dominating my time (partly work there as well).

Really going to have to get the RepRap work going once the workbench in the basement is cleared for real work (one of the areas that is taking time…cleaning the basement). Also been doing a quick emacs-lisp refresher as I’d like to get some things done on that front.

I did drag the intuos tablet down to the living room. I hope to find time to do some drawing and blender work here and there soon as that is less time consuming and can be done in small bits. I need to locate my corel painter install files and get that package on the living-room NUC. I suspect that responsiveness may be better there than on the big machine in my office too.

VirtualBox supports multiple monitors…

I’ve been using VirtualBox pretty heavily to partition things out on my systems where some tasks require setups that clash at the OS level.

I generally find multiple monitors to be exceptionally helpful in software development settings. I’ve been running with my Virtual Box VMs on one monitor and using the other monitors for host OS based windows…and this has worked pretty well.

This morning I decided to take a look at the configuration settings for my main VM and to my delight I found that it is possible to configure additional monitors and place them on the desktop. This should streamline things when developing on a VM as it allows me to keep my IDE full screen on one screen while using a second for other activities.

Now if I can only figure out how to make Docker and Virtual Box live together in harmony at home (Docker wants Hyper-V while Virtual Box can’t run under that hypervisor) I’ll be feeling pretty happy.