Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all 6821 articles
Browse latest View live

ADMob How too, A FULL EXAMPLE

$
0
0

@Paul_Crawley wrote:

For a VERY long time a bunch of people have been asking how to integrate Admob into there Android MonoGame Apps, After traveling around the Web and trying MANY examples, Most in Java and All NEVER a complete guild, I've completed the simplest and FULL example on how to do the simplest way possible using Visual Studio 2017 and the Latest Monogame 3.6 Dev. Here it is.

Firstly after creating your Android App Open "Manage NuGet Packages" (Right click project->Manage NuGet Packages)
Browse search for this "Xamarin.GooglePlayServices.Ads.Lite" and install it

if its a new Project, create an Android manifest (Right Click project->Prooperties->Android Manifest->Create)
Insert the following via editing the Android Manifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
	<uses-permission android:name="android.permission.INTERNET" />
	<!-- Below MUST be put into the manifest to allow the ad to react to the user-->
	<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

Heres and example of MY FULL Manifest

xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="AdController.AdController" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
	<uses-sdk android:targetSdkVersion="22" android:minSdkVersion="22" />
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
	<uses-permission android:name="android.permission.INTERNET" />
	<!-- Below MUST be put into the manifest to allow the ad to react to the user-->
	<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
	<application android:label="AdController"></application>
</manifest>

Next Make a new Class Call it what ever you want, I called Mine AdController my NameSpace/Project was also called AdController so don't forget to change the namespace to yours

Here is the complete code for the Class

using Android.Gms.Ads;

/// <summary>
/// For Ads to work 
/// NuGet Xamarin.GooglePlayServices.Ads.Lite
/// Only then can ads be added to the project
/// 
/// AndroidManifest.xml File
/// add these lines
// 	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
//	  <uses-permission android:name="android.permission.INTERNET" />
//	<!-- Below MUST be put into the manifest to allow the ad to react to the user-->
//	  <activity android:name="com.google.android.gms.ads.AdActivity"
//	  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
///
/// </summary>

namespace AdController
{
  public static class AdController
  {
    public static InterstitialAd interstitial=null;
    // APP ID This is a test use yours from Admob
    private static readonly string appID = "ca-app-pub-3940256099942544~3347511713";
    // AD ID's This is a test use yours from Admob
    private static readonly string adID1 = "ca-app-pub-3940256099942544/1033173712";
    private static readonly string adID2 = "ca-app-pub-YOUR AD ID GOES IN HERE"; // other ads etc

    public static bool adLoaded=false;

    /*********************************************************************************************
     * Function Name : InitAdRegularAd
     * Description : Show a regular full page ad
     * if you need to change the adID, just set interstitial.AdUnitId to point to another adIDx
     * ******************************************************************************************/
    public static void InitRegularAd()
    {
      if(interstitial==null)
      {
        MobileAds.Initialize(Game1.Activity,appID);                                               // initialize the ads        
        interstitial = new InterstitialAd((Activity1)Game1.Activity);
        interstitial.AdUnitId = adID1;                                                            // adID string, can repoint this on the fly
      }
      Game1.Activity.RunOnUiThread(() =>
      {
        if(interstitial.AdListener != null)                                                         // do we already have a listener?        
        {
          interstitial.AdListener.Dispose();                                                        // kill it if we do
        }
        interstitial.AdListener = null;
        var listening = new Listening();
        listening.AdLoaded +=() =>
        {
          if(interstitial.IsLoaded)
          {
            adLoaded = true;
          }
        };
        interstitial.AdListener = listening;
        interstitial.LoadAd(new AdRequest.Builder().Build());
      });
    }
    /*********************************************************************************************
     * Function Name : ShowRegularAd
     * Description : display the ad
     * ******************************************************************************************/
    public static void ShowRegulaAd()
    {
      if(adLoaded)
      {
        adLoaded = false;
        interstitial.Show();
      }
    }
  }


  /*********************************************************************************************
    * Function Name : Listening
    * Description : Listening class for the add
    * ******************************************************************************************/
  internal class Listening : AdListener
  {
    public delegate void AdLoadedEvent();
    public delegate void AdClosedEvent();
    public delegate void AdOpenedEvent();
    // Declare the event.
    public event AdLoadedEvent AdLoaded;
    public event AdClosedEvent AdClosed;
    public event AdOpenedEvent AdOpened;

