Jump to content
  • Advertisement
Sign in to follow this  
Telastyn

Unity How would you approach this?

This topic is 2712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.


Recommended Posts

I have a poll for the community at large. I have a project at work where there is a debate going on between design for an application:

  • The application is from scratch design.
  • It is a remote display appliance that will handle 1 or more physical displays.
  • It is controlled by a central system.
  • It will be a Windows 7 box (possibly windows 7 embedded).
  • It must run as a non-privileged user.
  • It may only pull from the central system. No pushes allowed.
  • It will be on and active ~20 hours out of every day.
  • It must be remotely upgradable by the central system.
  • Your network connection to the central system is... not guaranteed to be reliable, but guaranteed to be at least a run of the mill US cable modem.
  • It needs to download and play content (a variety of video/images/sounds) supplied by the central system.
  • The central system will specify some rules (around 25, 50-character strings) every so often (~15-90 mins) which the appliance will need to convert into a literal list of media items. Assume for this argument that the algorithm is done, requires no extra memory beyond the rules, ~5% cpu, and the list is infinite.
  • Assume for the sake of this discussion that the rendering/playing of content is done and self contained.
  • The appliance must report status (cpu/memory/disk, as well as general software health) back to the central system frequently (<5 mins).
  • The appliance must report exceptional conditions back to the central system.
  • The appliance must report back what items it played at the end of each time segment. This communication cannot be lost.
  • It is important that the displays play correct content, but it is **VITAL that the screens display some content**. If the appliance goes dark, you lose your job. If it shows random errors to the screen, you lose your job.
  • This is a new system. You must use C#, but 4.0 is available, as well as any released tools. You can control (within reason) what the appliance and even the central system has if I've not specified the requirements here. You have a excellent team of about 20 developers, about 4 of which are dedicated to this appliance and 1 year.So, the question surrounds the non-rendering piece of this appliance box. The debate surrounds how (in general) it should be designed. Should it be a large-ish single process with perhaps a few worker threads? Should it be a series of small processes? Should it be a single process composed of a number of threads?

    In general, how would you approach this problem? What things would you want to use? And *WHY*?


    I can answer questions about the requirements, but will do my best to conceal my preference to prevent bias.

Share this post


Link to post
Share on other sites
Advertisement
I don't understand the concurrency requirements here. Why should it be multithreaded/multiprocess in the first place? What of your specs demands concurrent implementation?

Share this post


Link to post
Share on other sites
From the uptime and remote upgrade requirements I'd go multiple processes. While I don't think it'd be impossible to do with a single process, it'd be severely annoying. Though I have to say the requirement for not losing communication combined with no guarantee of network reliability is pretty much a setup for failure.

Share this post


Link to post
Share on other sites
It is important that the displays play correct content, but it is **VITAL that the screens display some content**. If the appliance goes dark, you lose your job. If it shows random errors to the screen, you lose your job.[/quote]
What will the failover hardware look like?

For the cases when power supplies burn fail, capacitors on motherboard fail, cables get disconnected, etc...

Have an uptime requirement, and budgets increases tenfold. Unless the guarantee is about two nines, or a day of downtime per year.

The only alternative is to use linux-backed TV with custom ROM that switches to pre-defined image in case of failure.

The appliance must report back what items it played at the end of each time segment. This communication cannot be lost.[/quote]Which means multiple communication paths, 3G, GSM, satellite, wire, AM/FM, depending on desired probability of failure.

Add to that the usual failure modes (fire, flood, earthquake, car/airplane/vehicle crash, nuclear/EMP strike) and you're looking at higher security than what nuclear facilities have.

Whenever you have such requirements, always design for probability - everything can and *will* fail.

Until you set realistic goals, the budget for this will need to be in tens of millions per device. And systems that can cope with that do exist, some are even available as open source, but they don't come with hardware and such.


In practice, the above means something like this:
- Local-static/failure placeholder image or video
- Real-time/dealine feedback from device. If no feedback is received in one hour, assume device has failed and send repair team on site.
- Device maintains local log, mirrored across two or more media devices (hard-drive/flash drive or similar). Make sure to include life-span/MBR of that media into scheduled maintenance for replacement.
- Hardware watchdog to detect hangs and try to recover to avoid waiting for deadline expiry

This is as good as it gets.

What is missing from the above, especially in commodity hardware is self-diagnostic. What happens if physical screen goes blank? How do you detect it, how is this reported back? What about local disk health?

It may only pull from the central system. No pushes allowed.[/quote]Then how will it report status back?

It will be on and active ~20 hours out of every day.[/quote]Which means UPS and hot-swap standby replacement hardware.

Your network connection to the central system is... not guaranteed to be reliable, but guaranteed to be at least a run of the mill US cable modem.[/quote]Which means content will be cached locally for the maximum planned outage (see above - 1 hour deadline). Requires reliable local storage that can support this - but given simple modem, size isn't likely to be a problem.

