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

Monogame and VS Community (individual) license

$
0
0

@GaijinFox wrote:

I've got a question regarding the usage of VS Community with Monogame.

From what I read, the best (or only) way to use Monogame is with Visual Studio.

The license of VS Community states that if you're an individual developer you're free to use for whatever purpose you want, but it is not clear to me if it forces you to upgrade to Enterprise/Profesional if your revenue is really high (such as above $1 million) -- it only claims so for "Organizations" and "Enterprises".

So is it ok for me to use VS Community as an individual without having to bother with being forced to pay for an upgraded version of VS in the future, or should I try to use some other IDE (if possible at all)

And yes, I know that earning 1 million as an individual developer is a very unrealistic scenario, but I'm wondering if there are alternatives to Visual Studio.

Posts: 4

Participants: 3

Read full topic


Camera2D and panning

$
0
0

@Gixen wrote:

Does anyone have any good examples on how to do camera panning with MGE? Like right-click and drag to move the camera?

Posts: 4

Participants: 2

Read full topic

Create input form in monogame

$
0
0

@IIRajbirx wrote:

I am creating a simple ping pong game using monogame, is it possible to add windows form style input forms within monogame, i am looking to create a login/game lobby where players can type ip addresses, their name, and change game settings so that they can connect to a running game to play mulitplayer.

I have looked on google but cant seem to find much i am looking for something that can be done on the game screen so i dont have to switch over to a windows form to handle this and then switch back over to the game

Posts: 2

Participants: 2

Read full topic

ContentLoadException in version 3.7.0.1316

$
0
0

@Muggle wrote:

Continuing the discussion from ContentLoadException in version 3.7.0.1232:

My previous version was: 3.7.0.737.

I updated with this link: http://teamcity.monogame.net/repository/download/MonoGame_PackagingWindows/latest.lastSuccessful/MonoGameSetup.exe?guest=1

When I build:

Microsoft.Xna.Framework.Content.ContentLoadException:
'Could not find ContentTypeReader Type. Please ensure the name of the Assembly that
contains the Type matches the assembly in the full type name: Microsoft.Xna.Framework.Content.ReflectiveReader1
[[Microsoft.Xna.Framework.Content.Pipeline.Graphics.MaterialContent, MonoGame.Framework.Content.Pipeline,
Version=3.7.0.1316, Culture=neutral, PublicKeyToken=null]] (Microsoft.Xna.Framework.Content.ReflectiveReader
1
[[Microsoft.Xna.Framework.Content.Pipeline.Graphics.MaterialContent, MonoGame.Framework.Content.Pipeline]])'

This always worked before (cube2 exists and worked before):

public void LoadContent(ContentManager content)
{
    Avatar1 = content.Load<Model>("cube2"); // Exception here

}

Posts: 4

Participants: 2

Read full topic

References missing in Monogame.Extended portable library

$
0
0

@lionelthomas wrote:

When I try to build my project, I get hundreds of unresolved references. Cannot add reference to a portable library. Get this message "All of the framework assemblies are already referenced." How do I resolved all these references?
Thanks

By the way I am using Vs2017 with Nuget Manager

Posts: 4

Participants: 2

Read full topic

Texture Array Backend/Platform Support

$
0
0

@Alan wrote:

Hello there.
This is a simple question so I tried Gitter but didn't get an answer, therefore I'm asking here:
Does DesktopGL support Texture Arrays? What about other platforms? I could be wrong but it seems Texture Arrays in MG are only available in DirectX, especially because I don't think those instructions can be mojoed. When backends/platforms aren't feature paired it would be nice to have that stated somewhere.
Thanks

Posts: 1

Participants: 1

Read full topic

VideoPlayer GetTexture returns null

$
0
0

@Delivous wrote:

I'm just trying to play an mp4 video in my game, but GetTexture always returns null no matter what.

Surely mp4 is supported? And if it isn't, will I have to convert it to another video type?

Code: https://imgur.com/a/NCgFM

Fix?

Posts: 1

Participants: 1

Read full topic

XmlImporter Unexpected Failure - UWP

$
0
0

@alt wrote:

I've been trying to recreate the RolePlayingGame sample found here as a UWP project. It is giving me trouble building the xml content.

To isolate the problem, I have created a new MonoGame Windows 10 Universal (Core Application) solution in Visual Studio. This solution contains two projects: RPG and RPGData.

The RPG project is the main executable project. The only changes I have made to this project are adding, MainGameDescription.xml to the Content folder, and including the xml file in Content.mgcb.

