Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 05 Oct 2004
Offline Last Active Today, 03:27 AM

Topics I've Started

Updating a WPF ListBox SelectedIndex

06 November 2014 - 02:37 AM

Hey folks,


I'm getting back in to some C# development (2D editor using Monogame/WPF) and must be missing something completely obvious with ListBoxes...


When I add a level to my game project, I refresh the list box displaying the project's levels like this :


Guid activeLevel = myEngineController.ActiveLevel;

List<Level> projectLevels = engine.Project.Levels;
foreach( Level level in projectLevels )
  myLevelList.Items.Add( level.Name );
  if( level.Id == activeLevel && activeLevel != Guid.Empty )
    myLevelList.SelectedIndex = myLevelList.Items.Count - 1;

So here myLevelList is my ListBox instance.


While this works programmatically (the ListBox instance gets the correct 'SelectedValue', 'SelectedIndex'), the UI isn't updated; there is no blue selection box around the currently selected item.


Any idea what else I need to do here?

Paradox Impressions?

17 October 2014 - 12:02 PM

Heya people,


I just heard that the Paradox engine (http://paradox3d.net/) has gone open source, and was wondering if anyone has had much experience using it?




[answered] Component objects with data driven design

16 October 2014 - 01:59 AM

Hey folks,


I'm messing around with a small project in my spare time (a 2D editor using Monogame), and am in the process of designing a data driven component-object system.


So the basic idea is that at runtime the editor parses all JSON files in a project's data directory, adding each Object to a content library. Users in the editor will be able open up the content browser and drag/drop objects in to the game world... all fairly simple stuff.


The objects in my engine are component based. The engine defines a set of fairly common components (graphic/physics/audio) but what I'd like to be able to do is have the JSON files define components that are unique to the Game... class types that the editor isn't aware of.


As an example :

 "class" : "Object",
 "Name" : "Jim",
 "Health" : "50",
 "Components" : [
      "class" : "GraphicComponent",  // defined by Engine
      "image" : "jim.png"
      "class" : "PlayerController",  // defined by Game

So my question comes down to how to handle this in the editor when I'm deserializing this Object... obviously the editor isn't going to know what to do with the PlayerController class, and I don't want to throw a bunch of exceptions when trying to load an object.


I'm looking at using JSON.NET, and was wondering if it's possible to build a custom deserializer so I can just ignore any class types that the editor doesn't know about?


Thanks for the advice!

[Fixed... kind of] MonoGame effects with VS2012 & Windows 8

12 November 2013 - 02:04 PM

Hi there,
I'm having a bit of trouble setting up a content project (for my desktop application) using  Windows 8 and visual studio 2012, was wondering if anyone here could point me in the right direction.
MonoGame 3.0.1 is installed, along with the Windows Phone 8 SDK. I've added a content project and what is essentially a content builder to my MonoGame solution, but the only viable option that I could find for the project type is a Windows Phone Game.
This works without any issues when building .xnb textures, but I can't build any of my effect files as Windows Phone projects don't support custom effects.
Is there any way I can get around this, or am I going to have to roll back to Windows 7?
Thanks for your help!

SSAO issues [Fixed]

08 August 2013 - 03:23 AM

Hey folks,


I'm working through an excellent article on SSAO (http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/a-simple-and-practical-approach-to-ssao-r2753) but am having troubles generating sensible data. Although the scene looks reasonably well lit using the SSAO technique, the map isn't exactly what I'm expecting.


I'm have a deferred render, so I have to reconstruct both the normals & positions in view space, which I do like this :

// Given the supplied texture coordinates, this function will use the depth map and inverse view projection
// matrix to construct a view-space position
float4 CalculateViewSpacePosition( float2 someTextureCoords )
 // Get the depth value
 float currentDepth = DepthMap.Sample( DepthSampler, someTextureCoords ).r;
 // Calculate the screen-space position
 float4 currentPosition;
 currentPosition.x = someTextureCoords.x * 2.0f - 1.0f;
 currentPosition.y = -(someTextureCoords.y * 2.0f - 1.0f);
 currentPosition.z = currentDepth;
 currentPosition.w = 1.0f;
 // Transform the screen space position in to view-space 
 currentPosition = mul( currentPosition, ourInverseProjection );

 return currentPosition;

// Reads in normal data using the supplied texture coordinates, converts in to view-space
float3 GetCurrentNormal( float2 someTextureCoords )
 // Get the normal data for the current point
 float3 normalData = NormalMap.Sample(NormalSampler, someTextureCoords).xyz;
 // Transform the normal in to view space
 normalData = normalData * 2.0f - 1.0f;
 normalData = mul( normalData, ourInverseProjection );
 return normalize(normalData);

So the scene that I'm rendering (without any lights) looks like this. The individual cube faces seem to have different colour values, where as I would expect the difference to be where the cubes have a common edge:




But the SSAO buffer isn't exactly what I would expect (I would think there would be black lines running down the crevasses ) :




My guess is that the way I'm calculating my view-space normals must be messed up - but any suggestions from the audience would be greatly appreciated smile.png


This is what I'm outputting from the SSAO shader :

// ambient occlusion calculations

ambientFactor /= 16.0f; // iterations * 4 (for each ambient factor calculated)
return float4( 1.0f - ambientFactor, 1.0f - ambientFactor, 1.0f - ambientFactor, 1.0f );