It must be remotely upgradable by the central system.[/quote]At which point you'll be at the mercy of Windows Update installer. The system will need a test harness (identical local replica) for testing of Windows patches, as well as adequate on-device memory for this operation. Service packs and other patches required by codecs or other components (.Net or similar) can easily take several gigabytes to install. There is also no good remote recovery in case of failed update unless you mess with partitions and custom bootloader.

Should it be a large-ish single process with perhaps a few worker threads? Should it be a series of small processes? Should it be a single process composed of a number of threads?[/quote]It doesn't really matter regarding any of the above issues. To attempt fast recovery, the application process will be started either as shell replacement or from a script that loops back to itself and reports shutdown after exit. This helps bring application back up after sporadic crash.

Application itself can also contain a watchdog to force its termination in case something goes wrong.

In general, how would you approach this problem?[/quote]By clarifying and detailing the reliability requirements. "Never" does not exist or at very least, costs infinite money.

But almost all of this is a hardware problem.

Share this post


Link to post
Share on other sites

I don't understand the concurrency requirements here. Why should it be multithreaded/multiprocess in the first place? What of your specs demands concurrent implementation?


There are no specs which demand concurrent implementation directly. The general argument against tends to be the difficultly in scheduling all the different things it needs to do, especially since some of them might be long running.


regarding Antheus' post regarding proper uptime requirements
[/quote]

I don't know the actual SLA requirements off hand. For the sake of this argument, two nines seems acceptable. This isn't a medical device or military strategic display. If the device fails, a dozen people go idle, the customer gets egg on their face, and they/us lose a few hundred bucks an hour it's down. As you point out, if the customer needs more the cost will likely be passed along and is almost entirely hardware related.

"It may only pull from the central system. No pushes allowed." - here I meant no pushes from the central system. The display appliance may pull data and push status/etc.

Also, power outage/flood/fire/EMP are acceptable outage scenarios. These will be located at places of business, so if something closes the business and nobody can see the displays... it's not a big deal.
Another thing which I perhaps communicated poorly... "The appliance must report back what items it played at the end of each time segment. This communication cannot be lost." - The results can not be lost. If network connectivity is down, it is acceptable to communicate those results once connectivity returns.


Beyond that, many of these failover/robustness points are in the works (or under research), including smart displays that failover to a different input in case of signal loss. But it's certainly great to see the thought process behind them, and the whole of them spelled out so concisely.

Share this post


Link to post
Share on other sites
I'd personally take a leaf out of Erlang's book on this one. It's a damn shame you're stuck with C# 4.0, because Erlang is really quite suited to this sort of system.

Anyways... my suggestion would be to set things up with two layers of safety: one watchdog layer to ensure the main process runs and does not die (and to report errors should the main process crash), and one layer of redundancy. The redundant layer would handle failover/spillover from the main process, and additionally serve to ensure the watchdog itself remains active.

In other words, envision a tripod. One leg goes down, the other two ensure it restarts cleanly. Two legs go down, you have one left to catch the chain and restart the others. If all three drop simultaneously, you have a catastrophic failure, in which case you have a server-side watchdog which notes (after some time period) that a remote machine has failed to check in, and can fire off automated alerts/etc. as necessary. Provided you can keep the central system stable and up (probably using a similar failover/watchdog strategy) this should ensure maximal uptime without resorting to tricky business with hardware watchdogs etc. (Although if you have support for custom hardware, you can use a microcontroller's built-in watchdog to rig up something nifty... but that's probably well beyond the scope of this project.)

I would strongly recommend against multithreading, because thread errors have a tendency to drop an entire process when things go badly wrong. IPC is safer anyways, and eliminates the temptation to abuse shared memory between systems, which is an absolute no-no in building failsafe components.

Judicious placement of exception handlers and careful use of monitoring systems should get you a good multi-process solution in short order. I'm amazed you have so much time and manpower to throw at something... well, certainly not trivial, but well-understood and more or less straightforward to implement.

Share this post


Link to post
Share on other sites
Just to make sure I understand you correctly:

