Sprite Distortion (Ghosting While Moving and Artifacts when Mirroring to External Display)

I am working on my first MonoGame project. I love the framework so far!

I have implemented my own letterbox/pillarboxing to scale my native resolution by the maximum integer scale allowable on my display. Basically, I determine the maximum integer scale, set my PreferredBackBuffer to the screen resolution, create a Viewport that is my native resolution * maximum scale, and then set my SpriteBatch to draw everything at Matrix.CreateScale(max_scale).

This works much better than rendering to a texture that has my native resolution and then scaling it up. (Scaling using a Matrix in SpriteBatch, as opposed to just rendering to a texture and then scaling it up, allows you to fake “subpixel rendering” to some extent).

That said, I am facing two issues.

  1. When my sprite moves, there is very subtle “ghosting” happening. The sprite is subtly blurry and there’s a faint ghostly trail behind it.

  2. When I mirror to an external monitor, there is less ghosting, but there is ugly artifacting on the outside of sprite when stationary. See below.

enter image description here

Rounding my player’s position to integers in the Draw() command doesn’t help for either problem.

Does anyone have any thoughts about how to fix these issues?

Here is my game class:

using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input;  namespace MyMonoGame {     public class MyGame : Game     {         // declare variables         GraphicsDeviceManager graphics;         SpriteBatch sprite_batch;          // resolution management         int native_width;         int native_height;         int screen_width;         int screen_height;         int max_scale;         int horizontal_margin;         int vertical_margin;          // objects         Player player;          public MyGame()         {             // create GraphicsDeviceManager instance             graphics = new GraphicsDeviceManager(this);             // specify root directory             Content.RootDirectory = "Content";         }          protected override void Initialize()         {             // set window title             this.Window.Title = "My Game";              // create SpriteBatch instance, which can be used to draw textures.             sprite_batch = new SpriteBatch(GraphicsDevice);              // initialize some variables             native_width = 160;             native_height = 144;              // resolution management             // get screen size             screen_width = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;             screen_height = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;             // get max_scale, the maximum integer scale that will fit on the screen             // note: must be integer to prevent pixel distortion             int width_divisor = (int) Math.Floor((float)screen_width/(float)native_width);             int height_divisor = (int) Math.Floor((float)screen_height/(float)native_height);             max_scale = Math.Min(width_divisor, height_divisor);             // get margins for letterboxing and pillarboxing             int max_width = native_width * max_scale;             int max_height = native_height * max_scale;             horizontal_margin = (int)((screen_width - max_width)/2f);             vertical_margin = (int)((screen_height - max_height)/2f);              // toggle fullscreen             graphics.PreferredBackBufferWidth = screen_width;             graphics.PreferredBackBufferHeight = screen_height;             graphics.ToggleFullScreen();             GraphicsDevice.Viewport = new Viewport(horizontal_margin, vertical_margin, native_width * max_scale, native_height * max_scale);             graphics.ApplyChanges();              // objects             player = new Player(this);         }          protected override void LoadContent()         {         }          protected override void UnloadContent()         {         }          protected override void Update(GameTime gameTime)         {             if (Keyboard.GetState().IsKeyDown(Keys.Escape))                 Exit();              // update objects             player.Update(gameTime);         }          protected override void Draw(GameTime gameTime)         {             // clear window & fill with solid color             GraphicsDevice.Clear(Color.DarkRed);              // draw objects             var transform_matrix = Matrix.CreateScale(max_scale);             sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, transformMatrix: transform_matrix);             player.Draw(sprite_batch);             sprite_batch.End();         }     } } 

If a character casts Fog Cloud around themselves before moving away from an enemy, do they provoke an opportunity attack?

Our party was forced to brawl against a group of orcs in order to gain their respect to speak with their chieftain (long story, we had very good reason for doing this). It then became a battle royale.

Our wizard was at low health and next to our paladin, and had the idea to cast fog cloud to capture himself and the paladin within it so he could leave combat. He cast the spell, and then came down to the debate of whether the paladin would get an opportunity attack even though she was blinded.

The wizard was in threat range, but does an effect that causes an area to become heavily obscured cause the Paladin to lose threat range and the wizard be able to successfully flee to another area of the ring?

Or does the paladin still have threat range and attack the wizard, even with fog cloud covering both of them?

I looked over the rules for 15 minutes after this situation, but nothing came up. It was ruled in-game that it was fine to make an opportunity attack with disadvantage, but that just doesn’t feel right. She might have heard the wizard stepping away, but the fog cloud was already in place. By the D&D rules, would the paladin have been able to make the opportunity attack or not?

Moving my character makes environnement jerky

I’m learning to make a Tilebased game with Unity and for that I use the Zelda alttp assets. I just have Tiles, a Camera and a moving Character with a rigidbody2D and a CircleCollider.

When the Camera follows the Character, the scene feels Jerky.

Info: Anisotropic Textures: Disabled Anti Alising: Disabled The Camera uses the 2D Pixel Perfect package. The Character is moving via Rigidbody2D.MovePosition() in the FixedUpdateMethod:

MovePosition(_rb.position + moveDirection * (isWalking ? walkSpeed : runSpeed) * Time.fixedDeltaTime); 

moveDirection is calculated in the Update() Method

 moveDirection = Vector2.ClampMagnitude(transform.right * xInput + transform.up * yInput, 1f); 

You can see the result here: https://youtu.be/MA2zZPME5X4

Plotting the electric field from a moving charge in 3D

I want to show a 3D electric field changing with time in response to the path of a moving charged particle. I have an animation of a particle traveling along a helical path using the parametrization for a helix (cos[t],sin[t], t). I took derivatives of this parametrization to find velocity and acceleration and using geometrized units (q=e0=c=1), subbed this into the equation for the E field of a moving particle :enter image description here

My plan was to make animations for the moving particle and changing field separately and then show them together. So far I was able to get the moving particle but I can’t get an animation for the changing E field yet. I’m thinking this is because I have an E[t] whereas Vectorplot3D needs an x,y,z so I’m not sure how to proceed. Any suggestions would be helpful. Many thanks!

My code so far is as follows. I’m not very adept at this kind of thing yet so I apologize that my code is not as clear as it could be, hopefully what I’m trying to do is clear. (Note – I used a z component of t/4 to adjust the height of the helix to look nice in the animation and I used z=8 in my r’ because that appears to be the total height the helix reaches.)

   Animate[ParametricPlot3D[{Cos[t], Sin[t], t/4}, {t, 0, u},    ImageSize -> Small,    MeshFunctions -> {#4 &},    Mesh -> {{u}},    MeshStyle -> Red,    Method -> {"BoundaryOffset" -> False},    PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}] /.    Point -> (Sphere[#, 0.15] &), {u, 10^-8, 30}, AnimationRate -> 0.12]   Rvector = {-Cos[t], -Sin[t], 8 - t/4};  Rnorm = Norm[Rvector];  Vvector = {-Sin[t], Cos[t], 1/4};   Vnorm = Norm[Vvector];  Alpha = Rvector/Rnorm - Vvector;  a = {-Cos[t], -Sin[t], 0};  Evector =    Rnorm/(4*\[Pi] (Rvector.Alpha)^3) ((1 - Vnorm^2)*Alpha +       Cross[Rvector, Cross[Alpha, a]]);  Ex = Evector[[1]];  Ey = Evector[[2]]; Ez = Evector[[3]];  Animate[VectorPlot3D[{Ex, Ey, Ez}, {x, -5, 5}, {y, -5, 5}, {z, -5,     5}], {t, 10^-50, }] 

enter image description here

Moving SQL Server Database Files to New Location – Why permission error?

I was trying to move a database (.mdf + .ldf) to a different directory on the same server hosting the SQL server. I followed these steps found in this link:

  1. ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE

  2. ALTER DATABASE MyDB SET OFFLINE

  3. ALTER DATABASE MyDB MODIFY FILE (Name = MyDB, Filename = ‘N:\DATA\MyDB.MDF’)

  4. ALTER DATABASE MyDB SET ONLINE

  5. ALTER DATABASE MyDB SET MULTI_USER

How do I move SQL Server database files?

When I got to Step4, I got “Access Denied”. Unfortunately, my maintenance windows were very short and no time to troubleshoot. So I decided to drop the database and restored it using the WITH MOVE clause to place the DB files in the right directory. No issue.

My question is why did I get “Access Denied”? I didn’t change MSSQL service account. It’s the same account that ran the RESTORE.

Thanks

Can you do anything after moving into an occupied space?

This is inspired by and is a branching off of the question “Move into nonhostile space attack and move”


The section on “Moving Around Other Creatures” states:

[…] Whether a creature is a friend or an enemy, you can’t willingly end your move in its space […]

The is also the following unofficial ruling (tweet) from lead game designer Jeremy Crawford:

Q. Can a character move into a space occupied by their ally, make an attack from that space, and then move away?

A. You can’t willingly stop moving in another creature’s space.

Both the question mentioned at the beginning and the Crawford quote explain that you cannot move into an occupied space, make an attack, and move away; however, perhaps there are other things you could do instead? Basically, what counts as “ending your move”?

Can you do any of the following after moving into an occupied space but before leaving it?

  • Take any sort of action
  • Take any sort of bonus action
  • Take any sort of reaction
  • Do something that requires no action whatsoever, such as talking, or dropping concentration

Why it’s never switching cameras and not moving back to the original position the transform?

using System; using System.Collections; using System.Collections.Generic; using UnityEngine;  public class OpenningScene : MonoBehaviour {     [Header("Animators")]     public Animator[] animators;      [Space(5)]     [Header("Movement Settings")]     public Transform target;     public float movingSpeed = 1f;     public bool slowDown = false;      [Space(5)]     [Header("Rotation Settings")]     public float rotationSpeed;     public DepthOfField dephOfField;     public float waitingAnimation;     public float startConversation;      [Space(5)]     [Header("Cameras")]     public Camera[] cameras;      private Vector3 targetCenter;     private bool startWaitingAnim = true;     private bool endRot = false;     private int medea_m_arrebola_index;     private List<int> soldiers_indexs;     private Vector3 originalPosition;      // Use this for initialization     void Start()     {         originalPosition = transform.position;          targetCenter = target.GetComponent<Renderer>().bounds.center;         soldiers_indexs = new List<int>();          for (int i = 0; i < animators.Length; i++)         {             animators[i].SetFloat("Walking Speed", movingSpeed);              if(animators[i].name == "medea_m_arrebola")             {                 medea_m_arrebola_index = i;             }             else             {                 soldiers_indexs.Add(i);             }         }     }      // Update is called once per frame     void Update()     {         if (dephOfField.dephOfFieldFinished == true)         {             PlayConversations.PlaySingleConversation(0);             dephOfField.dephOfFieldFinished = false;         }          float distanceFromTarget = Vector3.Distance(animators[medea_m_arrebola_index].transform.position, target.position);          if (slowDown)         {             if (distanceFromTarget < 10)             {                 float speed = (distanceFromTarget / 10);                 for (int i = 0; i < animators.Length; i++)                 {                     animators[i].SetFloat("Walking Speed", speed);                 }             }         }          if (distanceFromTarget < 5f)         {             for (int i = 0; i < animators.Length; i++)             {                 animators[i].SetBool("Idle", true);                  if (startWaitingAnim == true)                 {                     StartCoroutine(WaitForAnimation());                     startWaitingAnim = false;                 }             }              if (waitinganimation == true)             {                 animators[medea_m_arrebola_index].SetBool("Magic Pack", true);                 waitinganimation = false;                  PlayConversations.PlaySingleConversation(1);             }              if(distanceFromTarget > 10 && BeginningCutsceneTrigger.entered == true)             {                 transform.position = originalPosition;                 cameras[0].enabled = false;                 cameras[1].enabled = true;             }              for (int i = 0; i < soldiers_indexs.Count; i++)             {                 animators[soldiers_indexs[i]].SetBool("Rifle Aiming Idle", true);                 if (!endRot)                 {                     Quaternion goalRotation = Quaternion.Euler(0f, 0f, 0f);                     float angleToGoal = Quaternion.Angle(                             goalRotation,                             animators[soldiers_indexs[i]].transform.localRotation);                     float angleThisFrame = Mathf.Min(angleToGoal, rotationSpeed * Time.deltaTime);                      int index = soldiers_indexs[i];                     animators[index].transform.Rotate(index % 2 == 0 ? Vector3.up : Vector3.down, angleThisFrame);                      // We end if we rotated the remaining amount.                     endRot = (angleThisFrame == angleToGoal);                 }             }         }     }      bool waitinganimation = false;     IEnumerator WaitForAnimation()     {         yield return new WaitForSeconds(waitingAnimation);          waitinganimation = true;     } } 

Maybe the reason is that the player is not in the view range of the other characters ? If I set it to be bigger then 3 it will switch the cameras but not move the transform to it’s original position.

And I want that when the distance is bigger then 10 and the other flag is true then change the transform position and switch the cameras but it’s not working.

This is how I trigger the flag and it’s working I checked with a break point :

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class BeginningCutsceneTrigger : MonoBehaviour {     public static bool entered = false;      private void OnTriggerEnter(Collider other)     {         entered = true;     } } 

Moving Document Library to a subsite in SharePoint

Currently, we have Document Libraries created in SharePoint Online and would like to move them using Powershell to its own Subsite. The reason we would like to move them is that we would like to keep the version history. Since we are dealing with 1000s of files, I would like to use Powershell to complete this task.

I am currently connecting to my SharePoint site using:

Connect-PnPOnline -Url “Sitename” -UseWebLogin

Here is where I need assistance. I am trying to use Move-PnPFolder but I am not sure how to write a command that would define the source, destination, and move of all files in the document library to a subsite that I have manually created.

Help please?