    public override void OnAdLoaded()
    {
      if(AdLoaded != null)
      {
        this.AdLoaded();
      }
      base.OnAdLoaded();
    }
    public override void OnAdClosed()
    {
      if(AdClosed != null)
      {
        this.AdClosed();
      }
      // load the next ad ready to display
      AdController.interstitial.LoadAd(new AdRequest.Builder().Build());
      base.OnAdClosed();
    }
    public override void OnAdOpened()
    {
      if(AdOpened != null)
      {
        this.AdOpened();
      }
      base.OnAdOpened();
    }
  }
}

And Here is how I called it as an example from MonoGame Game1.cs

/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
private SpriteFont font;
protected override void LoadContent()
{
  // Create a new SpriteBatch, which can be used to draw textures.
  spriteBatch = new SpriteBatch(GraphicsDevice);
  font = Content.Load<SpriteFont>("debugFont");

  // GET AD'S READY TO BE DISPLAYED
  AdController.InitRegularAd();

  // TODO: use this.Content to load your game content here
}

/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// game-specific content.
/// </summary>
protected override void UnloadContent()
{
  // TODO: Unload any non ContentManager content here
}

/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
  if(GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
  {
    Exit();
  }

  // TODO: Add your update logic here

  base.Update(gameTime);
}

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
/// 
double oldCount = 0;
protected override void Draw(GameTime gameTime)
{
  GraphicsDevice.Clear(Color.CornflowerBlue);

  // TODO: Add your drawing code here
  spriteBatch.Begin();
  if(oldCount < gameTime.TotalGameTime.TotalMilliseconds)
  {
    oldCount = gameTime.TotalGameTime.TotalMilliseconds + 3000;
    if(AdController.adLoaded)
    {
      AdController.ShowRegulaAd();
    }
  }
  else
    spriteBatch.DrawString(font,"Waiting on the Next AD!!!",new Vector2(380,300),Color.White);
  spriteBatch.End();

  base.Draw(gameTime);
}

That's it, Nothing else is required to display full page ads, NOT banners and NOT rewards ADS, i'm working on the Reward Type Ad's right now, once i've figured out the simplest way to do it i'll include it in this class and let you guys know. Obviously if anyone can add anything to this let me know, if you have any problems then let me know, i'm only to happy to help.
To use your own AD'S make sure you have an account from ADMOB.COM.
Just one other FYI
Hitting Close on the AD returns back to the App
Hitting the AD to activate it opens a browser, to return to the App NO NOT CLOSE THE BROWSER, AdMob opens the browser as a thread from the App, hit the Back (sideways triangle) to return to your App

Enjoy
Paul

Posts: 1

Participants: 1

Read full topic


[SOLVED] Scale in World matrix messing with GBuffer rendering

$
0
0

@Paphos wrote:

Hi :slight_smile: ! I'm currently struggling with a strange problem in my deferred renderer.

To set a little bit of context : I am rendering each of my 3D models in some GBuffer render-targets. For that, each model has its World matrix created by multiply the model rotation and position.

Everything was working fine, so I decided to add the scale (which is a float value) of the model, to be able to control it at runtime :

Matrix world = Matrix.CreateScale(myModel.Scale) * Matrix.CreateFromQuaternion(myModel.RotationQuaternion) * Matrix.CreateTranslation(myModel.Position)

My problem appears there. These 3 little fox fellows have 3 differents scales (4, 1 and 0.25).
The middle one (scale=1) is correctly lit but the others are not : the big fellow is too dark, the little one too bright. Everything is the same (same lighting, same model ...), only the scale value is different.

By looking into my different render-targets, it seems that the scale is somehow messing with the normal values :

The normal render-target is not supposed to have bright and dark colors like this.
I suspect this line to cause the problem in the pixel shader :

output.Normal = mul(input.Normal, WorldViewIT);