MainGameDescription.xml:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:ns="Microsoft.Xna.Framework">
  <Asset Type="RPGData.GameStartDescription">
      <MapContentName>Map001</MapContentName>
      <PlayerContentNames>
          <Item>Kolatt</Item>
      </PlayerContentNames>
      <QuestLineContentName>MainQuestLine</QuestLineContentName>
  </Asset>
</XnaContent>

Content.mgcb:

 #----------------------------- Global Properties ----------------------------#

 /outputDir:bin/$(Platform)
 /intermediateDir:obj/$(Platform)
 /platform:WindowsStoreApp
 /config:
 /profile:Reach
 /compress:False

 #-------------------------------- References --------------------------------#


 #---------------------------------- Content ---------------------------------#

 #begin MainGameDescription.xml
 /importer:XmlImporter
 /processor:PassThroughProcessor
 /build:MainGameDescription.xml

The RPGData project is a Class Library (Universal Windows) project. I have given it a reference to the same MonoGame.Framework as the RPG project. It contains the GameStartDescription class.

GameStartDescription.cs:

using Microsoft.Xna.Framework.Content;
using System.Collections.Generic;

namespace RPGData
{
    /// <summary>
    /// The data needed to start a new game.
    /// </summary>


    public class GameStartDescription
    {
        #region Map


        /// <summary>
        /// The content name of the  map for a new game.
        /// </summary>


        private string mapContentName;

        /// <summary>
        /// The content name of the  map for a new game.
        /// </summary>


        public string MapContentName
        {
            get { return mapContentName; }
            set { mapContentName = value; }
        }


        #endregion


        #region Party


        /// <summary>
        /// The content names of the players in the party from the beginning.
        /// </summary>


        private List<string> playerContentNames = new List<string>();

        /// <summary>
        /// The content names of the players in the party from the beginning.
        /// </summary>


        public List<string> PlayerContentNames
        {
            get { return playerContentNames; }
            set { playerContentNames = value; }
        }


        #endregion


        #region Quest Line


        /// <summary>
        /// The quest line in action when the game starts.
        /// </summary>


        /// <remarks>The first quest will be started before the world is shown.</remarks>
        private string questLineContentName;

        /// <summary>
        /// The quest line in action when the game starts.
        /// </summary>


        /// <remarks>The first quest will be started before the world is shown.</remarks>
        [ContentSerializer(Optional = true)]
        public string QuestLineContentName
        {
            get { return questLineContentName; }
            set { questLineContentName = value; }
        }


        #endregion


        #region Content Type Reader


        /// <summary>
        /// Read a GameStartDescription object from the content pipeline.
        /// </summary>


        public class GameStartDescriptionReader : ContentTypeReader<GameStartDescription>
        {
            protected override GameStartDescription Read(ContentReader input,
                GameStartDescription existingInstance)
            {
                GameStartDescription desc = existingInstance;
                if (desc == null)
                {
                    desc = new GameStartDescription();
                }

                desc.MapContentName = input.ReadString();
                desc.PlayerContentNames.AddRange(input.ReadObject<List<string>>());
                desc.QuestLineContentName = input.ReadString();

                return desc;
            }
        }


        #endregion
    }
}

Lastly, I have referenced the RPGData project in RPG.

Building the solution gives two errors:

The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"c:\users\user\documents\visual studio 2017\Projects\RPG\RPG\Content\Content.mgcb" /platform:WindowsStoreApp /quiet /outputDir:"bin\WindowsStoreApp\Content" /intermediateDir:"obj\WindowsStoreApp\Content"" exited with code 1.

Importer 'XmlImporter' had unexpected failure!

I am new to MonoGame so this is a bit of trial and error for me. I tried adding a reference to the RPGData library in Content.mgcb, but it gave me some kind of "Library corrupt" error. Should I be placing a reference to the library here?

Upon using fuslogvw (Assembly Binding Log Viewer), I am greeted with two errors. One for MGCB.XmlSerializers and one for SharpDX.Mathematics. Ignoring the SharpDX error for now, here is the MGCB.XmlSerializers log:

*** Assembly Binder Log Entry  (2/24/2018 @ 8:27:48 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = MGCB.XmlSerializers, Version=3.7.0.1279, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MGCB.exe
Calling assembly : System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers/MGCB.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers/MGCB.XmlSerializers.EXE.
LOG: All probing URLs attempted and failed.

At this point, I don't know enough about how the MonoGame Content Pipeline to understand exactly what is going on here.

My understanding is that Content.mgcb contains a list of content as well as what to do with it at build time. In this instance, my Xml file is being imported with XmlImporter. XmlImporter I assume, is a part of the MonoGame Framework. While being imported, the importer looks at the Xml Asset Type tag and serializes to that.

Is this correct? What could I be missing that would cause the build to fail?

Any input is appreciated!

Posts: 1

Participants: 1

Read full topic


DualTextureEffect processor dont load second texture

$
0
0

@TheMaxPirat wrote:

Hi, I'm trying to load models with double UVs and double textures with DualTextureEffect processor same way I did it in XNA and with same models with no luck. I tried different formats and different export settings in Blender, I tried just add textures in UV windows as I did before and I tried making two textures in material/making two material. Did anyone know how to load models with two texture for DualTextureEffect?
I know I can load all second textures separately and set them, but that will be a real pain in my case.

Posts: 1

Participants: 1

Read full topic

Unable to create a MonoGame project using the Windows Store Template (non XAML)

$
0
0

@Brett wrote:

Hello,

I'm attempting to create a MonoGame Windows Store Project (non-XAML version). When I select the project from within Visual Studio and attempt to create the project, the following message is displayed:

The project file ...Game1.csproj cannot be opened.

There is a missing project subtype.
Subtype: '{BC8A1FFA-BEE3-4634-8014-F334798102B3}' is unsupported by this installation.

I'm using VS 2017 and MonoGame Development build 3.7.0.1330.

Unsure what to do next to solve this.

Thanks,
Brett

Posts: 1

Participants: 1

Read full topic

Trouble with Random Crashes of XAudio2_7.dll

$
0
0

@MrDelusive wrote:

Hi Monogame Community,

I have recently been having trouble with a game I am developing where the game freezes and crashes with the error pointing to XAudio2_7.dll. With other issues I can see where the problem is in code, however with this I just get a crash completely. Event Viewer also shows XAudio2_7.dll as the faulting module.

The crashes occur mid way through gameplay at random intervals, usually I believe when there are a high amount of SoundEffectInstances playing.
I have recieved similar issues during a screen transition where I wasn't disposing of SoundEffect and SoundEffectInstances properly, which was resolved by disposing correctly, however with this I am not sure what could be the cause.

Has anyone faced similar issues? My main question though is would there be a way I could properly debug this crash, or are there alternative Sound Effect handling libraries I could use without changing too much?

From what I have read I have seen other people have found it is a common bug with the module as it stops referencing it before completely disposing causing an access violation, but I was unable to find a solution online.

Any help is greatly appreciated.

Posts: 1

Participants: 1

Read full topic

Creating a solution template

$
0
0

@mohaxomaxa wrote:

I've been using MG for a couple of months now, and I realised that there are a few classes (like content managers, game state managers, input managers and so on) that are the same, or almost the same, for every new project I build. The Game1 class also looks pretty much the same in all of my projects, with a state machine, standardized draw loop etc.

Obviously copying them each time to a new project is a waste of time, so I was wondering whether there is any possibility to create a project template that I could re-use every time, just like other in-built MG templates. Do you guys have any solution to this problem? I was thinking about just having a base project that I would load and modify every time I start working on a new game, but changing the namespace label is a bit of a hassle in VS...

Posts: 1

Participants: 1

Read full topic

Monogame Pipeine error

$
0
0

@Yankees6pax wrote:

When I try to add content to the Monogame pipeline I get this error:
Log Name: Application
Source: Application Error
Date: 2/26/18 1:30:17 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: JOHNDA00
Description:
Faulting application name: Pipeline.exe, version: 3.6.0.1625, time stamp: 0x58b6e343
Faulting module name: KERNELBASE.dll, version: 10.0.15063.726, time stamp: 0x1a9bbe0b
Exception code: 0xe0434352
Fault offset: 0x0000000000069d98
Faulting process id: 0x1f9c
Faulting application start time: 0x01d3af2fb228e0bd
Faulting application path: C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\Pipeline.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 68afb141-843b-4544-b864-9f062319afe1
Faulting package full name:
Faulting package-relative application ID:
Event Xml:



1000
2
100
0x80000000000000

6830
Application
JOHNDA00



Pipeline.exe
3.6.0.1625
58b6e343
KERNELBASE.dll
10.0.15063.726
1a9bbe0b
e0434352
0000000000069d98
1f9c
01d3af2fb228e0bd
C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\Pipeline.exe
C:\Windows\System32\KERNELBASE.dll
68afb141-843b-4544-b864-9f062319afe1





and also this:
Log Name: Application
Source: .NET Runtime
Date: 2/26/18 1:30:17 PM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: JOHNDA00
Description:
Application: Pipeline.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.UriFormatException
at System.Uri.CreateThis(System.String, Boolean, System.UriKind)
at MonoGame.Tools.Pipeline.MainWindow.ChooseContentFile(System.String, System.Collections.Generic.List1<System.String> ByRef)
at MonoGame.Tools.Pipeline.PipelineController.Include()
at Eto.Forms.Command.OnExecuted(System.EventArgs)
at Eto.Forms.Command.System.Windows.Input.ICommand.Execute(System.Object)
at Eto.Forms.MenuItem.OnClick(System.EventArgs)
at Eto.Platform.Invoke(System.Action)
at Eto.Wpf.Forms.Menu.MenuItemHandler
3[[System.Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnClick()
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.Controls.MenuItem.InvokeClickAfterRender(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at MonoGame.Tools.Pipeline.Program.Main(System.String[])

Event Xml:



1026
2
0
0x80000000000000

6829
Application
JOHNDA00



Application: Pipeline.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.UriFormatException
at System.Uri.CreateThis(System.String, Boolean, System.UriKind)
at MonoGame.Tools.Pipeline.MainWindow.ChooseContentFile(System.String, System.Collections.Generic.List1&lt;System.String&gt; ByRef)
at MonoGame.Tools.Pipeline.PipelineController.Include()
at Eto.Forms.Command.OnExecuted(System.EventArgs)
at Eto.Forms.Command.System.Windows.Input.ICommand.Execute(System.Object)
at Eto.Forms.MenuItem.OnClick(System.EventArgs)
at Eto.Platform.Invoke(System.Action)
at Eto.Wpf.Forms.Menu.MenuItemHandler
3[[System.Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnClick()
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.Controls.MenuItem.InvokeClickAfterRender(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at MonoGame.Tools.Pipeline.Program.Main(System.String[])



Posts: 1

Participants: 1

Read full topic

MonoGame windows project can only build x86

$
0
0

@Muggle wrote:

I want to be able to build x64 or Any CPU, but it will not let me. I am stuck building into x86.

My MonoGame version is 3.7.0.737. I cannot update to the latest as I had issues with the Content pipeline erroring when loading assets.

Initially I thought Visual Studio Community 2017 was bugged because when I selected x64 in the taskbar dropdown next to Debug and Project Name, then clicked Run, it would not build the latest code changes or message me if there was an error.

This is strange because all other projects i've created with VS work fine, including Monogame UWP project. I've always used the taskbar dropdowns to build and never had this issue before.

I delved into it further and found the following:

R-click project > Properties:
Platform: Active(x86) is the ONLY option in the list.

Platform target contains x86, x64, Any CPU.

Even if I change the Platform target to x64 or Any CPU and manually change the Output path, it will run whatever is in the output folder, but will not build there.

Any ideas?

Posts: 2

Participants: 2

Read full topic

Export Graphics as png on game save and import them on game load?

$
0
0

@Shadowblitz16 wrote:

Does monogame support the following?
-Exporting graphics as png on game save
-Importing graphics as png on game load

preferably in specific sub folders?

I want to make something similar to SMBX which is a super mario editor which stores data like this..

\ root folder
 | world folder
 \ graphics folder
  | npcs folder containing png files for npcs
  | blocks folder containing png files for blocks
  | backgrounds folder containing png files for backgrounds
 \ sound folder
  | npcs folder containing ogg files for npcs
  | blocks folder containing ogg files for blocks
  | backgrounds folder containing ogg files for backgrounds
 \ script folder
  | npcs folder containing lua files for npcs
  | blocks folder containing lua files for blocks
  | backgrounds folder containing lua files for backgrounds

or maybe something like this..

\ root folder
 | npc folder containing folders for each npc
 | blocks folder containing folders for each block
 | background folder  containing folders for each background

this is just a question wondering if monogame can do this?

Posts: 3

Participants: 3

Read full topic


MonoGameJam! is my entry / game for this Jam!

GetData

$
0
0

@Myth wrote:

Hi, I'm trying to extract the colors of the pixels from a texture, but I'm jumping an error. My code is:

Color[] data = new Color[texture.Width * texture.Height];
texture.GetData(data);

And the error is:

HRESULT: [0x887A0005], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_DEVICE_REMOVED/DeviceRemoved], Message: Unknown

If anyone has any idea what may be happening. Thanks in advance.

Posts: 2

Participants: 2

Read full topic

Memory management in MonoGame

$
0
0

@StainlessTobii wrote:

Hi Guys,

I have started porting my terrain system to MonoGame and have come across an interesting issue.

To prevent garbage collections, I have written a memory manager for my renderer.

At boot up it allocates some arrays and uses a grow only allocator

The problem is that C# is manically type safe.

So I cannot read an array of shorts into a buffer in one hit.

As far as I can see the only way to read the data into an array is to loop over each value in the array reading a single short at a time. MUCH , MUCH , too slow.

I have thought about using a binaryformatter, but that doesn't use my memory allocator and everything falls apart.

I have thought about having a temporary byte array, but it is entirely possible that I may have several terrain patches streaming in at the same time, so that becomes impracticable.

So I am going to try using a struct instead of an array and using [StructLayout(LayoutKind.Explicit)] to effectively create a union of two arrays (byte and short). So the code becomes....

ShortHeights.Shorts = RenderMemoryManager.GetShortMemory(RenderMemoryManager.MemoryUsage.HeightMap, 
                                                  AllocationSize, out ShortHandle);
stream.Read(ShortHeights.Bytes, 0, AllocationSize);

Anybody got a better solution

Posts: 3

Participants: 2

Read full topic

Static Class For Xbox Live Integration

$
0
0

@michaelarts wrote:

Hello everyone,

I'm an ID@Xbox developer using MonoGame to release a UWP game on Xbox One. I've programmed a static class that implements all basic Xbox Live functionality. If you're releasing via ID@Xbox or the Creators Club I hope you'll find my code useful. You can simply include my class in your project and begin calling the functions you need. My class handles the following things:

  1. Signing in via the account picker (this is the required method for
    signing in as ID@Xbox developers, as we need to switch users during
    gameplay)

  2. Saving and loading using the ConnectedStorage API.

  3. Required services such as Achievements, Presence and Featured Stats.

  4. Code for implementing a trial version of your game.

Please read the comments at the top to ensure your project is set up properly
to use this class. You can view the code here:

Thanks, and I hope it's useful!

Posts: 1

Participants: 1

Read full topic

Use Penumbra with a custom Matrix

$
0
0

@Raigiku wrote:

I've recently tried to implement the Penumbra library into my game so I could add lights. However, it's using the same matrix that I use for my SpriteBatch, which always follows the player. There's a problem with this since whenever I add a light, the light moves along with the camera instead of being stationary.
Like in this .gif:


Here's the constructor of Game1:
    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        IsMouseVisible = true;
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;
        Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2) - (graphics.PreferredBackBufferWidth / 2),
                                         (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 2) - (graphics.PreferredBackBufferHeight / 2));
        Content.RootDirectory = "Content";
        // Lightning Engine
        penumbra = new PenumbraComponent(this);
        Components.Add(penumbra);
        penumbra.Lights.Add(new PointLight() { Position = new Vector2(720, 350) });
    }

Here's where I call the Draw method from Penumbra:

    protected override void Draw(GameTime gameTime)
    {
        penumbra.BeginDraw();
        controller.DrawObjects(ref spriteBatch);

        base.Draw(gameTime);
    }

This is the other Draw method I use:

    public void DrawObjects(ref SpriteBatch spriteBatch)
    {
        spriteBatch.GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin(transformMatrix: Camera.TransformMatrix());
        foreach (Component component in components)
        {
            component.Draw(ref spriteBatch);
        }
        spriteBatch.End();
    }

And this is my Camera class:

class Camera
{
static Matrix transform;

    public Camera()
    {

    }

    public void Follow(Sprite sprite)
    {
        Matrix position = Matrix.CreateTranslation(
            -sprite.Position().X - (sprite.Rectangle().Width / 2),
            -sprite.Position().Y - (sprite.Rectangle().Height / 2),
            0);
        Matrix offset = Matrix.CreateTranslation(
            Game1.screenWidth / 2,
            Game1.screenHeight / 2,
            0);
        transform = position * offset;
    }

    static public Matrix TransformMatrix() { return transform; }
}

I tried changing the Matrix like it says in the documentation:

But it didn't work for me. Maybe I'm doing something wrong I don't know. Here's the code:

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        IsMouseVisible = true;
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;
        Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2) - (graphics.PreferredBackBufferWidth / 2),
                                         (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 2) - (graphics.PreferredBackBufferHeight / 2));
        Content.RootDirectory = "Content";
        // Lightning Engine
        penumbra = new PenumbraComponent(this);
        Components.Add(penumbra);
        penumbra.SpriteBatchTransformEnabled = false;
        penumbra.Transform = Matrix.CreateTranslation(-720, -400, 0);
        penumbra.Lights.Add(new PointLight() { Position = new Vector2(0, 0) });
    }

And the result:

If you could help me that would be really appreciated.

Posts: 1

Participants: 1

Read full topic

Viewing all 6822 articles
Browse latest View live