Author Topic: Virtual Reality?  (Read 6230 times)

0 Members and 1 Guest are viewing this topic.

Offline Kiloku

  • 27
  • Buzzbuzz!
    • Minecraft
I'm aware that this has been discussed in the past (specifically with Oculus), but the thread seems dead. I've been wondering what's the state of implementing VR into FSO. It seems people liked the idea but then no one developed it.
Is it even possible to adapt the FSO engine to work with it?
Potato!

 

Offline Swifty

  • 210
  • I reject your fantasy & substitute my own
I was planning on getting an Oculus Rift devkit myself but Zacam said that he'd be able to get one for us au gratis. However, I haven't really heard anything from that.

Whatever, I may just borrow the one that's at work and develop on that. So yes, there are plans. It's just there are some logistical issues.

 
Meanwhile, headtracking (Using TrackIR) is in and works just fine.  It's a good step in the right direction.

  

Offline swashmebuckle

  • 210
  • Das Lied von der Turd
    • The Perfect Band
Speaking of Track IR, has anyone checked out Linuxtrack? For non-windows users who want to join the head bobbing party :nervous:

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Can OR plug into TrackIR interface? That could probably help with the head tracking part.

 

Offline Eli2

  • 26
Speaking of Track IR, has anyone checked out Linuxtrack? For non-windows users who want to join the head bobbing party :nervous:

I implemented it a while back but never got around to clean it up and get it upstream.
Ill see if i can dig up the old code.

 

Offline niffiwan

  • 211
  • Eluder Class
Speaking of Track IR, has anyone checked out Linuxtrack? For non-windows users who want to join the head bobbing party :nervous:

I implemented it a while back but never got around to clean it up and get it upstream.
Ill see if i can dig up the old code.

Oooooh. Let me know how you go with this, or if want some help :D
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 
Speaking of Track IR, has anyone checked out Linuxtrack? For non-windows users who want to join the head bobbing party :nervous:

I implemented it a while back but never got around to clean it up and get it upstream.
Ill see if i can dig up the old code.

I'd be super happy to help test, if needed.  Linux gaming needs some love.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Can OR plug into TrackIR interface? That could probably help with the head tracking part.

i think there are utilities for those that can emulate trackir or some other api. seems like the freetrack api is compatible with everything too (also very easy to implement).

if you are going to do linuxtrack you might as well do freetrack as well (in addition to the trackir api) and maximize compatibility. now that there are myriads of devices that get head tracking data into the game.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
A better FaceTrackNoIR support would be nice, too. I've tried using it, but found it impossible to configure for FS (though perhaps I was doing it wrong). Maybe I'd give it another shot if it's workings were improved.

 

Offline Eli2

  • 26
I can't find the code so i suppose it's gone.

 

Offline m!m

  • 211
A better FaceTrackNoIR support would be nice, too. I've tried using it, but found it impossible to configure for FS (though perhaps I was doing it wrong). Maybe I'd give it another shot if it's workings were improved.
Just tried it and it worked surprisingly well, I didn't even need to modify the code. I wanted to take a look at the FreeTrack API but I can't find any information on it, does anyone know where I could find that?

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
well heres a lua implementation:

Code: [Select]
--use alien to import functions
require("alien")

--handle dll name and pathing
local ftLibPath = "C:\Program Files (x86)\FreeTrack\"
local ftLibName = "FreeTrackClient"
local ftLibExt = "dll"

--get a handle on the dll
local ftLib = alien.load(ftLibPath..ftLibName.."."..ftLibExt)

--export functions
ftLib.FTGetData:types{ ret = "byte", "pointer" }
ftLib.FTGetDllVersion:types{ ret = "string" }
ftLib.FTReportName:types{ ret = "void", "int" }
ftLib.FTProvider:types{ ret = "string" }

--output struct
local FreeTrackData = alien.defstruct{
   {"dataID", "ulong"},
   {"camWidth", "long"},
   {"camHeight", "long"},
   {"yaw", "float"},
   {"pitch", "float"},
   {"roll", "float"},
   {"x", "float"},
   {"y", "float"},
   {"z", "float"},
   {"rawYaw", "float"},
   {"rawPitch", "float"},
   {"rawRoll", "float"},
   {"rawX", "float"},
   {"rawY", "float"},
   {"rawZ", "float"},
   {"x1", "float"},
   {"y1", "float"},
   {"x2", "float"},
   {"y2", "float"},
   {"x3", "float"},
   {"y3", "float"},
   {"x4", "float"},
   {"y4", "float"}
}

--create a structure
local ftData = FreeTrackData:new()
--loop forever
while true do
   --some strings
   print(ftLib.FTProvider())
   print(ftLib.FTGetDllVersion())
   --not sure what this does at all
   ftLib.FTReportName(453)
   --update the struct
   ftLib.FTGetData(ftData())
   --use values
   print(" Pitch: "..ftData.pitch)
   print(" Yaw:   "..ftData.yaw)
   print(" Roll:  "..ftData.roll)
   print(" X:     "..ftData.x)
   print(" Y:     "..ftData.y)
   print(" Z:     "..ftData.z)
   print("")
end

i did get a c version to work but im having trouble finding it.

found it. this is the version that comes with freetrack, except its been fixed up so it works instead of crashing.

Code: [Select]

