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

Collision detection

$
0
0

@Maybeking wrote:

Hello !
Me again with my game engine !
I have an other little problem with my physic engine ...
I take some pieces of code of Humper (https://github.com/aloisdeniel/Humper) to make a collision detection and response velocity based, but there is something I can't solve :

Every update, I have an entity who is velocity is set by that :

Step 1 :
velocity += (acceleration - friction * velocity) * gameTime.ElapsedGameTime.TotalSeconds

Then i calculate collision and if a collision is found, base on the velocity value (wich is the next move of my entity), I get a value wich corresponds to how I must decrease the velocity to avoid the colliion. It looks like this:

Step 2 :
float collisionResponse = FindCollision(myEntity) (value between 0 and 1)
velocity *= collisionResponse

And finally, I increase my entity position as much as the velocity is, multiplied by the GameTime to smooth the movement and avoid frame drop :

Step 3 :
position += velocity * gameTime.ElapsedGameTime.TotalSeconds

And everything works fine, I have a good value of gravity, I have good and smooth movements, my entity does'nt go through platform, etc ...

Except one thing : The FindCollision() return the exact value wich make my entity beside the platform (Step 2), but then in the Step 3, when I add the velocity I must multiply that exact velocity by the elapsed time wich make my velocity slower too soon so my entity slow down before he is next to the platform when he should stop when he has reaches it.

Can you help me ? I know the problem come from the gameTime.ElapsedGameTime.TotalSeconds but I dont know what to do because if I remove this, my entity go very very too fast.
Thanks !

(Sorry if you did'nt understand something, just tell me and I'll try to say it in another way (I'm french and I dont like Google Translate :P)(Oh ! A bracket in another bracket !))

Just a sketch of how its made:

Posts: 5

Participants: 3

Read full topic


Is it possible to load a video in from file. Not thru the content pipline.

$
0
0

@willmotil wrote:

To say i normally load from the content pipeline which is fine for like a intro video or such.

VideoController.video = content.Load(FileName);

However lets say i want to allow the user to select a video from file in any folder on his drive to load it and play it. I wouldn't want to have to build the file after the game is already installed or running.

Something like.

var s = GetUserSelectedFullFilePath();
VideoController.video = Video.FromFile(s);

I don't see anyway to do it directly but id like to have that functionality is there a way to do this ?.

Posts: 2

Participants: 2

Read full topic

c# question

$
0
0

@Mattlekim wrote:

I know this is not technical the correct place but I'm not a member on any other programming forum so am hopping you can help me out. I have the follow code.

 uicomponates.Add(
                new UiFrame("design", ScreenHelper.Size, AnchorState.All)
                {
                    BgColour = Color.Transparent, //dont display the background
                    Componates = new List<UiClass>()
                    {
                        new Button("bntOk", new Vector2(100,50), parent),
                    }
                });

Now what I am trying to do is pass in the uifram class in to the button class where you see the variable 'parent'
Now I know I can do this another way by create the Uiframe. Then create the button and pass uiframe in.
What I am interested in is if there is any way to do it in the above method?

Thank you for any light you can shed on this.

Posts: 5

Participants: 4

Read full topic

Huge memory usage on some machines

$
0
0

@THakker wrote:

Hi yet again

I have weird problem with my DesktopGL game. On some machines my content loading eats huge amount of memory (2-3GB) leading to System.OutOfMemoryException. Its hard to debug because on my hardware it uses only 200-300MB. Problem might be related to culture/location differences.
Tester was running Windows 7 (I think), on ~5 years old laptop, with 8GB Ram, i7 26xx and HD6700M series.

I'm not sure but it seems that game loads initial content smoothly, but when I start going through Tiled maps (I use Tiled Map Editor for level design) it starts eating memory.

I use https://github.com/dmanning23/TiledSharp/blob/master/Tiled.cs for loading Tiled files, and have modified it a little bit. Loading uses a lot of TryParse and TryGetValue. To avoid problems caused by culture related settings, I use

CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
ci.NumberFormat.CurrencyDecimalSeparator = ".";

and load values with lines like

int.TryParse(reader.GetAttribute("tilewidth"), NumberStyles.Any, ci, out result.FirstTileID);
float.TryParse(reader.GetAttribute("opacity"), NumberStyles.Any, ci, out result.Opacity);

I'm not 100% sure if the problem is in the Tiled loading, but because the game shows Loading Screen it cannot be in my first Content Loader function that loads Textures, Font and Sounds.

Game currently uses MonoGame 3.7.0.213.

Any help is appreciated :slight_smile:

Posts: 1

Participants: 1

Read full topic

Monogame on windows + Visual studio code

$
0
0

@coby wrote:

Hi,

Does anyone know if it's possible to use Visual studio code to run monogame applications on windows? I've seen some old threads about this but nowhere is it claimed that it either works or doesn't.

BR,
Robert

Posts: 2

Participants: 2

Read full topic

Bug with windows desktop directx and maximize

$
0
0

@Mattlekim wrote:

Hi iv noticed what I think to be a bug with the scaling when maximizing screen.
If I make the window bigger by dragging the edge of the screen. monogames correctly changes the backbuffer :slight_smile:

however if I click on the maximize button the resolution stays the same and everything is scaled automatically i.e. stretched to fit the window. Now I'm not taling about entering full screen. This is still windows mode but maximized. Is this intentional? If so shouldn't the mouse scale as well?

Also noted that when clicking maximize button Window.ClientSizeChanged even does not fire.

Posts: 2

Participants: 2

Read full topic

Cannot Install Templates on VS 2017

(Question)Triangle culling


Fullscreen bug with low resolutions

$
0
0

@CSharpCoder wrote:

The resolutions are taken from GraphicsAdapter.DefaultAdapter.SupportedDisplayModes
My screen is 1920x1080
Any resolution above 1280x960 works fine in fullscreen. However 1280x960 and below becomes borderless without filling the screen when fullscreen is enabled. If the resolution changes when the it's already fullscreen with a resolution above 1280x960 for example 1920x1080 to 1280x960 or below it works as intended. Also generally low resolutions becomes stretched and blurry. A game like Rogue Legacy that was made with XNA always looks good no matter the resolution, it has the same selection of resolutions.

Posts: 7

Participants: 2

Read full topic

Animation and fbx

$
0
0

@skyemaidstone wrote:

I've just about got everything working now from porting to mg from xna. The only thing left is animation.

Im using my own content processor based on an old xna project someone made called better skinned. My animations worked great in xna. I could loop, change speed, rewind etc.

After porting it to mg they still sort of work except it looks like the model is starting in its binding position (t pose). Rather than the first keyframe.

I tried exporting from 3ds and xsi and using the fbx convertor.

I also tried kosmonauts modelviewer which is nice and it plays my animations with the same problem.

Has anyone gone through this problem already and knows what tweak i need to make?

Posts: 4

Participants: 2

Read full topic

SoundEffectInstance - Memory consumption

$
0
0

@CKalt wrote:

Hey,

I am working on my own game using MonoGame v. 3.6.
Currently, I am implementing the sound of my game, where I am using SoundEffectInstances to play some background music.
I have read over some topics and have seen a response by @nkast.
There, he has created a loop using the LoadContent() and Unload()-methods of the content manager and created some SoundEffectInstances. The observation was that the memory consumption was increasing steadily.
In my current work, I share these observations.

My question is:
What can I do to minimize the memory consumption created by the SoundEffectInstances?

I have thought of a pool of SoundEffectInstances and reusing the already stopped ones... but are there other ideas or way to do so?
Or have I completely missed something?

Thank you in advance!

Posts: 7

Participants: 4

Read full topic

Where can I download Monogame Visual Studio Templates?

$
0
0

@DanielG wrote:

I accidentally messed up one of the Monogame templates for Visual Studio. Is there a place I can download it without reinstalling Monogame?

Posts: 1

Participants: 1

Read full topic

Keyboardinput delayed

$
0
0

@harryh100 wrote:

Hi there,

in some of our apps we have the problem that the keyboard input on Windows 10 is delayed (iskeydown) which makes the game possible to play. If you press a key it will be transmitted sometimes about 2 seconds after you hit it. If you hit a key just for a tenth of a second iskeyup will also be called after a few seconds (sometimes).
What makes it even more strange is that it doesn´t happen all the time. Sometimes it works and on some machines it works always.
Did anybody see that problem before and know what can be done against it?

Thanks,
Harry

Posts: 5

Participants: 3

Read full topic

zbuffer rendering problem

$
0
0

@Mattlekim wrote:

Hi I have an issue with may game.

I render the world and that works fine.
When I load up my building select menu it previews the building.
The problem is the depth buffer stops part of the building rendering.

Iv posted an image below.
Is there a way to clear the buffer / depth buffer?

as you can see the black parts are the where the world is interfering with the render.

Posts: 2

Participants: 2

Read full topic

what program do you use to draw images?

$
0
0

@Bulent_Gozen wrote:

hello everyone,
i use paint and a sprite maker program. but my friends find my images too simple. should I use different programs to create more realistic images? could you tell me about them. thanks

Posts: 1

Participants: 1

Read full topic


freetype6.dll error.

$
0
0

@congeokar wrote:

I have a computer with windows 10 and visual studio 2017
for community. I have installed from the site monogame 3.6
(the latest) . Trying pipeline for .spritefont appears the known error
Cannot load module freetype6.dll Font processor failed !!!!
Do you know the cause of this and a reliable method to eliminate it? Can you make available to the public
a clean solution (distribution 3.7 perhaps)?.

Posts: 1

Participants: 1

Read full topic

Print to page

$
0
0

@TheGrovesy wrote:

Hi there. I want to create an application to allow someone to design table top board games. The ideas is you can add floor textures, add walls and then drag drop images to add detail such as tables, bloody splats cars, all from a top down perspective. Users can then print them out onto paper. I started doing some feasibility in c# winforms using gdi+.

However I have now decided the board designs would look much better if light sources could be added which will illuminate all the graphics around it and maybe cast shadows (maybe also use normal maps). I think gdi+ library wouldn't be capable of this. So I was thinking maybe using monogame.

I haven't used it yet but have experience in C#. Can any users please tell me if this would be possible ( which I'm sure it will be) and more importantly tell me if it will be possible to then somehow send the 'map' to a file for ready formatted for printing (large maps should be automatically split across multiple A4 pages, or whatever size the user chooses)

Any tips or links to what might help would be great.

Posts: 4

Participants: 3

Read full topic

Playing video on Android

$
0
0

@Looney wrote:

Hello,

I am trying to play a video (mp4) on the Android platform but I am currently having some issues.

I have tried to use the VideoPlayer class as seen in this sample: https://github.com/CartBlanche/MonoGame-Samples/tree/master/VideoPlayer. However, I am just getting a blank screen and nothing seems to be happening.

I have had better success using the MediaPlayer class where I am able to hear the video but unable to view it. This is my first post and I am very new to working with Android and quite new to MonoGame too, so I don't have a lot of experience.

Thanks.

Posts: 1

Participants: 1

Read full topic

Building for Mac/Linux on Windows with Visual studio

$
0
0

@Jijjy wrote:

Hi, I have a solution with DesktopGL and Android projects sharing code in a PCL. It currently builds fine for Windows and Android, but I want to be able to build for Linux and macOS - how can I do this?

Posts: 2

Participants: 2

Read full topic

How to obtain the underlying backbuffer render target

$
0
0

@Ultima124 wrote:

I'm trying to implement a screen shot function but I can't find out how to obtain a reference to the underlying backbuffer render target. Whenever I worked with native DirectX I always used this to quickly save screenshots but I can't seem to find anything about it in Monogame.

Posts: 1

Participants: 1

Read full topic

Viewing all 6666 articles
Browse latest View live




Latest Images