Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

[WIP] Holo Projector

Discussion in 'Released and WIP Mods' started by Innoble, May 29, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Innoble Apprentice Engineer



    -No art (yet): I use a projector block because it is better looking than anything I could make in a reasonable time. I would like some icons for the hotbar, because that would make it easier to distinguish. I guess that is a problem for some vanilla blocks too.

    -Long Range sensor: This block does (almost?) everything you want from a long-range sensor, at least if you use a programmable block to go with it. You can get the following properties:

    -Ability to show a 3D map of the surrounding area (up to 1000 km). The power that is used scaled with the setting for detection range. If you set it too high and you can't afford the power costs, it will shut down.

    -Programmable block support with the properties below:

    SelectedId: To have a unique identifying property for your PB script. This is the entity ID of the selected target (a detected parent block, usually a landing gear)
    EntityList: The entire list of detected entities, but just their Ids (type long)
    SelectedType: SmallGrid/LargeGrid/Asteroid/Character/Missile/FloatingObject
    SelectedOwner: This is the owner Id (steam ID)
    SelectedMass: If it is a grid
    SelectedVelocity: Vector3D
    SelectedCoords: For grids this is the center of mass, for asteroids it is the position gotten by Entity.GetPosition()

    Be careful not to overuse these. It is totally possible to get the full list with all entities and get all properties, every frame, but that may not be wise. A good thing to do is to filter before you use the script. If you are only interested in missiles, turn everything off except missiles in the projector. Then only missiles will appear in your "EntityList". Of course you can also get the whole list and then check for the type each time, but this will put a bit more strain on your cpu.

    The holo projector does need to be on to use these scripting possibilities, but it does not have to actually project anything. So turn the projection off if you just want the info.

    Below two (very basic!) scripts that use these properties:

    I also added some options to add your own "markers" in the form of dots to the projector. This is somewhat advanced scripting. You can upload 3 types of lists for these dots. They are:

    List<Vector3D> "DotList": This is the location the dot needs to be in real space engineers x,y,z coordinates.
    List<float> "DotSize": This is the size of the dot, between 0,01 and 100 compared to the size of an asteroid in the projector (if you used it before, you have a general idea). If you don't use this list, the size will default to 1.
    List<Color> "DotColor": You can also upload this list of RGB color "vectors" with new Color(f,f,f) where f is a float between 0 and 1.

    Below a (pretty simple) piece of in-game scripting code to tinker with and a video demonstrating this property of the projector. I made a N-body simulation using the law of Newtonian gravity that calculates the force between 150 bodies. It picks random masses, sizes and colors to showcase this new option. I tried with 200 dots as well, but the number of calculations goes as the square of the number of bodies (200*200 = 40.000) and it would lead to millions of calculations per second and that gave me "script too complex". You could (if you wanted to) make your own solar system simulation with this type of code easily though and use the holo projector to display it.


    Controls and Actions:

    Center on target On/Off: You center the projection on the projector block or on the target

    Friendly/Enemy On/Off: This is for grids. These settings also function to turn off grids. Just turn both of these off and all grids will be gone, except the unowned ones.

    Asteroids On/off:
    Floating Objects On/off:
    Missiles On/off:

    Cone On/Off:
    Turn the blue cone on or off

    Selection box On/Off: The white box used for the selection can also be made invisible

    Velocity On/Off: To show the velocity vector on the map (or not)

    Detection Range: Between 1 and 1,000,000 m. (1000 km). The power costs go up with the square of the distance. Short range is very cheap, long range quickly devours your uranium supply (if you even have enough reactors).

    Projection Radius: You can vary this between 0 and 100m. This is how big the projection appears.

    Zoom: Control the size of the area that is projected. If you set it to 10 km. You will see all the stuff in an area of 10km around the target. Of course if you don't also set the detection range that high, you might miss stuff.

    Projection Offset(X,Y,Z): You can place the projection anywhere around the projector, within 100 m.

    Workshop link

    First gridview test

    Gridview stress test with fighting (missiles visibile!):

    Asteroid gridview, added on 26-10-2017

    Last edited: Oct 26, 2017
    • Like Like x 13
  2. Fragman Apprentice Engineer

  3. Innoble Apprentice Engineer

    I put a new video up. Check out the new gridview option.
  4. Veador Trainee Engineer

    Hi! There is the end of my DS log:

    2016-06-05 22:30:28.3089|Info|EssentialsPlugin.Essentials.Shutdown|Shutting down plugin: Dedicated Server Essentials -
    2016-06-05 22:30:28.5429|Warn|EssentialsPlugin.Essentials+<>c__DisplayClass223_0.<PluginProcessing>b__0|Handler Problems: 60000 - System.Threading.ThreadAbortException: Thread was being aborted.
      at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout)
      at System.Threading.Thread.Sleep(Int32 millisecondsTimeout)
      at EssentialsPlugin.ProcessHandlers.ProcessTicket.Handle()
      at EssentialsPlugin.Essentials.<>c__DisplayClass223_0.<PluginProcessing>b__0()
    2016-06-05 22:30:28.5429|Error|EssentialsPlugin.Essentials+<>c__DisplayClass223_0.<PluginProcessing>b__0|:SleepInternal(0,0)
    2016-06-05 22:30:28.5585|Error|EssentialsPlugin.Essentials+<>c__DisplayClass223_0.<PluginProcessing>b__0|:Sleep(0,0)
    2016-06-05 22:30:28.5585|Error|EssentialsPlugin.Essentials+<>c__DisplayClass223_0.<PluginProcessing>b__0|:Handle(0,0)
    2016-06-05 22:30:28.5585|Error|EssentialsPlugin.Essentials+<>c__DisplayClass223_0.<PluginProcessing>b__0|:<PluginProcessing>b__0(0,0)
    I havent any another problem in log files =(
  5. Innoble Apprentice Engineer

    Thanks for posting the log. I don't think there's much I can do with it I think.

    If anyone else has an idea why my mod fails on this DS (or any DS) let me know. I figured it may have something to do with SimpleObjectDraw. I am not sure how that functions on DS. Perhaps it tries to draw for the dedicated server even though it is not supposed to have any rendering and such.
    • Agree Agree x 1
  6. Peekofwar Apprentice Engineer

    I know nothing about coding, but I support the idea that...
    It may be something along the lines of:
    The server doesn't know what these commands are because it isn't programmed to understand render code.

    This leads me to think: Is it possible to disable the rendering code for the server itself?

    Lucily I do not play on servers... I play "single player" A.K.A. in my own "worlds" on my PC.
  7. Phoera Senior Engineer

    this exception generated when thread is aborted, what can happen for parallel threads when game closes.
    nothing about render here.
  8. Innoble Apprentice Engineer

    Yea, I have no idea what causes this. I will dig into your mod phoenix. I believe you have some stuff in your laser miner mod that works in MP. You also use new blocks and apparently you have no problems in MP.

    At least I still need to use your saving mechanism, so I will see what I can find there. Give some time, because it is a bit busy at work atm :)
  9. Captaindan Apprentice Engineer

    I watched all your Videos! I need to say you mod is really really nice! It's perfect! Keep up your great work! ;)
  10. Innoble Apprentice Engineer

    I have a new version of the projector up. Also a new video in the first post above. Enjoy!
  11. Panvel Trainee Engineer

    I was trying to run the simple scripts that you posted on DS.
    Since i know the very basics of script languages, i wanted to ask what i have to set in the scripts, once loaded in the programmable blocks ( aside from the names of LCD, Timer, and Holo projectors);
    Because the LCDs are still black and i can't figure where im wrong!
    The last error message in the all target script that appears on the program block is the following: "the given key was not present in the dictionary"
    Thanks in advance and keep updating this awesome mod!!!!
  12. Innoble Apprentice Engineer

    The dictionary thing may be something I need to fix. I thought I did, but apparently not. Basically, your game is keeping a dictionary (like a list, but different) with detected targets and they are filtered for your projector block. There may be instances where an object that is still in the filtered list, no longer exists in the total list. I'll put in some safety measures for that soon.

    EDIT: Wait a min: It's on a DS? Thats awesome, my mod actually survives being loaded on a DS now :)

    Let me see what I can do. It's hard for me to fix DS problems, because i dont own one myself
    --- Automerge ---
    Edit2: the script thingy may be fixed now. At least the error is. If it can't find the key now, it will give a default value instead, which is very uninteresting, like {0,0,0} for Vector3Ds and 0 for ints and longs and "" for strings. That way your PB wont shut down, but you can instead filter for it
    --- Automerge ---
    But please let me know if you cannot get scripts to run in general. I tried on SP and hosted MP as server, but no idea about DS

    I would also like to know if I succesfully managed to make the projector able to see stuff outside of draw range, like grids 50 km. away (assuming you have your detection range set high enough).The server should be making sure you have the required information to see it as an icon like a cube or pyramid.
  13. Panvel Trainee Engineer

    The script runs fine on local, so i guess that is just a DS issue.

    Also the holo on DS manages someway to see stuff outside the view range, for sure at a distance about 40km away.

    Here is an example of how it works on DS:
    -The Holo is set to see and project a fixed radius about 80km (first image)
    -After a Jump drive exceeding the radius distance, the old asteroids and green stuff are still visible (on the right of 2nd image)

    [​IMG] [​IMG]
  14. Innoble Apprentice Engineer

    Hmm, it should not display stuff past its radius. Are you certain these asteroids are further away than 80 km in this case? The fact that there is an isolated cluster of asteroids is perfectly ok. You can only see 20 km. around you or so when it comes to asteroids (only those asteroids are spawned/exist). If you go to a new area, new asteroids spawn there.

    Also the projection stuff is drawn anew every frame, nothing remains. That means the mod really thinks there is still stuff there. Whether that is a bug or not is something I don't know yet.
    I will take a look at the code anyways, see if something pops out.

    The scripts still do not work on DS? It should not be giving that error you mentioned at least.

    EDIT: Wait, perhaps you are confused about what a radius of 80 km means in this case. It means the projection shows things up to 80 km away. That means the projection area shows a space 160 km. wide (80 km in either direction). Did you actually jump further away than 100 km or so? Otherwise it seems to be working ok.
  15. Innoble Apprentice Engineer

    I added a new option to display your own dots through ingame scripting. I also added a video to showcase this option. The video is linked in the first post, but also below:

    • Friendly Friendly x 1
  16. Innoble Apprentice Engineer

    Many multiplayer problems have been fixed. You can now display smaller things than ever and I added asteroid models (in gridview). I also use parallel processing now to make the grids for gridview.

  17. Innoble Apprentice Engineer

    Added VoxelView option

  18. Forcedminer Senior Engineer

    I really like the "N body simulation with holo projector" video. :)

    looks like a delightful way to give a room some colorful light.
    as well as i can totally see this be used for some roleplayers and even online players when you attempt to examine an object or show it to another player. ^^

    or even just have a bunch of them floating around your base adding a bit of color and light.
  19. Innoble Apprentice Engineer

    Yeah that is certainly possible. You can also do lots of other stuff with it since you can script the balls in the PB. You can make them come alive if you know how to write some AI. Or just program a bunch of them to fly through hallways with a predetermined path. Or make them like, guidewisps. You make an LCD selection menu where you can select several rooms in your base or ship and the "wisp" will show you what path to take. You could make a sort of Agario-like game as well. I would keep that 2D, but in principle it could be 3D as well. If i had the time, I would try more stuff like that.
Thread Status:
This last post in this thread was made more than 31 days old.