/************************************************************************
*    freetrack_c_interface.c
*   
*  A simple command line application which reads the data from FreeTrack
*    using the FreeTrackClient.dll interface.
*
*    Assumes that a copy of the FreeTrackClient.dll is in the same folder,
*    thought this does not necessarily have to be the same folder as the
*    FreeTrack application itself.
*
*    Based on code from http://en.wikipedia.org/wiki/Dynamic-link_library
*
*    Alastair Moore, December 2007
*
************************************************************************/

//#include <iostream>
//#include <tchar.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>

typedef struct
{
    unsigned long int dataID;
    long int camWidth;
    long int camHeight;

    float yaw;
    float pitch;
    float roll;
    float x;
    float y;
    float z;

    float rawyaw;
    float rawpitch;
    float rawroll;
    float rawx;
    float rawy;
    float rawz;

    float x1;
    float y1;
    float x2;
    float y2;
    float x3;
    float y3;
    float x4;
    float y4;
}FreeTrackData;

// DLL function signatures
// These match those given in FTTypes.pas
// WINAPI is macro for __stdcall defined somewhere in the depths of windows.h
typedef bool (WINAPI *importGetData)(FreeTrackData * data);
typedef char *(WINAPI *importGetDllVersion)(void);
typedef void (WINAPI *importReportID)(int name);
typedef char *(WINAPI *importProvider)(void);


int main(int argc, char **argv)
{
        //declare imported function pointers
       importGetData getData;
        importGetDllVersion getDllVersion;
        importReportID    reportID;
        importProvider provider;

        // create variables for exchanging data with the dll
       FreeTrackData data;
        FreeTrackData *pData;
        pData = &data;
        char *pDllVersion;
        int name = 453;
        char *pProvider;


       // Load DLL file
       HINSTANCE hinstLib = LoadLibrary("FreeTrackClient.dll");
       if (hinstLib == NULL) {
               printf("ERROR: unable to load DLL\n");
               return 1;
       }
        else
        {
            printf("dll loaded\n");
        }

       // Get function pointers
       getData = (importGetData)GetProcAddress(hinstLib, "FTGetData");
        getDllVersion = (importGetDllVersion)GetProcAddress(hinstLib, "FTGetDllVersion");
        reportID = (importReportID)GetProcAddress(hinstLib, "FTReportName");
        provider = (importProvider)GetProcAddress(hinstLib, "FTProvider");

        // Check they are valid
       if (getData == NULL) {
               printf("ERROR: unable to find 'FTGetData' function\n");
              FreeLibrary(hinstLib);
               return 1;
       }
        if (getDllVersion == NULL){
                printf("ERROR: unable to find 'FTGetDllVersion' function\n");
              FreeLibrary(hinstLib);
               return 1;
        }
        if (reportID == NULL){
                printf("ERROR: unable to find 'FTReportID' function\n");
              FreeLibrary(hinstLib);
               return 1;
        }
        if (reportID == NULL){
                printf("ERROR: unable to find 'FTProvider' function\n");
              FreeLibrary(hinstLib);
               return 1;
        }

        //    Print the address of each function
        printf("FTGetData is at address: 0x%x\n",getData);
        printf("FTGetDllVersion is at address: 0x%x\n",getDllVersion);
        printf("FTReportID is at address: 0x%x\n",reportID);
        printf("FTProvider is at address: 0x%x\n",provider);

        //    Call each function and display result
        pDllVersion = getDllVersion();
        printf("Dll Version: %s\n", pDllVersion);

        pProvider = provider();
        printf("Provider: %s\n", pProvider);
       
        reportID(name);    //not sure what this does - I guess it tells the dll that I am using it.
       
        system("pause"); //wait till keyboard is pressed before entering main loop
        while( kbhit() != 1)
        {
            system("cls"); //clear screen
            if (getData(pData))
            {
                printf("Record ID: %d\n" , data.dataID);
                printf("Yaw: %5.2f\n" , data.yaw );
                printf("Pitch: %5.2f\n" , data.pitch );
                printf("Roll: %5.2f\n" , data.roll );
                printf("X: %5.2f\n" , data.x );
                printf("Y: %5.2f\n" , data.y );
                printf("Z: %5.2f\n" , data.z );
            }
            else
            {
                printf("Nothing returned from getData\n");
                //break;
            }
        }

       // Unload DLL file
       FreeLibrary(hinstLib);

        return 0;
}
« Last Edit: May 03, 2014, 05:37:14 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline m!m

  • 211
Thanks, maybe I can get around to implement it as an alternative to TrackIR.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
A better FaceTrackNoIR support would be nice, too. I've tried using it, but found it impossible to configure for FS (though perhaps I was doing it wrong). Maybe I'd give it another shot if it's workings were improved.
Just tried it and it worked surprisingly well, I didn't even need to modify the code. I wanted to take a look at the FreeTrack API but I can't find any information on it, does anyone know where I could find that?
Could you share your settings? If it does, in fact, work, I might try it again.

 

Offline m!m

  • 211
I'm not sure if that is all but I attached my default.ini which I have tested with Diaspora. Currently FSO does not use the head displacement data but that was an easy fix although the movement is a bit weird.

[attachment deleted by an evil time traveler]

 

Offline m!m

  • 211
I implemented support for FreeTrack and also made the interface as generic as possible so adding support for linux via something like linux-track later will be very easy. You can take a look at the code here: https://github.com/asarium/fs2open.github.com/tree/feature/freetrack