Now I've seen this line in many examples of GBuffer shaders but I don't fully understand what it does, tbh (I'm quite new to shaders).

The WorldViewInvertTranspose variable is calculated like this :

_gBufferEffect.Parameters["WorldViewIT"].SetValue(Matrix.Transpose(Matrix.Invert(myModel.WorldMatrix * viewMatrix)));

We can also note that if I remove the scale component in the world matrix before calculting the WorldViewIT matrix (by multiply by its inverse like below), everything works just fine. But it seems a ugly way to solve my problem, isn't it ?

_gBufferEffect.Parameters["WorldViewIT"].SetValue(Matrix.Transpose(Matrix.Invert(Matrix.Invert(myModel.Scale) * myModel.WorldMatrix * viewMatrix)));`

Is that a common behaviour of GBuffer shaders ? Has anyone trying to add a scale component in its World matrix ?

Posts: 3

Participants: 2

Read full topic

Tinting doesn't work with immediate mode.

$
0
0

@AleCie wrote:

spriteBatch.Begin(sortMode: SpriteSortMode.Immediate,
                        blendState: BlendState.AlphaBlend,
                        samplerState: SamplerState.PointClamp, 
                        /*null,
                        null,
                        null,*/
                        transformMatrix: cam.get_transformation(graphics.GraphicsDevice));

It always draws as white. Can I fix this somehow?

Posts: 2

Participants: 1

Read full topic

How can I clean only a partial area of a RenderTarget2D?

Websites that offer free SFX

Importing meshes at runtime

$
0
0

@Neurological wrote:

Hello everyone again, I'm in the process to finally add asset importers in my project and need a bit of help of where to look for.

I use custom binary formats for meshes and parse them at runtime to get the info I need to make a mesh, and that is where I'm getting some problem as I don't know where to look for t ocreate a mesh that I can feed to Draw, not even sure monogame has any class for that. Th parsing in itself isn't a problem, all my mesh format has is series of Vector3 for vertices, normals and Vector2 for uvs, (also an array of ints for tris).

All the inf oI find around internet is about using the Content pipeline which I want to avoid as I want users to be able to throw their own assets in the game, any of you can direct me on some info on how to draw a custom mesh or if there is some helper in monogame to do so?

Thanks.

Posts: 2

Participants: 2

Read full topic

The content file was not found

Lock Mouse Position

$
0
0

@Sebastian_Stehle wrote:

Hi,

I have issues with mouse locking. I would like to lock the mouse to the current position when I right click. My approach was to set the position to the locked position at the end of every frame and to use relative mouse positions for rotating. But the rotation is not very smooth, i have the impression that I loose mouse updates with this approach. But I have no idea how to solve it in a different way.

Posts: 3

Participants: 2

Read full topic


Error when creating a UWP Game

$
0
0

@DerMoritz98 wrote:

When I try to create a UWP Game for Windows 10 I'm getting the error
The file "D:\ProgramFiles\VisualStudio\Game1\Game1\project.json" wasn't found.

After the first error I'm getting a second error:
The method or operation is not implemented.

When I press ok (my only option), all my project files are gone and only the .sln file is left.

Posts: 1

Participants: 1

Read full topic

Create Cone-Mesh in 3D

$
0
0

@ronnycsharp wrote:

Hi,

I need a solution to build a cone in 3D.
It should be created with a method like this ... CreateCone(float radius, Vector3 head, Vector3 end).
The result of the method should be a Mesh or a Vertex-Array.
A simple algorithm is also sufficient.

Thanks.

Regards
Ronny

Posts: 3

Participants: 2

Read full topic

SSAO Issue

$
0
0

@jnoyola wrote:

EDIT: This used to be about hemisphere-oriented SSAO, but I was having too many difficulties with that and read that it's more susceptible to artifacts, so I changed to spherical, but I'm still having problems (although it's much closer!)

I've loosely been following a number of tutorials, but I'm having a few issues with my SSAO.

This screenshot shows world-space normals, encoded depth, and the ambient occlusion map, with the composition in the background. There's darkness on the floor by the right wall, but not at the base of the wall itself. There's also occasionally a strange cloud of darkness around the head of the torch, but nothing around the base. Additionally, it seems like maybe one of my transformations is incorrect, because all of the ambient occlusion varies so much when the camera moves around.

Here are the main bits of my shader:

// Vertex Input Structure
struct VSI
{
	float3 Position : POSITION0;
	float2 UV : TEXCOORD0;
};

// Vertex Output Structure
struct VSO
{
	float4 Position : POSITION0;
	float2 UV : TEXCOORD0;
	float3 ViewRay : TEXCOORD1;
};

// Vertex Shader
VSO VS(VSI input)
{
	// Initialize Output
	VSO output;

	// Pass Position
	output.Position = float4(input.Position, 1);

	// Pass Texcoord's
	output.UV = input.UV;

	output.ViewRay = float3(
		-input.Position.x * TanHalfFov * GBufferTextureSize.x / GBufferTextureSize.y,
		input.Position.y * TanHalfFov,
		1);

	// Return
	return output;
}

float3 randomNormal(float2 uv)
{
	float noiseX = (frac(sin(dot(uv, float2(15.8989f, 76.132f) * 1.0f)) * 46336.23745f));
	float noiseY = (frac(sin(dot(uv, float2(11.9899f, 62.223f) * 2.0f)) * 34748.34744f));
	float noiseZ = (frac(sin(dot(uv, float2(13.3238f, 63.122f) * 3.0f)) * 59998.47362f));
	return normalize(float3(noiseX, noiseY, noiseZ));
}

//Pixel Shader
float4 PS(VSO input) : COLOR0
{
	//Sample Vectors
	float3 kernel[8] =
	{
		float3(0.355512, -0.709318, -0.102371),
		float3(0.534186, 0.71511, -0.115167),
		float3(-0.87866, 0.157139, -0.115167),
		float3(0.140679, -0.475516, -0.0639818),
		float3(-0.207641, 0.414286, 0.187755),
		float3(-0.277332, -0.371262, 0.187755),
		float3(0.63864, -0.114214, 0.262857),
		float3(-0.184051, 0.622119, 0.262857)
	};

	// Get Normal from GBuffer
	half3 normal = DecodeNormalRGB(tex2D(GBuffer1, input.UV).rgb);
	normal = normalize(mul(normal, ViewIT));

	// Get Depth from GBuffer
	float2 encodedDepth = tex2D(GBuffer2, input.UV).rg;
	float depth = DecodeFloatRG(encodedDepth) * -FarClip;

	// Scale ViewRay by Depth
	float3 position = normalize(input.ViewRay) * depth;

	// Construct random transformation for the kernel
	float3 rand = randomNormal(input.UV);

	// Sample
	float numSamplesUsed = 0;
	float occlusion = 0.0;
	for (int i = 0; i < NUM_SAMPLES; ++i) {

		// Reflect the sample across a random normal to avoid artifacts
		float3 sampleVec = reflect(kernel[i], rand);

		// Negate the sample if it points into the surface
		sampleVec *= sign(dot(sampleVec, normal));

		// Ignore the sample if it's almost parallel with the surface to avoid depth-imprecision artifacts
		//if (dot(sampleVec, normal) > 0.15) // TODO: is this necessary for our purposes?
		//{
			// Offset the sample by the current pixel's position
			float4 samplePos = float4(position + sampleVec * SampleRadius, 1);

			// Project the sample to screen space
			float2 samplePosUV = float2(dot(samplePos, ProjectionCol1), dot(samplePos, ProjectionCol2));
			samplePosUV /= dot(samplePos, ProjectionCol4);

			// Convert to UV space
			samplePosUV = (samplePosUV + 1) / 2;

			// Get sample depth
			float2 encodedSampleDepth = tex2D(GBuffer2, samplePosUV).rg;
			float sampleDepth = DecodeFloatRG(encodedSampleDepth) * -FarClip;

			// Calculate and accumulate occlusion
			float diff = 1 * max(sampleDepth - depth, 0.0f);
			occlusion += 1.0f / (1.0f + diff * diff * 0.1);
			++numSamplesUsed;
		//}
	}

	occlusion /= numSamplesUsed;
	return float4(occlusion, occlusion, occlusion, 1.0);
}

I'd really appreciate if anyone could give me a hand, because I've been stuck on this for a few days scouring the web and these forums. Thanks!

Posts: 1

Participants: 1

Read full topic

Arabic Text Support

$
0
0

@nightblade wrote:

Hi,

Is Arabic text (right-to-left, letter shaping, etc.) supported with MonoGame on any platforms?

The only reference I can find is this thread which mentions that Arabic/Hebrew support could be better.

I'm not talking about input, merely that I can translate my game and calls to DrawString will render Arabic text correctly on some platforms.

Posts: 2

Participants: 1

Read full topic

PBR Point light fault (BRDF)

$
0
0

@egodamonra wrote:

Hi everyone,
I have a small problem that I can't seem to wrap my head around. I've build a Frankensteins' monster shader from example code by Kosmonautgame's very intense shaders and the Monogame community members indirect help. I broke them down in to smaller shader so I can understand them a little removing complex stuff like Temporal-AA etc.

[Problem] Using Monogame 3.6, rendered with graphics.GraphicsProfile = GraphicsProfile.HiDef; @4K
My shader seems to be working just fine for the most part; this is what I see on launch.

At this point (ignoring not having IBL in the PBR engine at the moment) we can clearly see that there is a point light about mid way past the body and the lighting looks correct.

This is what happens if my Camera moves in side the light radius, and it gets worse the close I get to it, I moved much closer with the camera for the screen shot here.

As you can see, it's lighting the background even though there is no geometry or anything there to light.
It does fade from the center to the edge exactly as a point light should.

Note: If you were wondering about the images at the top, the in order (left-right) Albedo buffer, Defuse Buffer, Spec Buffer, the rest are just post process effects like Grayscale, Guasian blur etc.

Here is a cut of the PixelshaderFunction, my current guess is that its either to do with depth, or a clamping issue, but that's just me guessing.

float3 specularColor = float3(1, 1, 1);
float4 Specular = float4(0, 0, 0, 0);
float4 Diffuse = float4(0, 0, 0, 0);

float F0 = tex2D(specularTransmittanceAOSampler, input.TexCoord).r;
float AO = tex2D(specularTransmittanceAOSampler, input.TexCoord).a;


float3 PointLightDirection = position.xyz - PointLightPosition;
float DistanceSq = lengthSquared(PointLightDirection);
float radius = PointLightRadius;


//----------------------------


if (DistanceSq < abs(radius * radius))
{
	Diffuse = AO;

	if (F0 == 0) {
		F0 = lerp(0.04f, albedo.g * 0.25 + 0.75, metallic);
	}

	if (tex2D(specularTransmittanceAOSampler, input.TexCoord).r > 0) {
		specularColor = albedo.rgb * lightColor;
	}
	else {
		specularColor = lightColor * (1 - F0);
	}


	float Distance = sqrt(DistanceSq);

	//normalize
	PointLightDirection /= Distance;

	float du = Distance / (1 - DistanceSq / (radius * radius - 1));

	float denom = du / abs(radius) + 1;

	//The attenuation is the falloff of the light depending on distance basically
	float attenuation = 1 / (denom * denom);
	

	float3 N = normalize(normal);
	float3 L = normalize(PointLightDirection);
	float3 V = normalize(position.xyz - cameraPosition);

	float3 H = normalize(-L + V);
	float NdL = clamp(dot(N, -L), 1e-5, 1.0);
	
	Diffuse *= float4(DiffuseOrenNayar(NdL, N, -L, -V, lightIntensity, lightColor, 1 - roughness) * attenuation, 0);
	Specular = float4(SpecularCookTorrance(NdL, N, -L, -V, lightIntensity, specularColor, F0, roughness)* attenuation, 0);
}


output.Color0 = Diffuse * (1 - F0);
output.Color1 = Specular;
return output;

Any ideas?

Posts: 1

Participants: 1

Read full topic

Unable to retrieve OpenGL version on Mac

$
0
0

@viniciusjarina wrote:

Hello using the beta version of MG plugin on VS4M I am getting this crash trying to run MG for Mac
MG: "3.7.0.678"
MG Extensions: 3.7.0.1

at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformSetup () [0x000db] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Setup () [0x00033] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor (Microsoft.Xna.Framework.Graphics.GraphicsAdapter adapter, Microsoft.Xna.Framework.Graphics.GraphicsProfile graphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x00130] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor (Microsoft.Xna.Framework.GraphicsDeviceInformation gdi) [0x00013] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice
(Microsoft.Xna.Framework.GraphicsDeviceInformation gdi) [0x00009] in <63c3d7339bae45a7b5f9be2367f3b391>:0

at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00029] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice () [0x00000] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00016] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <63c3d7339bae45a7b5f9be2367f3b391>:0
at TestMG3.MacOS.Program.Main (System.String[] args) [0x0000e] in /Users/viniciusjarina/projects/TestMG3/TestMG3/Main.cs:22

Posts: 1

Participants: 1

Read full topic

Why use base.Initialize(), base.Draw() and base.Update() anymore?

$
0
0

@mohaxomaxa wrote:

Hi! I have a question for you guys about the base.Initialize(), base.Draw() and base.Update() methods.

From what I read in the documentation, calls to base.Initialize(), base.Draw() and base.Update() are included in the Initialize(), Draw() and Update() methods of the main class for the sake of initializing, updating and drawing all Game Components. However, I've seen opinions on StackExchange a while back (sorry, I'm not able to find these posts anymore so no link) that Game Components are obsolete, and it's not a good idea to rely on them. I think it had something to do with you having no control over the order in which the components are updated and drawn.

Soooo, is there any point to calling these base methods anymore?:sweat_smile: From what I can see the base.Draw() and base.Update() calls can be omitted with no further action required, and if you manually call LoadContent() at the end of Initialize(), you can omit calling base.Initialize() as well. Is there any other reason for calling those?

Thanks in advance for your replies :relaxed:

Posts: 4

Participants: 3

Read full topic


Access Violation Issue

$
0
0

@PlayerEXE wrote:

Hey guys, I've been working on this Game for School for a while now, I took about a month break from working on it and i come back and i see that Visual Studio cant start the game up anymore. It says:
The program '[9584] GoldExp.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

It doesn't make any sense, because compared to the last time i tested it, i literally added in nothing new, it should still work. The only thing i did Differently was i had to Log into Visual Studio. Anyone have a Solution to this, I really kind of need to finish it.

Posts: 1

Participants: 1

Read full topic

[DesktopGL] Failed to create graphics device!

$
0
0

@Green127_Studio wrote:

Hi everyone,

I have a problem with MonoGame 3.6.0.1625, I use the DesktopGL template for one of my game currently on sale on steam and I regularly receive bug reports like this one:

NoSuitableGraphicsDeviceException: Failed to create graphics device!	
  Module "Microsoft.Xna.Framework.GraphicsDeviceManager", line 54, col 0, in CreateDevice
	Void CreateDevice()
  Module "Microsoft.Xna.Framework.GraphicsDeviceManager", line 0, col 0, in Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice
	Void Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice()
  Module "Microsoft.Xna.Framework.Game", line 22, col 0, in DoInitialize
	Void DoInitialize()
  Module "Microsoft.Xna.Framework.Game", line 45, col 0, in Run
	Void Run(Microsoft.Xna.Framework.GameRunBehavior)
  File "Program.cs", line 463, col 21, in ‎​‪​​‍​‍‫‭‭‪​‫‭‎‬​‏‭​‌‍‪‌‮
	Int32 ‎​‪​​‍​‍‫‭‭‪​‫‭‎‬​‏‭​‌‍‪‌‮()
PlatformNotSupportedException: MonoGame requires OpenGL 3.0 compatible drivers, or either ARB_framebuffer_object or EXT_framebuffer_object extensions.Try updating your graphics drivers.
  Module "OpenGL.GraphicsContext", line 57, col 0, in .ctor
	Void .ctor(OpenGL.IWindowInfo)
  Module "Microsoft.Xna.Framework.Graphics.GraphicsDevice", line 37, col 0, in PlatformSetup
	Void PlatformSetup()
  Module "Microsoft.Xna.Framework.Graphics.GraphicsDevice", line 51, col 0, in Setup
	Void Setup()
  Module "Microsoft.Xna.Framework.Graphics.GraphicsDevice", line 306, col 0, in .ctor
	Void .ctor(Microsoft.Xna.Framework.Graphics.GraphicsAdapter, Microsoft.Xna.Framework.Graphics.GraphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters)
  Module "Microsoft.Xna.Framework.GraphicsDeviceManager", line 9, col 0, in CreateDevice
	Void CreateDevice(Microsoft.Xna.Framework.GraphicsDeviceInformation)
  Module "Microsoft.Xna.Framework.GraphicsDeviceManager", line 30, col 0, in CreateDevice
	Void CreateDevice()

.

	Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device! ---> System.PlatformNotSupportedException: MonoGame requires OpenGL 3.0 compatible drivers, or either ARB_framebuffer_object or EXT_framebuffer_object extensions.Try updating your graphics drivers.
	   in OpenGL.GraphicsContext..ctor(IWindowInfo info)
	   in Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformSetup()
	   in Microsoft.Xna.Framework.Graphics.GraphicsDevice.Setup()
	   in Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters)
	   in Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation gdi)
	   in Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()
	   --- Fine della traccia dello stack dell'eccezione interna ---
	   in Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()
	   in Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice()
	   in Microsoft.Xna.Framework.Game.DoInitialize()
	   in Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
	   in .() in Program.cs:line 463
	Inner Exception:
	System.PlatformNotSupportedException: MonoGame requires OpenGL 3.0 compatible drivers, or either ARB_framebuffer_object or EXT_framebuffer_object extensions.Try updating your graphics drivers.
	   in OpenGL.GraphicsContext..ctor(IWindowInfo info)
	   in Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformSetup()
	   in Microsoft.Xna.Framework.Graphics.GraphicsDevice.Setup()
	   in Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters)
	   in Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation gdi)
	   in Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()

the exception is thrown at the start of the Game.Run().

I have seen on the forum that the release 3.6 contained a bug if we use:
GraphicsDeviceManager.PreferMultiSampling = true;

I removed this line from my code but I continue to receive these error reports and the game is runing on a rather recent hardware, reinstalling the drivers and reboot does not solve the problem either.
the last report I have received if from a computer with a Radeon RX 460 Graphics with up to date driver so I guess the ARB_framebuffer_object and EXT_framebuffer_object should be ok.

What could be the source of this error?

Posts: 1

Participants: 1

Read full topic

Looking for some server/client advice

$
0
0

@HietpasGames wrote:

Hey,

I have a pretty big game and I've been moving into a multiplayer setup using authoritative server/client model. I have it all running but I'm concerned about certain areas. My game has players running around, doing various actions, but nothing intense like a FPS where the millisecond matters.

Quick background:
First, the clients have their own collision and prediction systems, they do what the player instructed, then it contacts the server who verifies validity. If data is valid, no news is sent back to the originating client and the valid data is sent to the other clients. I've read up on server/client concepts (e.g. http://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html). I'm using a slightly different approach. I don't contact the original client if server agrees. Only failure, does the server respond to the originator of the request.

  1. For those with experience in authoritative server/client, is this an okay approach? I don't want to box myself in later.

  2. I'm torn on how much logic to put on the client side. For example, if a player drops an item, should I...

    a) Send command to server, stating dropping item, server confirms validity, sends that data to all clients? (Player has to wait for response due to round trip to server, could be 50-200ms and it could seem sluggish)
    b) Client drops item because locally it sees it is valid, sends command to server, server confirms validity, sends data to other clients? (Player has no lag response)

Now (a) is the easiest because it requires less client logic and you really only rely on the server but you get into small lag conditions. (b) is more player friendly in terms of lag but if a violation is detected, you have to reverse everything on the player (remove item from floor, put the item back in inventory, etc...)

Currently my movement system is using (b) because it needs to be responsive. My item drop system is using (a). I'm concerned lag will make players mad. I'm looking for advice on anyone who has experience in this area. I'd prefer to use (a) as much as possible because it is simpler.

Thanks,
David

Posts: 1

Participants: 1

Read full topic

Time to load Textures

$
0
0

@Quazars wrote:

Hello everyone, I'm just wondering what sorts of loading times I should be expecting when I'm loading Texture2D's.

So far 1250 images takes around 60 seconds(.png of sizes 400x400). Which is not that bad on its own but considering I'll have up to a few thousand images more I'd love to have it as fast as possible to avoid loading times being longer than necessary.

Now of course I will not be loading everything at once, or even to the same Content Manager. So there is no real issue, it's just me being curious what the norm is because I had an issue before with my .xnb file sizes so just making sure there are is nothing weird going on that I missed.

Essentially my question is, is there a way to quicken up the loading times of Textures?

Thanks in advance.

Posts: 2

Participants: 2

Read full topic

Making some Game Dev Tutorials :)

$
0
0

@SolitudeEnt wrote:

Hey Everyone,

I have started making some Game Dev Tutorials here:

I am planning to put out 2-3 per week I started with an empty windows project and I will go until this is a real game. So far there are 6 tutorials which cover the beginning stuff, but there is plenty more to come. I hope this helps some of you to get started making games!

Please let me know if you have any questions either here or on YouTube, I would be happy to answer anything that I can.

Posts: 3

Participants: 2

Read full topic

Viewing all 6821 articles
Browse latest View live