You have 3 parts - the main display; the backup/simple display; and the watchdog. Are you also advocating individual processes for the various things the main display needs to do? I understand you to mean that here.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Similar Content

    • By RoKabium Games
      Been a bit quiet recently, but we've been busy bug fixing and tweaking things... Now we have lots more 'Particle effects' in the game, specifically here the Flamethrower and Enemy attacks!
    • By Alexander_Vovk
      Hello Guys!
      Please share your experience, where is it better to find sales manager  specialists for indie team of 6 + people(remotely)?
      Maybe someone has a good experience of cooperation with finding projects through sale managers(USA and Canada)?
        
      In our team more than 6 developers. We are working since 2014 now we are looking for projects mainly on upWork and Unity Connect.
      But that's not enough 
      This is the site of our team https://www.sixteensq.com/             
                                                 https://www.behance.net/Dezignw136f
      Thank you
      Best Regards
      Alex Vovk
      Co-Founder of Sixteen Squares
      Alexander_Vovk@outlook.com
       
    • By JoshuaFraser
      Hi and thanks for reading, I have an issue with this reactive crosshair script, everything works fine until I start changing the offset. Give the script a go and you will see what I mean, when I do SetOffset(0f); it doesnt always set back to the origional state, if anyone can spot a fix I'd be super appreciative!
      using System.Collections; using System.Collections.Generic; using UnityEngine; public class ReactiveCrosshair : MonoBehaviour { [SerializeField] GameObject c_limb_prefab; private float center_offset = 0f; private float current_offset = 0f; private float max_offset = .5f; private int number_of_limbs = 4; private float limb_length = .05f; private float limb_width = .005f; private List<GameObject> c_limbs = new List<GameObject>(); public void SetupCrosshair(){ for (int i = 0; i < number_of_limbs; i++) { GameObject line_go = (GameObject)Instantiate (c_limb_prefab); line_go.transform.SetParent (this.transform); Vector3 limb_pos = new Vector3 (0f,0f,0f); //line_go.transform.position = limb_pos; line_go.transform.localPosition = limb_pos; LineRenderer line = line_go.GetComponent<LineRenderer>(); line.startWidth = limb_width; line.positionCount = 2; line.SetPosition (0, line_go.transform.localPosition + new Vector3(center_offset, 0f, 0f)); line.SetPosition (1, line_go.transform.localPosition + new Vector3(center_offset + limb_length, 0f, 0f)); line.useWorldSpace = false; c_limbs.Add(line_go.gameObject); } if (c_limbs != null) { OrientLimbs (); SetOffset (0f); } } public void OrientLimbs(){ for (int i = 0; i < c_limbs.Count; i++) { float rotation_step = 360f / (float)c_limbs.Count; c_limbs [i].transform.RotateAround (c_limbs[i].transform.position, c_limbs[i].transform.forward, 90f + (rotation_step * (float)i)); } } public void SetOffset(float _current_spread){ float offset = Mathf.Lerp (0f, max_offset, _current_spread); for (int i = 0; i < number_of_limbs; i++) { if (offset > current_offset) { Vector3 pos = c_limbs [i].transform.position + (c_limbs [i].transform.TransformDirection (Vector3.right) * offset); c_limbs [i].transform.position = pos; } if (offset < current_offset) { Vector3 pos = c_limbs [i].transform.position - (c_limbs [i].transform.TransformDirection (Vector3.right) * offset); c_limbs [i].transform.position = pos; } } Debug.Log ("SetOffset() offset: " + offset.ToString () + " _current_spread: " + _current_spread.ToString() + " localPos: " + c_limbs[1].transform.localPosition); current_offset = offset; } }  
    • By Erik Nivala
      So, as the title says i am trying to figure out a good way sync all that information with other players in Unity. My problem is that i can't come up with a good solution since i am used to creating classes for everything e.g. attachments are its own class and then the weapon would save a reference to that attachment. But since you can't send custom classes over [Command] & [ClientRPC] i am a little stuck. A solution for this would be giving each attachment for a slot a unique ID and then passing the ID to other player but i feel like that is very error prone if other ppl add a new attachment or the IDs get mixed up.
      Is there a "standard" way that this is usually done that i am missing?
      I am fairly new to programming so any help is appreciated!
    • By MintyLyton
      I'm looking for any team / people that need a programmer for their project. I'm looking to expand my portfolio which you can see Here. I'm more experienced with Unity but I can spend the time to learn new Engines if that's your preference. I have worked on Unreal Engine 4 before but I might take some time to re-learn it, if the project requires it. Feel free to DM here or use the contact info on my website. 
    • By ethancodes
      I'm working on a system for my game that will allow the player to stack pick ups in a queue. As one pick up expires, the next automatically activates. I'm having an issue though where if I pick up the first one, it activates fine, but if i pick up a second directly after it, it overrides the first one, activates the second one, and then once it has run it's course, everything goes back to normal gameplay, no first pick up. I'm not sure why this is happening. Hopefully someone can spot what I'm doing wrong in my code.
      Here is the code for the pick up manager:
      // Update is called once per frame void Update () { if (pickUpQueue.Count != 0 && !pickUpActive) { pickUpActive = true; pickUpQueue[0].ActivatePickUp(); } DeactivatePickUp(); } void DeactivatePickUp () { if (pickUpQueue.Count != 0 && pickUpActive) { Destroy (pickUpQueue [0]); pickUpQueue.RemoveAt (0); pickUpActive = false; } } And here is the PickUp:
      public override void ActivatePickUp () { ball.GetComponent<Ball>().Speed = 2.0f; //increase ball speed... ball.GetComponent<Ball>().StartCoroutine(timer); //...set time that power up is active }  
      There is also a Base Pick Up:
      public void OnCollisionEnter2D (Collision2D collision) { Vector2 tweak = new Vector2 (Random.Range(0f, 0.2f),Random.Range(0f, 0.2f)); this.gameObject.GetComponent<Rigidbody2D>().velocity += tweak; //if the pickup makes contact with the paddle or ball.... if (collision.gameObject.tag == "Paddle" || collision.gameObject.tag == "Ball") { GameObject.FindObjectOfType<GameManager>().GetComponent<PickUpManager>().pickUpQueue.Add(this); Destroy(gameObject); //...and finally destroy power up object } } As a side note, I am trying to find a solution to this that will work for all of my pickups. Some pickups are ammo based, some are timed. 
    • By D34DPOOL
      Edit Your Profile D34DPOOL 0 Threads 0 Updates 0 Messages Network Mod DB GameFront Sign Out Add jobEdit jobDeleteC# Programmer for a Unity FPS at Anywhere   Programmers located Anywhere.
      Posted by D34DPOOL on May 20th, 2018
      Hello, my name is Mason, and I've been working on a Quake style arena shooter about destroying boxes on and off for about a year now. I have a proof of concept with all of the basic features, but as an artist with little programming skill I've reached the end of my abilities as a programmer haha. I need someone to help fix bugs, optomize code, and to implent new features into the game. As a programmer you will have creative freedom to suggest new features and modes to add into the game if you choose to, I'm usually very open to suggestions :).
      What is required:
      Skill using C#
      Experience with Unity
      Experience using UNET (since it is a multiplayer game), or the effort and ability to learn it
      Compensation:
      Since the game currently has no funding, we can split whatever revenue the game makes in the future. However if you would perfer I can create 2D and/or 3D assets for whatever you need in return for your time and work.
      It's a very open and chill enviornment, where you'll have relative creative freedom. I hope you are interested in joining the team, and have a good day!
       
      To apply email me at mangemason@yahoo.com
    • By davejones
      Is there a way to automatically change the start position of an animation? I have a bunch of animations set up on 3D models in unity. The issue is that I need to move the 3D models, however when I do so the animation start positions are not updated and I have to do it manually.

      Changing the transform of key frames is time consuming with the amount of animations I have, so I was wondering if there was a way to do it automatically?
    • By MoreLion
      hey all! We are looking for members for our Unity horror game! 
      Here’s the story:
      After a deadly virus plunges the world into chaos killing 85% of the human population there are now what they call “zones” these zones are watched very closely by the surviving government, people are checked every day for the virus, even if you touch the spit or any human waste or fluids of the victim who is infected, you will die. But one day, people in the west zone start to go missing, 1 woman goes outside the walls to uncover the mystery, is there more to the virus than meets the eye?, That is where your story starts.
      This game is not a long development game, I have loads other game ideas,
      I will also allow you to have a bit of creative freedom if you wish to add or share a idea!
      And no, it’s not a zombie game lol I feel like zombie games are too generic, in this game you will encounter terrifying beasts!
      There is some concept art one of our concept artists have made
      If interested email liondude12@gmail.com
    • By Canadian Map Makers
      GOVERNOR is a modernized version of the highly popular series of “Caesar” games. Our small team has already developed maps, written specifications, acquired music and performed the historical research needed to create a good base for the programming part of the project.

      Our ultimate goal is to create a world class multi-level strategic city building game, but to start with we would like to create some of the simpler modules to demonstrate proof of concept and graphical elegance.

       

      We would like programmers and graphical artists to come onboard to (initially) create:

      A module where Province wide infrastructure can be built on an interactive 3D map of one of the ancient Roman Provinces.
      A module where city infrastructure can be built on a real 3D interactive landscape.
      For both parts, geographically and historically accurate base maps will be prepared by our team cartographer. Graphics development will be using Blender. The game engine will be Unity.

       

      More information, and examples of the work carried out so far can be found at http://playgovernor.com/ (most of the interesting content is under the Encyclopedia tab).

       

      This project represents a good opportunity for upcoming programmers and 3D modeling artists to develop something for their portfolios in a relatively short time span, working closely with one of Canada’s leading cartographers. There is also the possibility of being involved in this project to the point of a finished game and commercial success! Above all, this is a fun project to work on.

       

      Best regards,

      Steve Chapman (Canadian Map Makers)

       
  • Advertisement
  • Popular Now

  • Forum Statistics

    • Total Topics
      631385
    • Total Posts
      2999705
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!