Jump to content

steve2112

Members
  • Posts

    181
  • Joined

  • Last visited

Everything posted by steve2112

  1. i copied the su-27 fly under bridges .mz into my missions to see what what going on, but i can't see indication about where that green fly thru box comes from. there doesn't seem to be anything connected to the waypoints and no other items in the item list that i can see. any ideas anyone? oh, i just found another thread about it http://forums.eagle.ru/showthread.php?t=144460 although i still don't know what to do but i'll reply on there
  2. oh, i see what's going on. so my mission will only work in DCS 1.2 and 1.5 right. ok. anyhow, i updated it to use an su-27 which i think is a better plane for my needs, better HUD anyhow. by the fundamental problem is AI will not do exactly as the waypoints command. and i doubt there is a fix for that? as005.miz
  3. i got the reference, BB is one of my all time fav shows.
  4. i don't have NTTR (it's on my shopping list, looks great) but i did create it in 1.5 ME. is that the problem? and how would i fix that?
  5. i found what should be a better way LoGetSelfData(), but its not working package.path = package.path..";.\\LuaSocket\\?.lua" package.cpath = package.cpath..";.\\LuaSocket\\?.dll" socket = require("socket") ipaddr = "239.255.50.10" port = 5010 -- Lua Export Functions function LuaExportStart() conn = socket.udp() conn:settimeout(0) end function LuaExportStop() socket.try(conn:close()) end function LuaExportBeforeNextFrame() LoSetCommand(1032) -- iCommandThrottleIncrease end function LuaExportAfterNextFrame() socket.try(conn:sendto("hello from DCS", ipaddr , port)) local altBar = LoGetAltitudeAboveSeaLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local tas = LoGetTrueAirSpeed() local latPos = 99.9999 local longPos = 99.9999 local myPlane = LoGetSelfData() if myPlane then latPos = MyPlane.LatLongAlt.Lat longPos = MyPlane.LatLongAlt.Lon end socket.try(conn:sendto(string.format( "altBar=%.2f, pitch=%.2f, bank=%.2f tas=%.2f LatLong=(%f,%f)\n", altBar, 57.3*pitch, 57.3*bank, tas*1.6, latPos, longPos ), ipaddr , port)) end when i run this, latPos and longPos come back as nil, i don't suppose anyone has an idea?
  6. ok, i've just found a better way by borrowing some ideas from DCS-BIOS, multicast! the nice thing is there's no connections to make and there no significant load on DCS i think. anyhow, its super simple, here's the exports.lua package.path = package.path..";.\\LuaSocket\\?.lua" package.cpath = package.cpath..";.\\LuaSocket\\?.dll" socket = require("socket") ipaddr = "239.255.50.10" port = 5010 -- Lua Export Functions function LuaExportStart() conn = socket.udp() conn:settimeout(0) end function LuaExportStop() socket.try(conn:close()) end function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() socket.try(conn:sendto("hello from DCS\0", ipaddr , port)) local altBar = LoGetAltitudeAboveSeaLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local tas = LoGetTrueAirSpeed() socket.try(conn:sendto(string.format( "altBar=%.2f, pitch=%.2f, bank=%.2f tas=%.2f\n", altBar, 57.3*pitch, 57.3*bank, tas), ipaddr , port)) local o = LoGetWorldObjects() for k,v in pairs(o) do -- if v.UnitName=="steve" then socket.try(conn:sendto(string.format( "name=%s UnitName=%s LatLong=(%f,%f)\n", v.Name, v.UnitName, v.LatLongAlt.Lat, v.LatLongAlt.Long), ipaddr , port)) -- end end end and the c++ program // DCS_airshow.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <winsock2.h> #include <Ws2tcpip.h> #include <stdio.h> // Link with ws2_32.lib #pragma comment(lib, "Ws2_32.lib") int _tmain(int argc, _TCHAR* argv[]) { char* multicast_ip = "239.255.50.10"; unsigned short multicast_port = 5010; SOCKADDR_IN multicast_addr; WSADATA wsaData; int hr; BOOL bOptVal = TRUE; ip_mreq mreq; int max_length = 16; WSAStartup(MAKEWORD(2,0), &wsaData); SOCKET sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock == INVALID_SOCKET) { wprintf(L"socket failed with error %d\n", WSAGetLastError()); return 1; } // construct bind structure memset(&multicast_addr, 0, sizeof(multicast_addr)); multicast_addr.sin_family = AF_INET; multicast_addr.sin_addr.s_addr = htonl(INADDR_ANY); multicast_addr.sin_port = htons(multicast_port); hr = bind(sock, (struct sockaddr *) &multicast_addr, sizeof(multicast_addr)); if (hr != 0) { wprintf(L"bind failed with error %d\n", WSAGetLastError()); return 1; } /* Specify the multicast group */ mreq.imr_multiaddr.s_addr = inet_addr(multicast_ip); /* Accept multicast from any interface */ mreq.imr_interface.s_addr = htonl(INADDR_ANY); /* Join the multicast address */ hr = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char FAR *) &mreq, sizeof(mreq)); if (hr != 0) { wprintf(L"setsockopt failed with error %d\n", WSAGetLastError()); return 1; } int optval = 8; hr = setsockopt(sock,IPPROTO_IP,IP_MULTICAST_TTL, (char*)&optval,sizeof(int)); if (hr != 0) { wprintf(L"setsockopt failed with error %d\n", WSAGetLastError()); return 1; } hr = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&bOptVal, sizeof(bOptVal)); if (hr != 0) { wprintf(L"setsockopt failed with error %d\n", WSAGetLastError()); return 1; } int timeout = 1000; // 1 sec setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof(timeout)); int cnt=0; while (true) { unsigned char buffer[4096] = { 0 }; int n = recvfrom(sock, (char*)buffer, 4096, 0, NULL, 0); if (n == SOCKET_ERROR) { //wprintf(L"%d recvfrom failed with error %d\n", cnt++, WSAGetLastError()); continue; } printf("%s\n", buffer); } WSACleanup(); return 0; } works great
  7. here it is, best to let the guy on your left go first and follow him close (even if ATC complains) the ai's flight path is all over the place, doesn't stick to the waypoints with any level of accuracy, especially the low level flyover the runway. i think there's nothing i can do about that but please help if you think i can. i had exactly the same problem when i used to fly falconBMS, so i wrote my own, super accurate aerobatic autopilot, then i could fly against it in multiplayer mode. but it needed 2 computer to play it and quite a lot of setting up. i gave on on it because falconBMS kinda sucks, really, look at the graphics quality! the only reason to play it is for the f16, but the f15 ain't bad. anyhow, i've just figured out how to get real time telemetry from DCS so i can resurrect my project on DCS, but its a maintain of work, not sure i'm into it. airshowtest1.miz
  8. i've finally got something working after a day and a bit of frustration, so i thought i would share for other people interested in getting real time telemetry data form DCS. many many many thanks to jboecker at DCS-BIOS for all his patience and help with my stupid question. so basically, you can talk to DCS as a programmer using a file called Exports.lua in your DCS/Scripts folder here C:\Users\me\Saved Games\DCS\Scripts or here C:\Users\me\Saved Games\DCS.openbeta\Scripts if you are on 1.5 so here's my Exports.lua local log_file = nil package.path = package.path..";.\\LuaSocket\\?.lua" package.cpath = package.cpath..";.\\LuaSocket\\?.dll" socket = require("socket") host = host or "localhost" port = port or 27015 function LuaExportStart() log_file = io.open("C:/Users/me/Saved Games/DCS/Logs/Export.log", "w") end function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() end function LuaExportStop() if log_file then log_file:write("Closing log file.") log_file:close() log_file = nil end if connectSoc then socket.try(connectSoc:send("quit")) -- to close the listener socket connectSoc:close() end end function LuaExportActivityNextEvent(t) if connectSoc==nil then log_file:write("try to open socket\n") connectSoc = socket.try(socket.connect(host, port)) -- connect to the listener socket connectSoc:setoption("tcp-nodelay",true) -- set immediate transmission mode if connectSoc then log_file:write("socket opened ok\n") socket.try(connectSoc:send(string.format("Hello from DCS\n"))) else log_file:write("socket open failed\n") return t+0.5 end end local altBar = LoGetAltitudeAboveSeaLevel() local altRad = LoGetAltitudeAboveGroundLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local tas = LoGetTrueAirSpeed() socket.try(connectSoc:send(string.format( "altBar=%.2f, pitch=%.2f, bank=%.2f tas=%.2f\n", altBar, 57.3*pitch, 57.3*bank, tas))) local o = LoGetWorldObjects() for k,v in pairs(o) do -- if v.UnitName=="steve" then socket.try(connectSoc:send(string.format( "name=%s UnitName=%s LatLong=(%f,%f)\n", v.Name, v.UnitName, v.LatLongAlt.Lat, v.LatLongAlt.Long))) -- end end return t+0.5 end so all you need to do on the DCS side is put that in the Scripts folder and run DCS then the bit that took me a while to work out. That export script is basically a client application, it attempts to connect to a TCP server on port 27015. if you don't know what this sentence means, you need to do a lot of reading on networking and TCPIP. so you need to write a server to listen to port 27015. and here it is (on windows) // astest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #undef UNICODE #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> #include <stdlib.h> #include <stdio.h> // Need to link with Ws2_32.lib #pragma comment (lib, "Ws2_32.lib") // #pragma comment (lib, "Mswsock.lib") #define DEFAULT_BUFLEN 512 #define DEFAULT_PORT "27015" int _tmain(int argc, _TCHAR* argv[]) { WSADATA wsaData; int iResult; SOCKET ListenSocket = INVALID_SOCKET; SOCKET ClientSocket = INVALID_SOCKET; struct addrinfo *result = NULL; struct addrinfo hints; int iSendResult; char recvbuf[DEFAULT_BUFLEN]; int recvbuflen = DEFAULT_BUFLEN; for(;;) { // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("WSAStartup failed with error: %d\n", iResult); return 1; } ZeroMemory(&hints, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; // Resolve the server address and port iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result); if ( iResult != 0 ) { printf("getaddrinfo failed with error: %d\n", iResult); WSACleanup(); return 1; } printf("getaddrinfo OK\n"); // Create a SOCKET for connecting to server ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (ListenSocket == INVALID_SOCKET) { printf("socket failed with error: %ld\n", WSAGetLastError()); freeaddrinfo(result); WSACleanup(); return 1; } printf("socket OK\n"); // Setup the TCP listening socket iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen); if (iResult == SOCKET_ERROR) { printf("bind failed with error: %d\n", WSAGetLastError()); freeaddrinfo(result); closesocket(ListenSocket); WSACleanup(); return 1; } printf("bind OK\n"); freeaddrinfo(result); iResult = listen(ListenSocket, SOMAXCONN); if (iResult == SOCKET_ERROR) { printf("listen failed with error: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } printf("listen OK\n"); // Accept a client socket ClientSocket = accept(ListenSocket, NULL, NULL); if (ClientSocket == INVALID_SOCKET) { printf("accept failed with error: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } printf("accept OK\n"); // No longer need server socket closesocket(ListenSocket); // Receive until the peer shuts down the connection do { iResult = recv(ClientSocket, recvbuf, recvbuflen, 0); if (iResult > 0) { //printf("Bytes received: %d\n", iResult); char* end = strchr(recvbuf, 10); if(end && end<&recvbuf[recvbuflen]) *end=0; printf("%s\n", recvbuf); } else if (iResult == 0) printf("Connection closing...\n"); else { printf("recv failed with error: %d\n", WSAGetLastError()); //closesocket(ClientSocket); //WSACleanup(); break; } } while (iResult > 0); // cleanup printf("closesocket OK\n"); iResult = shutdown(ClientSocket, SD_SEND); if (iResult == SOCKET_ERROR) { printf("shutdown failed with error: %d\n", WSAGetLastError()); closesocket(ClientSocket); WSACleanup(); return 1; } // cleanup closesocket(ClientSocket); WSACleanup(); } return 0; } so to use this code, get MSVC, start a new console app, and in your c++ source file, just paste all that, compile and run. now as you fly around in DCS, you should see data in the console window. the real trick here is the sync'ing of the network connections. i was having a really hard time to get the two things to start up reliably. so in the Export.lua file you will notice that i check to see if the connection is open on every call to LuaExportActivityNextEvent. if it isn't, i attempt to open it, and if ok, i start sending data. similarly on the windows server side, it needs to keep retrying to open a connection, so i took the example from here https://msdn.microsoft.com/en-us/library/windows/desktop/ms737593(v=vs.85).aspx and put the whole thing in a forever loop so it keeps retrying to connect. this way i was able to get the thing to run regardless of the startup sequence. (although sometime it doesn''t start and then i try again and it works, so still looking into that) this should work for any plane by the way, not just a10c there's probably a better way and i'd be happy to know about it, but at least i can say, this works.
  9. ok, i just got something working function LuaExportActivityNextEvent(t) local altBar = LoGetAltitudeAboveSeaLevel() local altRad = LoGetAltitudeAboveGroundLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local tas = LoGetTrueAirSpeed() log_file:write(string.format( "altBar=%.2f, pitch=%.2f, bank=%.2f tas=%.2f\n", altBar, 57.3*pitch, 57.3*bank, tas)) local o = LoGetWorldObjects() for k,v in pairs(o) do log_file:write(string.format( "ID=%d name=%s LatLong=(%f,%f)\n", k, v.Name, v.LatLongAlt.Lat, v.LatLongAlt.Long)) end return t+0.5 end this works, but i'd still like to find a better way of getting only my lat long. any ideas please?
  10. i wrote a simple Export.lua script ============================================ local log_file = nil mist = mist or {} mist.utils = mist.utils or {} function LuaExportStart() log_file = io.open("C:/Users/me/Saved Games/DCS/Scripts/Export.log", "w") end function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() end function LuaExportStop() if log_file then log_file:write("Closing log file.") log_file:close() log_file = nil end end function LuaExportActivityNextEvent(t) local altBar = LoGetAltitudeAboveSeaLevel() local altRad = LoGetAltitudeAboveGroundLevel() local pitch, bank, yaw = LoGetADIPitchBankYaw() local tas = LoGetTrueAirSpeed() log_file:write(string.format( "altBar=%.2f, pitch=%.2f, bank=%.2f tas=%.2f\n", altBar, 57.3*pitch, 57.3*bank, tas)) local o = LoGetWorldObjects() for k,v in pairs(o) do log_file.write(string.format("t = %.2f, ID = %d, name = %s, country = %s(%s), LatLongAlt = (%f, %f, %f), heading = %f\n", t, k, v.Name, v.Country, v.Coalition, v.LatLongAlt.Lat, v.LatLongAlt.Long, v.LatLongAlt.Alt, v.Heading)) end return t+0.5 end ============================================ pitch, bank, yaw and tas are all printing fine. but i'm trying to get the location of me, the player. best i could figure out was to use LoGetWorldObjects() which has lat longs in there ten figure out which is me. there is probably a better way, pls help. but, when i run this script, i get a error in dcs.log Export.lua - [string "C:\Users\me\Saved Games\DCS\Scripts\Export.lua"]:56: attempt to index global 'mist' (a nil value) i assume that means i haven't set up mist yet but to be honest, i'm clueless. any help please? thx
  11. well, that's exactly what i'm working on, and here's what i've found so far. 4 planes is out of the question, getting 3 AI planes to fly close to each other is impossible. but 2 planes is kind of ok, one AI, one is you the AI is chicken, it doesn't like flying close to the ground, or at least i haven't figured out a way to may it fly 50' AGL yet, but working on it. it also does random stuff which makes close formation confusing. anyhow, i want to start a specific thread for formation flying, not use this one. i have a mission already which is a start, i can publish it latter today if any one else interested in playing with it. steve
  12. i hit hide on map in the editor to declutter a bit but i've no idea how to select it now to get it back and turn off hide. help please OK, found it, bring up the units list
  13. hi, just saw this in a search. i'm very interested, i'm working on a mission now so i can fly an airshow circuit against an AI but would be cool to fly with real people one day. i'm still way too crappy by the way, it will take me a while to get blue angels level
  14. thanks but i already moved on and have something running now based on a downloaded mission. i'm sure it was simple user error. i just started with ME, getting a feeling for it, its kinda fun. i'm making an air show mission so i can fly in formation, blue angels style. i'll post it when i get something working.
  15. yes, i fly f15 all the time. actually, i found a mission on the user files that had kind of what i wanted, then just started mod'ing it and its ok now, so i guess i found a work around. thx anyhow
  16. i've just started playing with the mission editor. i create 2 planes (F15's) and the first one I set as skill level high, which i believe will make it an AI plane right? the second plane i create will skill level 'client' so i can fly it. (for some reason i don't get 'player' as an option, maybe that's the problem?) i start both planes to start in the parking area hot with different parking slots obviously then i save, quit and go to the mission. when i start the mission, it asks me which plane i want to fly, it vies me one option and i choose it and hit fly. thing is, when the game starts, both planes are AI, i can't get in the cockpit of my plane with F1 i'm sure this is something very basic but can't work i out. can someone help please? thx
  17. i read in another thread that civilian traffic doesn't work in 1.5. is that still the case? seems to be for me. just a10c by the way, working fine for f15
  18. can you elaborate? ah, maybe thhis http://dcs-bios.a10c.de/docs/v0.2.4/developerguide.html
  19. hi, some time ago i wrote an app for falconBMS to let you create your own formation air show [ame] [/ame] falconBMS has a shared memory area so external apps can read stuff like pitch, roll, speed, altitude, etc. in real time from the sim. i'd like to move this project to DCS because, well, DCS is better, and this app would be awesome in VR which BMS will likely never support. only thing is, there seems to be no developer interface for getting real time parameters from the sim. can anyone help? is there a developer program for DCS? thx steve
  20. i wrote a tool to map any keyboard macro to a second keyboard or num pad key. see here http://www.2112design.com/blog/multi-keyboard-remapper/ steve
  21. pause is a bit weird, it uses 3 byte codes, see http://www.computer-engineering.org/ps2keyboard/scancodes1.html its possible but need some work from me, not sure i'm into that just for 1 key. how often do you use it?
  22. has anyone tried the Chinese knockoff ones on ebay? search ebay for trackir and you'll find stuff like "OpenTrack FreeTrack Camera + IR LED Track Clip Pro is compatible to TrackIR 5 BK" for $39. its using a modified PS3 eye so i assume should work well. i'm thinking of ordering one since i gave up on facetracknoir for the same reasons other people have posted. well i just ordered one, i checked the sellers feedback and customers are reporting it works well so i gave myself a NY present. happy NY to all.
  23. my tool does it http://forums.eagle.ru/showthread.php?p=2622956#post2622956
  24. how do you control the throttle?:music_whistling: seems to me that pressing and holding the right mouse should pan around. i wonder if there is any way to configure that. BTW, i have a trackir clone but don't use it, i find the display moving around all the time distracting.
  25. i'm not sure it will work, or if it does it may result in keyboard keys getting jammed up. you are welcome to try but don't be shocked if you need to reboot to get your keyboard back if something goes wrong. if i feel the urge, i'll add something to the config script to specify multiple devices. that's the right way to do it. and i added a new website for it http://steveh2112.wix.com/multi-keyboard-remap but the one here http://www.2112design.com/blog/multi-keyboard-remapper/ is more likely to be the most current
×
×
  • Create New...