_id
int64
0
49
text
stringlengths
71
4.19k
12
How do you create an over world styled like Pok mon Black and White, with both 2D and 3D elements? The over world of Pok mon white uses 3D models for objects like houses, and 2D sprites for characters like the player. What would I have to do to create an over world styled like this? Here is an example
12
Textures do not render on ATI graphics cards? I'm rendering textured quads to an orthographic view in XNA through hardware instancing. On Nvidia graphics cards, this all works, tested on 3 machines. On ATI cards, it doesn't work at all, tested on 2 machines. How come? Culling perhaps? My orthographic view is set up like this Matrix projection Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0, 0, 1) And my elements are rendered with the Z coordinate 0. Edit I just figured out something weird. If I do not call this spritebatch code above doing my textured quad rendering code, then it won't work on Nvidia cards either. Could that be due to culling information or something like that? Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone) ... spriteBatch.End() Edit 2 Here's the full code for my instancing call. public void DrawTextures() Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, textureEffect) while (texturesToDraw.Count gt 0) TextureJob texture texturesToDraw.Dequeue() spriteBatch.Draw(texture.Texture, texture.DestinationRectangle, texture.TintingColor) spriteBatch.End() if !NOTEXTUREINSTANCING no work to do if (positionInBufferTextured gt 0) device.BlendState BlendState.Opaque textureEffect.CurrentTechnique textureEffect.Techniques "Technique1" textureEffect.Parameters "Texture" .SetValue(darkTexture) textureEffect.CurrentTechnique.Passes 0 .Apply() if ((textureInstanceBuffer null) (positionInBufferTextured gt textureInstanceBuffer.VertexCount)) if (textureInstanceBuffer ! null) textureInstanceBuffer.Dispose() textureInstanceBuffer new DynamicVertexBuffer(device, texturedInstanceVertexDeclaration, positionInBufferTextured, BufferUsage.WriteOnly) if (positionInBufferTextured gt 0) textureInstanceBuffer.SetData(texturedInstances, 0, positionInBufferTextured, SetDataOptions.Discard) device.Indices textureIndexBuffer device.SetVertexBuffers(textureGeometryBuffer, new VertexBufferBinding(textureInstanceBuffer, 0, 1)) device.DrawInstancedPrimitives(PrimitiveType.TriangleStrip, 0, 0, textureGeometryBuffer.VertexCount, 0, 2, positionInBufferTextured) now that we've drawn, it's ok to reset positionInBuffer back to zero, and write over any vertices that may have been set previously. positionInBufferTextured 0 endif
12
Get Specific depth values in Kinect (XNA) I'm currently trying to make a hand finger tracking with a kinect in XNA. For this, I need to be able to specify the depth range I want my program to render. I've looked about, and I cannot see how this is done. As far as I can tell, kinect's depth values only work with pre set ranged found in the depthStream. What I would like to do is make it modular so that I can change the depth range my kinect renders. I know this has been down before but I can't find anything online that can show me how to do this. Could someone please help me out? I have made it possible to render the standard depth view with the kinect, and the method that I have made for converting the depth frame is as follows (I've a feeling its something in here I need to set) private byte ConvertDepthFrame(short depthFrame, DepthImageStream depthStream, int depthFrame32Length) int tooNearDepth depthStream.TooNearDepth int tooFarDepth depthStream.TooFarDepth int unknownDepth depthStream.UnknownDepth byte depthFrame32 new byte depthFrame32Length for (int i16 0, i32 0 i16 lt depthFrame.Length amp amp i32 lt depthFrame32.Length i16 , i32 4) int player depthFrame i16 amp DepthImageFrame.PlayerIndexBitmask int realDepth depthFrame i16 gt gt DepthImageFrame.PlayerIndexBitmaskWidth transform 13 bit depth information into an 8 bit intensity appropriate for display (we disregard information in most significant bit) byte intensity (byte)( (realDepth gt gt 8)) if (player 0 amp amp realDepth 00) white depthFrame32 i32 RedIndex 255 depthFrame32 i32 GreenIndex 255 depthFrame32 i32 BlueIndex 255 omitted other if statements. Simple changed the color of the pixels if they went out of the pre set depth values else tint the intensity by dividing by per player values depthFrame32 i32 RedIndex (byte)(intensity gt gt IntensityShiftByPlayerR player ) depthFrame32 i32 GreenIndex (byte)(intensity gt gt IntensityShiftByPlayerG player ) depthFrame32 i32 BlueIndex (byte)(intensity gt gt IntensityShiftByPlayerB player ) return depthFrame32 I have a strong hunch it's something I need to change in the int player and int realDepth values, but i can't be sure.
12
How should I handle shared classes between the Game project and the Content Extension Library? I've been using XNA for a while but recently I've needed to write a content extension library which I haven't done before. I need to import a TextureAtlas class from a file that is exported by a tool I wrote. The output of my editor is a serialized XML file that contains a list of all StaticImages and Animations in the TextureAtlasFile class that its serialized from. In my solution I have the TextureAtlasContentLoader project which holds all of the classes that I will need for the texture atlas both in game and for loading the actual content. The importer deserializes the xml back to a TextureAtlasFile and the processor converts it to a TextureAtlas to return after it is loaded. The problem is that I have no idea how to share the classes between the content extension project and the game project that will be using the TextureAtlas class. I've tried referencing the content extension project in the game project and that works fine to get me pass compiling but it throws a ContentLoadException exception when I call textures Game1.content.Load lt TextureAtlas gt ("MainMenu") saying Error loading "MainMenu". Cannot find type Client.Render.TextureAtlas, TextureAtlasContentLoader, Version 1.0.0.0, Culture neutral, PublicKeyToken null. The only other clue to whats wrong I have is a warning while compiling that says Warning 2 The referenced assembly "Microsoft.Xna.Framework.Content.Pipeline, Version 4.0.0.0, Culture neutral, PublicKeyToken 842cf8be1de50553, processorArchitecture x86" could not be resolved because it has a dependency on "Microsoft.Build.Framework, Version 4.0.0.0, Culture neutral, PublicKeyToken b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version v4.0,Profile Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. Client which leads me to believe I'm not supposed to reference it in the game project. So to summarize my question, how do I handle my TextureAtlas and TextureHandle class that both the content loader and the game project need without causing errors?
12
Multi colored text and kerning Drawing multi colored text or highlighted text in XNA MonoGame is pretty annoying, and the standard way I've seen to do it is to just to make multiple SpriteBatch.DrawString calls, and place them using the x coordinates given by SpriteFont.MeasureString. This is fine if you're highlighting whole words or blocks of text, but if you only want to highlight select letters inside of a word, you get a kerning nightmare Sometimes this looks alright, but not consistently and I can't think or find a good way to space out the letters properly. Therefore, I would like to know if there's either a better way to draw highlighted text like this in XNA MonoGame, or a way to pull kerning data out of a font so I can space the letters properly or some other fancy way to do it using masks or whatnot. Thanks in advance!
12
Orthographic Camera Zooming In XNA I am using a spritebatch to render a board. I have created a camera class which can provide me a view and projection matrix. Currently I am supplying the view matrix to my sprite batch when I call begin. I can get the view matrix to correctly move everything around and do some zooming in and out. My problem is that I want to zoom in on a specific point (for now the center of the screen) but currently zooming just zooms in on the coordinate 0,0. Here is how I am constructing the view matrix ViewMatrix Matrix.CreateTranslation( new Vector3( ( Position.X Width Zoom 2), ( Position.Y Height Zoom 2), 0) ) Matrix.CreateScale(new Vector3( Zoom, Zoom, 1)) How could this be altered to make it scale correctly relative to the given point. Later I will probably want to zoom to the mouse position, but if someone has a simple example I'm sure I can work out how to adapt it.
12
Units issue when exporting from 3DS Max to XNA I am working on a XNA game where we have defined that 1 XNA unit equals to 1 meter. Then, I set meters as system unit in 3DS Max and set to meters the units in the FBX exporter. However, when I export my models, they are much bigger in the game. Am I missing something? What should I do to avoid problems with my units? Investigating the FBX file, I noticed that I it has two values called UnitScaleFactor and OriginalUnitScaleFactor. They both are 100 when I export the files... And if I manually change UnitScaleFactor to 1, it works fine S
12
XNA Networking gone totally out of sync I'm creating a multiplayer interface for a game in 2D some of my friends made, and I'm stuck with a huge latency or sync problem. I started by adapting my game to the msdn xna network tutorial and right now when I join a SystemLink network session (1 host on PC and 1 client on Xbox) I can move two players, everything is ok, but few minutes later the two machines start being totally out of synchronization. When I move one player it takes 10 or 20 seconds (increasing with TIME) to take effect on the second machine. I've tried to Create a thread which calls NetworkSession.Update() continuously as suggested on this forum, didn't worked. Call the Send() method one frame on 10, and the receive() method at each frame, didn't worked either. I've cleaned my code, flushed all buffers at each call and switched the host and client but the problem still remain... I hope you have a solution because I'm running out of ideas... Thanks SendPackets() code protected override void SendPackets() if ((NetworkSessionState)m networkSession.SessionState NetworkSessionState.Playing) Only while playing Write in the packet manager m packetWriter.Write(m packetManager.PacketToSend.ToArray(), 0, (int)m packetManager.PacketToSend.Position) m packetManager.ResetPacket() flush Sends the packets to all remote gamers foreach (NetworkGamer l netGamer in m networkSession.RemoteGamers) if (m packetWriter.Length ! 0) FirstLocalNetGamer.SendData(m packetWriter, SendDataOptions.None, l netGamer) m packetWriter.Flush() m m packetWriter.Seek(0, 0) ReceivePackets() code public override void ReceivePackets() base.ReceivePackets() if ((NetworkSessionState)m networkSession.SessionState NetworkSessionState.Playing) Only while playing if (m networkSession.LocalGamers.Count gt 0) Verify that there's at least one local gamer foreach (LocalNetworkGamer l localGamer in m networkSession.LocalGamers) every LocalNetworkGamer must read to flush their stream Keep reading while packets are available. NetworkGamer l oldSender null while (l localGamer.IsDataAvailable) Read a single packet, even if we are the host, we must read to clear the queue NetworkGamer l newSender l localGamer.ReceiveData(m packetReader, out l newSender) if (l newSender ! l oldSender) if ((!l newSender.IsLocal) amp amp (l localGamer FirstLocalNetGamer)) Parsing PacketReader to MemoryStream m packetManager.Receive(new MemoryStream(m packetReader.ReadBytes(m packetReader.Length))) l oldSender l newSender m packetReader.BaseStream.Flush() m packetReader.BaseStream.Seek(0, SeekOrigin.Begin) m packetManager.ParsePackets()
12
How to create simple acceleration in a 2D sprite? So here's what I thought might work but half the time I press the 'Right' key, it results in a crash and the rest of the time seems to produce no acceleration at all. if (KeyboardState.IsKeyDown(Keys.Right)) while (motion.X lt 1) motion.X 0.001f motion.X I want to know why exactly it won't work, and any possible alternate algorithms.
12
XNA clip plane effect makes models black When using this effect file float4x4 World float4x4 View float4x4 Projection float4 ClipPlane0 void vs(inout float4 position POSITION0, out float4 clipDistances TEXCOORD0) clipDistances.x dot(position, ClipPlane0) clipDistances.y 0 clipDistances.z 0 clipDistances.w 0 position mul(mul(mul(position, World), View), Projection) float4 ps(float4 clipDistances TEXCOORD0) COLOR0 clip(clipDistances) return float4(0, 0, 0, 0) technique pass VertexShader compile vs 2 0 vs() PixelShader compile ps 2 0 ps() all models using this are rendered black. Is it possible to render them correctly?
12
displaying image on modelmesh with transparency i have a modelmesh that has a image on it. When i draw the modelmesh i get the image but i also get a black bacground. The image is png and transparent and is added in 3ds max(i don't give it coordinates to be drawn, it sits on the modelmesh). How can i make the black background transparent? Here is my drawing code foreach (BasicEffect effect2 in modelMesh) effect2.DiffuseColor Color.White.ToVector3() effect2.LightingEnabled true effect2.AmbientLightColor new Vector3(1, 1, 1) effect2.Projection camera.projectionMatrix effect2.View camera.viewMatrix effect2.World transforms modelMesh.ParentBone.Index gameobject.orientation effect2.Alpha 1 modelMesh.Draw()
12
Performance architectural implications of calling SpriteBatch.Begin End in many different places? I notice some code samples only call SpriteBatch.Begin and SpriteBatch.End in the game's main draw method and then draw everything within that method through direct SpriteBatch.Draw calls or indirect calls through method calls from other classes that store a reference to the SpriteBatch object and then use its Draw method. Another approach I see is that in these separate classes they call SpriteBatch.Begin and SpriteBatch.End before their drawing code in each of these classes and don't rely on already being contained within a drawing session (between a begin and end call). My question is two fold. Firstly, as the title suggests, what are the performance implications of calling SpriteBatch.Begin End in all these separate classes so often (once per class per drawing update) versus just calling it the one time each update. Secondly, and this question is a a bit more subjective but, which design is generally preferable? Thanks.
12
2D tilemap editor UI how do I disable editing while save load dialog is open? I'm working on a basic 2D tilemap editor in C XNA. Currently, it displays the map through a picturebox through which XNA's output is being routed, and editing is accomplished through simply checking mouse position (i.e., Is it within the picture box? If so, what tile is it on?). The problem I'm having is that this results in the map being edited through other windows. For example, when trying to save a map, any clicks in the savefiledialog window will edit the map square beneath it, including the click on "Ok" or "cancel." I believe this is the offending snippet of code from the Game1 class protected override void Update(GameTime gameTime) Camera.Position new Vector2(hscroll.Value, vscroll.Value) MouseState ms Mouse.GetState() if ((ms.X gt 0) amp amp (ms.Y gt 0) amp amp (ms.X lt Camera.ViewPortWidth) amp amp (ms.Y lt Camera.ViewPortHeight)) Vector2 mouseLoc Camera.ScreenToWorld( new Vector2(ms.X, ms.Y)) if (Camera.WorldRectangle.Contains( (int)mouseLoc.X, (int)mouseLoc.Y)) lt right there if (ms.LeftButton ButtonState.Pressed) .... Two questions. Is this even a viable way to display the map in the map editor? I'd like to be able to pan, zoom, etc. in the future, as well as select multiple tiles at once and edit their properties. How do I stop the picturebox from registering clicks while other windows are in focus? I've tried adding amp amp PictureBox.Focused to the if statement up there, but that stops it from accepting input at all, regardless of whether there's another window over it (apparently, "focus" doesn't mean what I thought it meant in this context). Confession this is my first attempt at Winform programming. Please excuse my lack of experience. UPDATE amp amp pictureBox.Focused didn't work, but amp amp pictureBox.Capture did. Still feels a little sloppy, but it works now. I have no confidence that this solution is correct, so I'm not closing the question just yet something tells me there's a more correct way, and I'd like to know about it. UPDATE2 Using Capture has introduced a new bug right clicks don't register reliably (i.e., only around one in ten clicks) until minimizing and restoring the window, after which they register correctly. Rage.
12
How can I fill a Color from a Texture2D given a Rectangle in SharpDX? I used to fill a Color using XNA's Texture2D.GetData lt T gt (int, Rectangle?, T , int, int) method, but there doesn't seem to be an equivalent overload on SharpDX's Texture2D. Anyone know how I can get this same functionality with SharpDX? EDIT How can I fill a Color from a SharpDX.Toolkit.Graphics.Texture2D given a Rectangle in SharpDX?
12
XNA draw texture font and DrawIndexedPrimitives at the same time When i Draw a texture2d or a font with spriteBatch and also draw GraphicsDevice.DrawIndexedPrimitives, the frame is draw weird SpriteBatch spriteBatch new SpriteBatch(GraphicsDevice) BasicEffect basicEffect new BasicEffect(GraphicsDevice) protected override void Draw(GameTime gameTime) GraphicsDevice.Clear(Color.LightSteelBlue) RasterizerState rasterizerState new RasterizerState() rasterizerState.CullMode CullMode.None GraphicsDevice.RasterizerState rasterizerState for(...) GraphicsDevice.SetVertexBuffer(vertexBuffer) GraphicsDevice.Indices indexBuffer foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) pass.Apply() GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 20) end for spriteBatch.Begin() spriteBatch.DrawString(MainFont, "FPS " Math.Round(1 (float)gameTime.ElapsedGameTime.TotalSeconds, 2), new Vector2(200, 10), Color.Red) spriteBatch.End() How can i solve this ?
12
Multiplayer XNA without a LIVE account? (PC) I decided it was time to stick in a bit of multiplayer into my game, but came across my first hurdle when i quickly downloaded an example from the XNA website. It prompted me with a login to live. However i really DO NOT want my game to use live accounts. This is PC btw. Basically i wanted to know, is it possible to have multiplayer with XNA without logging in through a live account? Also, is it better to stick with the built in XNA networking, or use a totally different library such as lidgren?
12
Keeping 2D camera within game bounds I have a simple camera class which works for following my character around, and has an adjustable zoom. However, I cannot figure out how to keep the camera within the bounds of the world. As far as I know, I can't just pull the X and Y coordinates of the Transform, so I don't know how to check if it is out of bounds. Help greatly appreciated. using Microsoft.Xna.Framework using System using System.Collections.Generic using System.Linq using System.Text using System.Threading.Tasks namespace Game10 class Camera protected float zoom public Matrix Transform get private set public Camera() zoom 1f public void DecreaseZoom() if (Input.IsZoomDecrease()) zoom 0.25f if ( zoom lt 0.25f zoom 0.25f public void IncreaseZoom() if (Input.IsZoomIncrease()) zoom 0.25f if ( zoom gt 4f zoom 4f public void Follow(Player target) var position Matrix.CreateTranslation( target.Position.X (target.Bounds.Width 2), target.Position.Y (target.Bounds.Height 2), 0) var offset Matrix.CreateTranslation( Platformer.ScreenWidth zoom 2, Platformer.ScreenHeight zoom 2, 0) var zoom Matrix.CreateScale( zoom, zoom, 1) Transform position offset zoom
12
XNA Static classes from game libraries executing after content pipeline extensions, how to avoid the problem? Alright, formulated this way I'm sure it sounds obscure, but I'll do my best to describe my problem. First, let me explain what's wrong with my real source code. I'm making a platformer, and here are the current components of my game a Level, which is holding its own grid of tiles and also the tile sheets and a Tile, which just keeps the name of its tile sheet and index within the tile sheet. All these are within a separate XNA game project, named GameLib. Here is how my levels are formatted in a text file x x . . . . . . . . b g r . . . . . . . . X X X X X X X Where . represents an empty tile, b represents a blue platform, X represents a block with a random color, etc. Instead of doing all the work of loading a level within the Level class, I decided to take advantage of the content pipeline extension and create a LevelContentPipelineExtension. As soon as I started, I quickly realized that I didn't want to hard code 20 lines of the kind if (symbol 'b') return new Tile( ... ) So, in the hope of at least centralizing all the content creation into one class, I made a static class, called LevelContentCreation, which holds the information about which symbol creates what and all this kind of stuff. It also holds a list of all the asset paths of the tile sheets, to load them later on. This class is within my GameLib game library project. The problem is, I'm using this LevelContentCreation static class in both my Level class (to load the actual tile sheets) and my content pipeline extension (to know which symbol represents what tile)... And here's how my LevelContentCreation class looks like public static class LevelContentCreation private static Dictionary lt char, TileCreationInfo gt AvailableTiles CreateAvailableTiles() private static List lt string gt AvailableTileSheets get set ... rest of the class Now, since the LevelContentCreation class is part of the game library, the content pipeline extension tries to use it but the call to CreateAvailableTiles() never happens and I'm unable to load a Level object from the content pipeline. I know this is because the content pipeline executes before the actual compilation or something like that, but how can I fix the problem? I can't really move the LevelContentCreation class to the pipeline extension, because then the Level class wouldn't be able to use it... I'm pretty lost and I don't know what to do... I know these are pretty bad design decisions, and I'd like it if somebody could point me in the right direction. Thank you for your precious time. If anything is not clear enough or if I should provide more information code, please leave a comment below. A little more information about my projects Game XNA Windows game project. Contains references to Engine, GameLib and GameContent GameLib XNA game library project. Contains references to Engine GameContent XNA content project. Contains references to LevelContentPipelineExtension Engine XNA game library project. No references. LevelContentPipelineExtension XNA content pipeline extension. Contains references to Engine and GameLib I know close to nothing about XNA 4.0 and I'm a little bit lost about how content works now. If you need more information, tell me.
12
How can I solve this SAT direct corner intersection edge case? I have a working SAT implementation, but I am running into a problem where direct collisions at a corner do not work for tiled surfaces. That is, it clips on the surface when going in a certain direction because it gets hung up on one of the tiles, and so, for example, if I walk across a floor while holding both down and left, the player will stop when meeting the next shape because the player will be colliding with the right side rather than with the top of the floor tile. This illustration shows what I mean The top block will translate right first and then up. I have checked here and here which are helpful, but this does not address what I should do in a situation where I don't have a tile based world. My usage of the term "tile" before isn't really accurate since what I'm doing here is manually placing square obstacles next to each other, not assigning them spots on a grid. What can I do to fix this?
12
How do you change a Body's origin in Farseer? In Farseer 3.3.1 for XNA, how do I change the origin of a Body? For example, when I create a Circle Body, instead of it rotating around its center, I want it to rotate around another specified point.
12
How to know if the player is signed in? I was wondering if there's any way to know if the "player" is signed in or not? Something like this if (GamePad.GetState(PlayerIndex.Two).IsConnected amp amp !Gamer.PlayerTwo.IsSignedIn) So that the controller is connected and it can be used, but the player is not signed in to an account. Something like a guess.
12
How do I get bullets to move in the direction of the mouse's position? Possible Duplicate Shoot a bullet towards cursor top down 2d I'm creating a 2D top down shooter, and I want to get the bullets to go in the direction of the mouse. Not sure of the logic that goes into it.
12
How can i make my program use 2 windows? I'm working in Xna 4.0 and iwant to make a program that uses the same code in 2 different windows. What i want out of this is that one player plays in one window and the other player to play in the second window. So i have 2 different questions Is it possible to use 2 windows for the same program? Is it possible for 1 window to have focus on one controller and the other window on the other?
12
Writing via content pipeline in Xbox game project I'm creating an Xbox application and I have this problem with the content pipeline. Loading .xnb files is not a problem but I can't seem to find any helpful tutorials on writing via the content pipeline. I want to write an XML whenever the user presses a custom made "save" button. I've searched the web for "saving game sate" etc. but so far I haven't found a solution for my case. So, summarized is there a way to write data (in XML format) via the content pipeline, if my Save() method is called? Cheerz
12
Good example of a multi pass effect? In XNA (and Direct3D in general AFAIK), rather than creating individual vertex and fragment shaders, you bundle potentially many related shaders into 'Effects'. When you come to use an effect you select a 'technique' (or iterate through all of them) and then each 'technique' has a number of 'passes'. You loop through the each pass it selects the relevant vertex and fragment shader and you draw the geometry. What I'm curious about though is what you would need multiple passes for? I understand in the early days of 3d you only had one texture unit and then you had 2 and that often still wasn't enough if you also wanted to do environment mapping. But on modern devices, even in the mobile class, you can sample 8 or more textures and do as many lighting calculations as you'd want to in a single shader. Can the more experienced here offer practical examples of where multi pass rendering is still needed, or is this just over engineering on the part of XNA Direct3d?
12
Connect camera class to game I've been following a tutorial on making a free camera for a 3D model. What the camera class does is allow the player to move and rotate in respects to the model's current position using the right thumbstick of an XBox360 controller. Here is the code http pastebin.com xb4eznMi Can someone explain to me how to connect this to my model in my Game class?
12
implementing different users in XNA XML So I am making a simple 2D game in XNA, and I want to implement different users (players), so each person playing can have their own high score, can only play levels they've already played, can only edit levels they've made, etc. The levels are currently stored in XML, in the format lt level gt lt name gt Level Name lt name gt lt number gt 14 lt number gt lt authorTime gt 12.45 lt authorTime gt lt map gt ... lt map gt lt level gt I was wondering what would be the most efficient way, and the best practise approach, to implementing this? I am currently torn between two options 1. each level having a lt users gt tag, containing a user ID and a time if they have completed the level. 2. Having a separate XML file, containing users and a list of their levels and times. Are these good ways to do this? Are there other ways to do this better? Thanks, Simon
12
XNA Guide text input maximum length so I am using Guide.BeginShowKeyboardInput to get the user to enter their username. I would like this to be limited to 20 characters, and it seems to break expected behaviour to let them input whatever they like and trim it later so how would I go about limiting what they can input in the text box itself? I have the following code public string GetKeyboardInput(string title, string description, string defaultText, int maxLength) if (input.CheckCancel()) useKeyboardResult false KeyboardResult null if (KeyboardResult null amp amp !Guide.IsVisible) KeyboardResult Guide.BeginShowKeyboardInput(PlayerIndex.One, title, description, defaultText, null, null) useKeyboardResult true else if (KeyboardResult ! null amp amp KeyboardResult.IsCompleted) string result Guide.EndShowKeyboardInput(KeyboardResult) KeyboardResult null if (result null) useKeyboardResult false return null if (useKeyboardResult) KeyboardResult null return result else the user is still entering inputs return null I assume the code I need would go in that final, empty else block, but I can't see any way to do this. Does anyone know how?
12
Load XNA Content Type from File I'm writing my own level editor and recently got the exporter working so now I'm working on the importer. My save file structure looks essentially like this ObjectType Property Value ContentProperty ContentType ContentName ObjectType The problem is in loading the content. I'm trying to find out how to load some content with the given content type at runtime. Technically, I could do a switch case of each type switch(ContentType) case Texture2D Content.Load lt Texture2D gt (ContentName) break case Model Content.Load lt Model gt (ContentName) break ... but that just seems messy (and I can't find a reliable listing of all of the default content types in XNA). Is there a way for me to load the content with the proper type without having to list out all possible types?
12
Incomplete mesh using DrawIndexedPrimitives after rotating mesh Through help on this site I was able to draw the triangles of an unrotated, nonscaled nontransformed mesh created in Blender and exported to OBJ, accurately imported through Assimp and rendered in XNA Graphics. However after applying rotation on a single axis in Blender(Z) and adding materials(I wanted to test loading of materials through Assimp) the same mesh appears incomplete. Is something wrong with my view matrix or is it something else? This is what the unrotated mesh looks like Here is the rotated mesh Camera, View and Projection are defined as follows cameraPos new Vector3(0, 5, 9) viewMatrix Matrix.CreateLookAt(cameraPos, new Vector3(0, 0, 1), new Vector3(0, 1, 0)) projectionMatrix Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 200.0f) Rendering is done through this code device.Clear(ClearOptions.Target ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0) effect new BasicEffect(GraphicsDevice) effect.VertexColorEnabled true effect.View viewMatrix effect.Projection projectionMatrix effect.World Matrix.Identity foreach (EffectPass pass in effect.CurrentTechnique.Passes) pass.Apply() device.SetVertexBuffer(vertexBuffer) device.Indices indexBuffer device.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 0, 0, oScene.Meshes 0 .VertexCount, 0, mMesh.FaceCount) base.Draw(gameTime)
12
Creating refraction map problem I'm reading riemers tutorial on how to make a water effect and trying to translate it from xna 3 to xna 4. So far I figured out I have to create a shader in order to clip the planes for my refraction map. I'm new to hlsl and how to implement custom shaders into my program, so I am wondering what I am doing wrong here. float4x4 World float4x4 View float4x4 Projection float4 ClipPlane0 void vs(inout float4 position POSITION0, out float4 clipDistances TEXCOORD0) clipDistances.y 0 clipDistances.z 0 clipDistances.w 0 position mul(mul(mul(position, World), View), Projection) clipDistances.x dot(position, ClipPlane0) float4 ps(float4 clipDistances TEXCOORD0) COLOR0 clip(clipDistances) return float4(0, 0, 0, 0) TODO whatever other shading logic you want technique pass VertexShader compile vs 2 0 vs() PixelShader compile ps 2 0 ps() This is the fx file that I found on an xna forum just for reference. Major edit I was able to get the program running successfully but when I viewed the saved screenshot of the refraction map, nothing was clipped. public void DrawRefractionMap(Effect clipEffect, Camera camera, GraphicsDevice device) Plane refractionPlane CreatePlane(waterHeight 1.5f, new Vector3(0, 1, 0), camera, false) clipEffect.Parameters "ClipPlane0" .SetValue(new Vector4(refractionPlane.Normal, refractionPlane.D)) device.SetRenderTarget(refractionRenderTarget) device.Clear(ClearOptions.Target ClearOptions.DepthBuffer, Color.Black, 1, 0) foreach (EffectPass pass in clipEffect.CurrentTechnique.Passes) pass.Apply() DrawTerrain(clipEffect, camera, device) device.SetRenderTarget(null) refractionTexture (Texture2D)refractionRenderTarget FileStream stream File.OpenWrite("Screenshot33.png") refractionTexture.SaveAsJpeg(stream, refractionTexture.Width, refractionTexture.Height)
12
Fast mesh collision 3D (C XNA) I'm trying to write a simple program where a 3D landscape can be walked about with a basic camera. However, I've found it very difficult to do even simple collisions with my terrain. I'm wondering if anybody has encountered a similar issue before and possibly might know how to solve it a better way? I've seen a lot of 3D collision questions, but I noticed that a lot of the answers are to approximate the mesh objects with spheres or cubes however I find this impractical with something as complicated as terrain. I'm using a .fbx model of terrain made with blender, grabbing its entire list of vertices, finding the one closest to the camera, and trying to set the camera Y to the vertex Y a constant. However, I keep running into a bunch of problems such as finding the closest vertex is difficult because if the model is too big, distances measured between the camera and the vertices will overflow some variable types, but if the model is too small, distances will often be indistinguishable and inaccurate. my method is very slow, because the terrain has a lot of detail, so I find myself only checking every 20 vertices or so. I end up with very bad collision detection because my method appears to be inexact and malfunctioning. Here's some of my code, if anybody wants to see what I'm doing... (btw the d check array is a list of vertices of the model, and C is my camera.) private void BasicCameraCollisionTest(int radius, int offset) float smallest d float.MaxValue float c d 0 int i cache 0 for (int i 0 i lt d check.Length i 20 ) c d Vector2.Distance(new Vector2(d check i .X, d check i .Z), new Vector2(C.position.X, C.position.Y)) if (c d lt smallest d) smallest d c d i cache i C.position Vector3.Lerp(C.position, new Vector3(C.position.X, d check i cache .Y radius offset, C.position.Z), 0.02f) If anybody could point me in the right direction, I'd be very grateful. Thanks!
12
Do I need to create an HLSL in XNA to display textures without content pipeline I currently have a jpeg texture stored as a Color array in XNA as RGBA. I also have the vertices of a cube in OBJ format mapped to VertexPositionColor vertex buffer using the VertexBuffer and Indices of the GraphicsDevice class. The OBJ has my jpeg mapped as a UV texture. I think I have all the Texture Coordinates as well(not sure, the array has 24 Vector3D values). I'm not sure where to go from here. I'm not using the Content Pipeline for my cube model or its texture though I'm wiling to add a custom .fx file if i need to. I realize I will have to add info about texture coords and color to my VertexDeclaration but do i need to write a custom effects file in HLSL to display my textured cube model or is there another way?
12
SpriteBatch.Draw with scale or rotation trigger a new batch? I recently read that any transformation changes will cause a new batch to be triggered. So, if I have 10 Sprites and each has a different rotation or scale will there be 10 batches sent up? Or is this somehow limited to SpriteBatch.Begin, where a Matrix is used? I'm not clear on how the Begin End relate to scale rotation in draw calls or if they do at all in terms of how many batches are created. I appreciate any info on this topic...
12
Gap in parallaxing background loop The bug here is that my background kind of offset a bit itself from where it should draw and so I have this line. I have some troubles understanding why I get this bug when I set a speed that is different then 1,2,4,8,16,... In main class I set the speed depending on the player speed bgSpeed (int)playerMoveSpeed.X 10 and here's my background class class ParallaxingBackground Texture2D texture Vector2 positions public int Speed get set public void Initialize(ContentManager content, String texturePath, int screenWidth, int speed) texture content.Load lt Texture2D gt (texturePath) this.Speed speed positions new Vector2 screenWidth texture.Width 2 for (int i 0 i lt positions.Length i ) positions i new Vector2(i texture.Width, 0) public void Update() for (int i 0 i lt positions.Length i ) positions i .X Speed if (Speed lt 0) if (positions i .X lt texture.Width) positions i .X texture.Width (positions.Length 1) else if (positions i .X gt texture.Width (positions.Length 1)) positions i .X texture.Width public void Draw(SpriteBatch spriteBatch) for (int i 0 i lt positions.Length i ) spriteBatch.Draw(texture, positions i , Color.White)
12
How much memory does a texture take up on the GPU? A large png on disk may only take up a couple megabytes but I imagine that on the gpu the same png is stored in an uncompressed format which takes up much more space. Is this true? If it is true, how much space?
12
How would I go about using FXAA in XNA? This isn't so much a "give me teh codez" as it is a request for the "right" steps to go through. I want to implement FXAA in XNA, but I'm a relative newb to the graphics side of game dev, so I'm not sure what the most efficient way to do this would be. My first hunch is to render the scene into a texture, and then render that texture on a rectangle, with the FXAA code in a pixel shader. However, I would actually be surprised if there was no more efficient way to do it.
12
2D Grid based game how should I draw grid lines? I'm playing around with a 2D grid based game idea, and I am using sprites for the grid cells. Let's say there is a 10 x 10 grid and each cell is 48x48, which will have sprites drawn there. That is fine. But in design mode, I'd like to have a grid overlay the screen. I can do this either with sprites (2x600 pixel image etc) or with primitives, but which is best? Should I really be switching between sprites and 3d 2d rendering? Like so Thanks!
12
XNA Draw Bounding Box around Sprite I'm just starting with XNA and I wanted to draw Debug Lines around my Texture Sprite to help me. Is there an easy way to do it with SpriteBatch? I haven't used the GraphicsDevice yet to draw.... Thanks!
12
MonoGame Linux Mouse.SetPosition doesn't work! Having a really weird issue, it seems that no matter what I do I cannot get the Mouse to lock to the center of the screen in MonoGame. I triple checked all the possible noob mistakes, and Mouse.SetPosition does get called. Weirder still, setting Game.IsMouseVisible to false does nothing as well. public override void Update(GameTime gt) lastmousestate mousestate mousestate Mouse.GetState() if(LockMouse) Mouse.SetPosition(100,100) Point distance new Point( mousestate.X lastmousestate.X, mousestate.Y lastmousestate.Y) MouseEntity.Position new Point(MouseEntity.Position.X distance.X, MouseEntity.Position.Y distance.Y) I'm using Linux Mint 64 bit with Cinnamon.
12
Automatically zoom out the camera to show all players I am building a game in XNA that takes place in a rectangular arena. The game is multiplayer and each player may go where they like within the arena. The camera is a perspective camera that looks directly downwards. The camera should be automatically repositioned based on the game state. Currently, the xy position is a weighted sum of the xy positions of important entities. I would like the camera's z position to be calculated from the xy coordinates so that it zooms out to the point where all important entities are visible. My current approach is to hw the greatest x distance from the camera to an important entity hh the greatest y distance from the camera to an important entity Calculate z max(hw tan(FoVx), hh tan(FoVy)) My code seems to almost work as it should, but the resulting z values are always too low by a factor of about 4. Any ideas?
12
Spawning units in a world made by Perlin noise? There's some issues that I've come across in my Perlin noise based game. Take a look at the attached screenshot below. The white areas you see are walls, and the black areas are walkable. The triangle in the middle is the player. I've implemented physics in this game by drawing it onto a texture (white or black pixels), and then getting that from the CPU. However, now I stand with a different problem at hand. I want units (or creeps, whatever you call them) to spawn constantly, at the edge of the screen. The point here is that in the final game, there will be a "fog of war" that doesn't allow the player to see that far anyway. I figured that I could just scan the pixels at the edge of the screen and see if their physics texture is black, and then spawn stuff randomly there. However, if you take a second look at the screenshot, there is (in the upper left corner) an example of where I wouldn't want the creeps to spawn (since they wouldn't be able to reach the player from there). Is it possible to somehow have the GPU determine these spawn spots for me, or some different way? I thought about making vectors between the proposed point at the edge of the screen and the player, and then following it every 10 voxels, and see if a wall collides, before spawning a unit there. However, the above proposed solution may be too CPU intensive. Any suggestions on this matter? Note 1 For the units spawned, I do not want to be using any form of pathfinding to avoid wall collisions as these units run towards the player. Therefore, the units must spawn at the edge of the screen, at a location where walking in a straight line towards the player would not collide with any walls.
12
Calculate Distance Using Lifetime, Speed, and Time Between Ticks I am trying to draw a line from the player to where he is facing, with the line being the distance his rockets will travel. I have ShipMissile.Speed, which is the number of pixels to move per tick, LastTick, the number of milliseconds between each call to Update(), and ShipMissile.Lifetime, which is the number of 10 ms ticks that the missile should be alive for. My current code is as follows Distance (int)((ShipMissile.Speed ((ShipMissile.Lifetime 10) LastTick)) scale) LastTick is generally 16.6667 (I have never seen it vary from this value during testing), and for this particular missile type Lifetime 200, which is 2000 ms, Speed 7, and scale 1 ('native' game resolution). The missile moves by using its rotation to generate a normalized vector, then multiplies by Speed and scale each game tick. EDIT Like this Missile.Position direction speed scale I am finding that the line is too short, and am wondering where the flaw in my code is (and please do not mention that I shouldn't be so dependent on frame rate or not be updating Lifetime outside of Update)? Is it even possible with my current (non optimal) setup? Thanks! EDIT I know this is kind of late, but here is a picture of what I mean (ignore the other stuff like the enemy and the score, etc)
12
How can I support different resolutions with Monogame? I want to support the following 4 resolutions in my Windows Phone 8 game 480 800, 768 1280, 720 1280, 1080 x 1920. How can I do that with Monogame? If I draw a sprite with Monogame, the sprite is not drawn on the right place in every resolution. For example, with a resolution of 768 1280, the sprite is drawn in the center of the screen, but if I use another resolution, the sprite is no more drawn in the center of the screen. What should I do so that the sprite is in every resolution on the same place?
12
Manager game questions (Sorry about the bad title, it's the best I could come up with) I've been planning a gladiator manager game for a while now. Something similar to Blood Bowl (or Football Manager, only with fighting rather than kicking a ball), only with a much larger focus on the actual managerial aspects of running a team. I'm still fairly new to game development, and have only created games with a very narrow focus (i.e. simple first person shooters), so taking on a project with a larger scope is very interesting, but also problematic since I really don't have a grip on how exactly to make the damn thing work. Basically my two major hurdles are the interface and database. Obviously the interface is incredibly important since the player will spend most of his her time doing managerial tasks. The game will be team based, with various leagues in which those teams fight in, so it all relies on a database. I have never done any real work with databases, so this in particular has me stumped. At this point, my idea is to use XNA in a WPF application, with an XML database. This just seems like a combination that would work well together, and as I have a C XNA background, I wouldn't need to learn a new language or graphics framework to work in. Does that seem like a sensible combination, and if not, why? I have never done anything with WPF, so all of my information on it's uses comes from Google, and that may or may not be a good thing. Would XML be a smart choice? There will likely be a fairly low (think 20 30) number of teams, all of which will have a dozen or so fighters, so it's not a monstrously large set of data. Thanks in advance, I know I didn't write the most intelligent post ever, but I had to get my ramblings out somehow. )
12
How to gradually decrease opacity of model? I have been searching for this matter for a long time and slowly I begin to think that this option is not available in XNA for Windows Phone. I am trying to get a 3D Model to be drawn at 50 opactity transparency. The most promising piece I found is following 1. Set the alpha blend mode for the graphics device with graphics.GraphicsDevice.RenderState.AlphaBlendEnable true graphics.GraphicsDevice.RenderState.SourceBlend Blend.SourceAlpha source rgb source alpha graphics.GraphicsDevice.RenderState.AlphaSourceBlend Blend.One don't modify source alpha graphics.GraphicsDevice.RenderState.DestinationBlend Blend.InverseSourceAlpha dest rgb (255 source alpha) graphics.GraphicsDevice.RenderState.AlphaDestinationBlend Blend.InverseSourceAlpha dest alpha (255 source alpha) graphics.GraphicsDevice.RenderState.BlendFunction BlendFunction.Add add source and dest results 2. Set the alpha value in the BasicEffect for the model effect.Alpha 0.5f Creates a 50 translucent object. But GraphicsDevice.RenderState.AlphaBlendEnable isn't even available in XNA for Windows Phone. So is there any way to achieve that effect?
12
Where should I place my reaction code in Per Pixel Collision Detection? I have this collision detection code public bool PerPixelCollision(Player player, Game1 dog) Matrix atob player.Transform Matrix.Invert(dog.Transform) Vector2 stepX Vector2.TransformNormal(Vector2.UnitX, atob) Vector2 stepY Vector2.TransformNormal(Vector2.UnitY, atob) Vector2 iBPos Vector2.Transform(Vector2.Zero, atob) for(int deltax 0 deltax lt player.playerTexture.Width deltax ) Vector2 bpos iBPos for (int deltay 0 deltay lt player.playerTexture.Height deltay ) int bx (int)bpos.X int by (int)bpos.Y if (bx gt 0 amp amp bx lt dog.dogTexture.Width amp amp by gt 0 amp amp by lt dog.dogTexture.Height) if (player.TextureData deltax deltay player.playerTexture.Width .A gt 150 amp amp dog.TextureData bx by dog.Texture.Width .A gt 150) return true bpos stepY iBPos stepX return false What I want to know is where to put in the code where something happens. For example, I want to put in player.playerPosition.X 200 just as a test, but I don't know where to put it. I tried putting it under the return true and above it, but under it, it said unreachable code, and above it nothing happened. I also tried putting it by bpos stepY but that didn't work either. Where do I put the code?
12
How to rotate two scaled objects I have two objects. The head and tail of a future "grapple". The head and tail always point in the same direction. However, when I tried using scaled rectangles (that were bigger smaller than the source rectangles) the rotations no longer worked, as in, the drawn head was no longer "attached" to the tail. (Without scaling them, this worked fine.) The red sprites are without any rotation (Code below). The others are rotated about their respective "lower" origins (bottom center) (Rotation 0) So, the non red sprites should be touching head to tail (the same way the red sprites are). I have been fiddling with the code for a while... here is what I think you will need to see to help Initialization() Rectangle headSize new Rectangle(0,0, 29, 100) Rectangle linkSize new Rectangle(0,0, 29, 67) Rectangle tailSize new Rectangle(0,0, 29, 53) Rectangle headSource new Rectangle(0, 0, 29, 53) Rectangle linkSource new Rectangle(0, 53, 29, 67) Rectangle tailSource new Rectangle(0, 120, 29, 53) this.headSize headSize this.linkSize linkSize this.tailSize tailSize headSource headsource linkSource linksource tailSource tailsource chainHandle new Link(new Rectangle((int)position.X, (int)position.Y, tailSize.Width, tailSize.Height), tailSource, 0) chainHead new Link(new Rectangle((int)position.X tailSize.Width 2 headSize.Width 2, (int)position.Y headSize.Height, headSize.Width, headSize.Height), headSource, 0) public Link(Rectangle rectangle, Rectangle sourceRect, float rotation) TruePosition.X rectangle.X TruePosition.Y rectangle.Y Position TruePosition Rotation rotation scaledUpperOrigin new Vector2(rectangle.Width 2, 0) scaledLowerOrigin new Vector2(rectangle.Width 2, rectangle.Height) scaledCenterOrigin new Vector2(rectangle.Width 2, rectangle.Height 2) upperOrigin new Vector2(sourceRect.Width 2, 0) lowerOrigin new Vector2(sourceRect.Width 2, sourceRect.Height) centerOrigin new Vector2(sourceRect.Width 2, sourceRect.Height 2) dims new Vector2(rectangle.Width, rectangle.Height) public void Draw(SpriteBatch sb) debug purposes sb.Draw(chainAtlas, chainHead.GetRect(), headSource, Color.Red) sb.Draw(chainAtlas, chainHandle.GetRect(), tailSource, Color.Red) sb.Draw( chainAtlas, chainHead.GetRect(), headSource, Color.White, MathHelper.ToRadians(chainHead.Rotation), chainHandle.scaledLowerOrigin, SpriteEffects.None, 1) sb.Draw( chainAtlas, chainHandle.GetRect(), tailSource, Color.White, MathHelper.ToRadians(chainHandle.Rotation), chainHandle.scaledLowerOrigin, SpriteEffects.None, 1) Any ideas on how to fix this? I have tried using both original sized origins and scaled origins to no avail, as well as different points of origins. If you have read this far, thank you for your time! Let me know if you see a fix.
12
What's the difference between XNA Game Services and glorified global variables? The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add method. Now, instead of having to pass an AudioComponent to all classes and methods that require it, instead you just pass your Game instance and look up the service. (Service Locator) Now, because games have many services (GraphicsDevice, SceneGraph, AudioComponent, EffectsManager, et cetera), you will now basically be passing Game to everything. So why not just make these instances a Singleton? Well, because Singletons are bad because they have a global state, prevent testing, and make your design much more brittle. Service locators are equally considered to be an anti pattern to many because instead of just passing the dependency to an object, you pass a service locator (the Game) which couples that class with the rest of the services. So then why are Services recommended in XNA and game development? Is it because games are different from regular programs and are highly intertwined with their components and having to pass every component necessary for the functioning of a class would be highly cumbersome? Are Game Services just then a necessary evil in game design? Are there alternatives that don't involve lengthy parameter lists and coupling?
12
tiled map changing textures? (XNA HLSL) I have successfully created a tiled map of various textures. Right now, i had a Vector4 in my own custom Vertex declaration deciding what texture each of the tiles should be. This is working perfectly. I can have any of my four tiles on the map, and any combination of them. However, i would like to start having the tiles change, yet i do not know how to change this Vector4 of the vertices. They have been added to a vertex buffer if that helps you answer the questions.
12
2D tilemap editor UI how do I disable editing while save load dialog is open? I'm working on a basic 2D tilemap editor in C XNA. Currently, it displays the map through a picturebox through which XNA's output is being routed, and editing is accomplished through simply checking mouse position (i.e., Is it within the picture box? If so, what tile is it on?). The problem I'm having is that this results in the map being edited through other windows. For example, when trying to save a map, any clicks in the savefiledialog window will edit the map square beneath it, including the click on "Ok" or "cancel." I believe this is the offending snippet of code from the Game1 class protected override void Update(GameTime gameTime) Camera.Position new Vector2(hscroll.Value, vscroll.Value) MouseState ms Mouse.GetState() if ((ms.X gt 0) amp amp (ms.Y gt 0) amp amp (ms.X lt Camera.ViewPortWidth) amp amp (ms.Y lt Camera.ViewPortHeight)) Vector2 mouseLoc Camera.ScreenToWorld( new Vector2(ms.X, ms.Y)) if (Camera.WorldRectangle.Contains( (int)mouseLoc.X, (int)mouseLoc.Y)) lt right there if (ms.LeftButton ButtonState.Pressed) .... Two questions. Is this even a viable way to display the map in the map editor? I'd like to be able to pan, zoom, etc. in the future, as well as select multiple tiles at once and edit their properties. How do I stop the picturebox from registering clicks while other windows are in focus? I've tried adding amp amp PictureBox.Focused to the if statement up there, but that stops it from accepting input at all, regardless of whether there's another window over it (apparently, "focus" doesn't mean what I thought it meant in this context). Confession this is my first attempt at Winform programming. Please excuse my lack of experience. UPDATE amp amp pictureBox.Focused didn't work, but amp amp pictureBox.Capture did. Still feels a little sloppy, but it works now. I have no confidence that this solution is correct, so I'm not closing the question just yet something tells me there's a more correct way, and I'd like to know about it. UPDATE2 Using Capture has introduced a new bug right clicks don't register reliably (i.e., only around one in ten clicks) until minimizing and restoring the window, after which they register correctly. Rage.
12
Triangle accuracy picking for animated models in XNA I can do picking with triangle accuracy for non animated models, but I also have animated models in my game. How do I do picking on animated models? I use code based on this project for animation. My first idea for doing it is Calculate ray For each model If model bounding sphere collides with ray For each meshPart Make animation transformation Calculate transformed triangles in meshPart Test collisions of ray with resulting triangles Have you ever considered how to make something like this?
12
Monogame SpriteFont Exception Text contains characters that cannot be resolved by this SpriteFont I'm trying to put text on the screen and if I put anything but an empty string I get "Text contains characters that cannot be resolved by this SpriteFont. nParameter name text" spriteBatch.DrawString(screenText, "A", new Vector2(0, 200), Color.Black) screenText is the name of my SpriteFont variable. lt ?xml version "1.0" encoding "utf 8"? gt lt ! This file contains an xml description of a font, and will be read by the XNA Framework Content Pipeline. Follow the comments to customize the appearance of the font in your game, and to change the characters which are available to draw with. gt lt XnaContent xmlns Graphics "Microsoft.Xna.Framework.Content.Pipeline.Graphics" gt lt Asset Type "Graphics LocalizedFontDescription" gt lt ! Modify this string to change the font that will be imported. gt lt FontName gt Arial lt FontName gt lt ! Size is a float value, measured in points. Modify this value to change the size of the font. gt lt Size gt 6 lt Size gt lt ! Spacing is a float value, measured in pixels. Modify this value to change the amount of spacing in between characters. gt lt Spacing gt 0 lt Spacing gt lt ! UseKerning controls the layout of the font. If this value is true, kerning information will be used when placing characters. gt lt UseKerning gt true lt UseKerning gt lt ! Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic", and "Bold, Italic", and are case sensitive. gt lt Style gt Regular lt Style gt lt ! If you uncomment this line, the default character will be substituted if you draw or measure text that contains characters which were not included in the font. gt lt ! lt DefaultCharacter gt lt DefaultCharacter gt gt lt ! CharacterRegions control what letters are available in the font. Every character from Start to End will be built and made available for drawing. The default range is from 32, (ASCII space), to 126, (' '), covering the basic Latin character set. The characters are ordered according to the Unicode standard. See the documentation for more information. For localized fonts you can leave this empty as the character range will be picked up from the Resource Files. gt lt CharacterRegions gt lt CharacterRegion gt lt Start gt amp 32 lt Start gt lt End gt amp 32 lt End gt lt CharacterRegion gt lt CharacterRegions gt lt ! ResourceFiles control the charaters which will be in the font. It does this by scanning the text in each of the resource files and adding those specific characters to the font. gt lt ResourceFiles gt lt ! lt Resx gt Strings.resx lt Resx gt gt lt ResourceFiles gt lt Asset gt lt XnaContent gt I did build and rebuild the spritefont file using the Content Builder.
12
What's the difference between XNA Game Services and glorified global variables? The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add method. Now, instead of having to pass an AudioComponent to all classes and methods that require it, instead you just pass your Game instance and look up the service. (Service Locator) Now, because games have many services (GraphicsDevice, SceneGraph, AudioComponent, EffectsManager, et cetera), you will now basically be passing Game to everything. So why not just make these instances a Singleton? Well, because Singletons are bad because they have a global state, prevent testing, and make your design much more brittle. Service locators are equally considered to be an anti pattern to many because instead of just passing the dependency to an object, you pass a service locator (the Game) which couples that class with the rest of the services. So then why are Services recommended in XNA and game development? Is it because games are different from regular programs and are highly intertwined with their components and having to pass every component necessary for the functioning of a class would be highly cumbersome? Are Game Services just then a necessary evil in game design? Are there alternatives that don't involve lengthy parameter lists and coupling?
12
XNA texture stretching at extreme coordinates I was toying around with infinitely scrolling 2D textures using the XNA framework and came across a rather strange observation. Using the basic draw code spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointWrap, null, null) spriteBatch.Draw(texture, Vector2.Zero, sourceRect, Color.White, 0.0f, Vector2.Zero, 2.0f, SpriteEffects.None, 1.0f) spriteBatch.End() with a small 32x32 texture and a sourceRect defined as sourceRect new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height) I was able to scroll the texture across the window infinitely by changing the X and Y coordinates of the sourceRect. Playing with different coordinate locations, I noticed that if I made either of the coordinates too large, the texture no longer drew and was instead replaced by either a flat color or alternating bands of color. Tracing the coordinates back down, I found the following at around (0, 16,777,000) As you can see, the texture in the top half of the image is stretched vertically. My question is why is this occurring? Certainly I can do things like bind the x y position to some low multiple of 32 to give the same effect without this occurring, so fixing it isn't an issue, but I'm curious about why this happens. My initial thought was perhaps it was overflowing the coordinate value or some such thing, but looking at a data type size chart, the next closest below is an unsigned short with a range of about 32,000, and above is an unsigned int with a range of around 2,000,000,000 so that isn't likely the cause. Update 1 The image above shows the texture stretching vertically near (0, 16,777,000), and the texture stretches horizontally at around ( 16,777,000, 0). If I go beyond this point on both axes, the texture is stretched in both directions. This occurs in both the positive and negative directions. The above positions were noted with a 32x32 texture. With a 16x16 texture, the distortion occurs at the same location. Interestingly, with a 64x64 texture, the distortion occurs in the same location on the x axis, but is actually farther on the y axis, more near (0, 17,301,000). It occurs at the same location with a 64x64 texture too, I mistakenly used a 64x66 texture before. Update 2 I have repeated the test with a 1024x1024 texture and have found the same results. I looked farther and noticed that it stretches again at double the distance, somewhere near ( 33,554,000, 33,554,00), but then doesn't happen again until around 4 times the initial stretching point, near ( 67,109,000, 67,109,000). It seems to occur only at powers of two times that initial value, 16,777,216 2 n. The answer below by mh01 suggested to check the MaxTextureRepeat cap of my graphics card (a GeForce GTX 560). According to KluDX this cap has a value of 8192, and it's description indicates that texture coordinates are stored in 32 bit signed integers. Correction The stretch points occur at 2 n intervals because my texture sizes are 2 n. Testing with a texture size of 25x33 resulted in the first stretch point appearing near ( 13,107,000, 17,301,000). So while it's related to the texture's aspect ratio, it doesn't seem to be directly related to the texture's size.
12
Can SpriteBatch be used to fill a polygon with a texture? I basically need to fill a texture into a polygon using the SpriteBatch. I've done some research but couldn't find anything useful except polygon triangulation method, which works well only with convex polygons (without diving into super math which is definitely not something I'm pretty good at). Are there any solutions for filling in a polygon in a basic way? I of course need something dynamic (I'll have a map editor that you can define polygons, and the game will render them (and collision detection will also use them but that's off topic), basically I can't accept solutions like "pre calculated" bitmaps or anything like that. I need to draw a polygon with the segments provided, to the screen, using the SpriteBatch.
12
Is it possible in HLSL to use bitfields? I have in memory a representation of my 2d GameMap (think of a Scorched Earth like landscape). The map is made up of MapElements, a MapElement is made up of 64 bits defined like struct MapElement uint Color RGBA Color uint Info info flags (collision, material etc) MapElement Map Height Width Now I'm thinking of doing some effects in HLSL, for example lighting, that need per pixel collision information. Is there any way I can just upload the mapdata as I have it in memory, and use it in HLSL ? So is there a way to in HLSL to sample Uploaded Map to see if (map y Height Width amp CollisionFlag) ! 0 ?
12
How can I implement screen transitions like in the 2D Zelda games? I want to implement a screen transition in the style of the 2D Legend of Zelda games (like this). That is, I'd the screen to remain static until the player moves to an exit, at which point the next screen smoothly scrolls into view as the old screen scrolls out of view. How can I accomplish this?
12
How to rotate model 180 with XNA I got a model, and a camera pointing at this model, I think my camera position is the problem. Its showing the front of the model, but I want it to show its back like in third person. My camera code is Vector3 thirdPersonReference new Vector3(0, 100, 100) public Camera(Vector3 landscapePosition, Player player) this.player player rotationMatrix Matrix.CreateRotationY(this.player.Rotation) Vector3 transformedReference Vector3.Transform(thirdPersonReference, rotationMatrix) this.position transformedReference this.player.Position viewMatrix Matrix.CreateLookAt(this.position, this.player.Position, new Vector3(0.0f, 1.0f, 0.0f)) projectionMatrix Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, this.player.AspectRatio, 1.0f, 1000.0f) terrainMatrix Matrix.CreateTranslation(landscapePosition) What is that Im doing wrong???
12
No output to screen using Multiple Render Targets and multisampling I'm having a little trouble with XNA, but I doubt it's specific to the framework. I draw a few 3d models to 1 rendertarget with multisampling turned on, and it works fine. If I draw the same scene to 2 rendertargets (of course the second one gets a different output (configured this in HLSL shaders)) with multisampling turned on, I get absolutely no output. Nothing. Blank. Also, when I render to both outputs but turn off multisampling, it works perfectly (but looks hideous due to a lack of antialiasing). The strange thing is This happens on my desktop (Nvidia GTX 560 Ti), but not on my laptop (Intel HD Graphics 4000, which sits on the CPU). On my laptop, it outputs just fine to both rendertargets and multisampling turned on. Can anybody explain what could be wrong? I won't copy all my code here but just to clarify graphics.PreferMultiSampling True RT Light New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents) RT Scene New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents) device.SetRenderTargets(RT Scene,RT Light) 'Draw Works but looks hideous graphics.PreferMultiSampling True RT Light New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents) RT Scene New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents) device.SetRenderTarget(RT Scene) 'Draw Works but obviously only draws to one rendertarget graphics.PreferMultiSampling True RT Light New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents) RT Scene New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents) device.SetRenderTargets(RT Scene,RT Light) 'Draw Works on my laptop, but not on my desktop. Again, to clarify The top picture is what my laptop shows (with multisampling and multiple render targets), and the bottom picture is what my desktop shows with the same settings
12
Changing background texture by drawing on it? Actually I'm sorry for the title, I'm not sure which short phrase will describe situation best. I'm porting (or remastering, I don't know which word suits better, maybe both) a Win32, pure C, DirectX 8 game to XNA. Here is the problem I'm facing now. The game background represents dirt through which player can dig, leaving the tunnels in it. The background is erased literally from a background bitmap array (which is static) by applying a "dig step" mask forming a new background picture From that little knowledge I have currently on XNA, I assume that it's hard to mimic this approach and modify a background texture in Update method. So I was thinking about storing an array of "tunnels" data and draw tunnels above background. This however seems not so elegant as the original approach. You see, tunnel form depends on direction, so I would need to store following information for a cell 1) directions of tunnel (from 1 to 4), 2) dig amount (for each direction) ranges from 0 to 5. So question is, what is a good way to implement that? Am I on a right way? P.S. BTW anyone can try and see it in action!
12
In XNA, how should I organize content shared between projects? I have an XNA library using several custom effects. They need to be accessed by a content pipeline project (models are built with the effect), and projects that use my game library (they should be able to load a standalone instance of the effect). Where should I put the .fx files for the custom effects? How do I access them from separate projects?
12
Height and width of a Farseer body? I have a body named PersonA. If PersonA collides with another body, the width and height of that body should be saved. I tried it like this but I always get error messages that "Width" and "Height" don't exist. bool PersonA OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact) How tall and broad is the body that collided with PersonA float Width fixtureB.Body.Width float Height fixtureB.Body.Height return true How can I get the width and height of another body? What should I change?
12
How do you calculate a gradient value within multiple colors (gradient stops) In WPF Silverlight XAML you can have a brush with multiple gradient stops at different points along the color line. I was able to replicate this behavior with two colors, a single color lerp, from this answer to my previous question Code to generate a color gradient within a texture using a diagonal line How do I do the same thing in that question, but with multiple color steps even at different widths from each other.
12
How do I move a sprite to the mouse position? So, I'm trying to make my sprite walk to the X coordinate of my mouse click. This is my code currentMouseState Mouse.GetState() MouseState mouseState Mouse.GetState() if (lastMouseState.LeftButton ButtonState.Released amp amp currentMouseState.LeftButton ButtonState.Pressed) int mouseposx mouseState.X if (playerPosition.X lt mouseposx) playerPosition.X 3 if (playerPosition.X gt mouseposx) playerPosition.X 3 The problem is that the sprite will walk only 3 pixels and then stop. If I use while instead, like this currentMouseState Mouse.GetState() MouseState mouseState Mouse.GetState() if (lastMouseState.LeftButton ButtonState.Released amp amp currentMouseState.LeftButton ButtonState.Pressed) int mouseposx mouseState.X while (playerPosition.X lt mouseposx) playerPosition.X 3 while (playerPosition.X gt mouseposx) playerPosition.X 3 it will simply teleport to the X coordinate instead. I tried adding a delay using Thread.Sleep(ms), but that just made it freeze and then teleport anyway. So, what should I do? EDIT This is the new code, by Byte56. currentMouseState Mouse.GetState() MouseState mouseState Mouse.GetState() if (lastMouseState.LeftButton ButtonState.Released amp amp currentMouseState.LeftButton ButtonState.Pressed) if (playerPosition.X mouseState.X lt 3) playerPosition.X mouseState.X else if (playerPosition.X lt mouseState.X) playerPosition.X 3 else if (playerPosition.X gt mouseState.X) playerPosition.X 3 edit3 void update() Check if the player has reached the target, if not, move towards it. if (playerPosition.X playerTarget.X lt 3) playerPosition.X playerTarget.X else if (playerPosition.X gt playerTarget.X) playerPosition.X 3 else if (playerPosition.X lt playerTarget.X) playerPosition.X 3 and currentMouseState Mouse.GetState() MouseState mouseState Mouse.GetState() if (lastMouseState.LeftButton ButtonState.Released amp amp currentMouseState.LeftButton ButtonState.Pressed) This will give the player a target to go to. playerTarget.X mouseState.X update()
12
Damage indicator screen overlay I want to make something already done by a lot of games , which is when I am taking so much hits from enemy red screen drawn like the following , using XNA 4.0 after it's drawn and I am still alive I want to be removed slightly as in the call of duty !!!
12
tiled map changing textures? (XNA HLSL) I have successfully created a tiled map of various textures. Right now, i had a Vector4 in my own custom Vertex declaration deciding what texture each of the tiles should be. This is working perfectly. I can have any of my four tiles on the map, and any combination of them. However, i would like to start having the tiles change, yet i do not know how to change this Vector4 of the vertices. They have been added to a vertex buffer if that helps you answer the questions.
12
Draw mesh with multiple bones I currently have an object made up of only one mesh. And this object contains three bones. One for stretching the mesh left, one for stretching the mesh up, and a center bone, which moves the object around. This is how my model and the bones mesh hierarchy looks like Now, the problem is I don't know how to draw this mesh in XNA, I mean I don't know which transform to use. I am using this code to draw Matrix transforms new Matrix model.Model.Bones.Count model.Model.CopyAbsoluteBoneTransformsTo(transforms) foreach (ModelMesh mesh in model.Model.Meshes) foreach (BasicEffect effect in mm.Effects) effect.View camera.view effect.Projection camera.projection effect.World I dont know which to use effect.EnableDefaultLighting() mesh.Draw() If I debug it, and then look at the code, it comes up with 7 bones in this order (as seen in the picture) Obj, CenterArmature, Center(CenterArmatures bone), GorArmature, Zgoraj(GorArmatures bone), LevoArmature, Levo(LevoArmatures bone).
12
Tile map collision is not working properly I am having problems setting collision between my sprite and the tiles. I have only done the code for colision for moving upwards but some places on the map it moves up and some places it doesn't. Here is what I have so far Vector2 position private static float scalingFactor 32 static int tileWidth 32 static int tileHeight 32 int , map 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, , This is in turtle.update if ( keyboardState.IsKeyDown( Keys.Up ) ) if ( position.Y gt screenHeight 4 ) current position of the turtle on the tiles int mapX ( int )( position.X scalingFactor ) int mapY ( int )( position.Y scalingFactor ) 1 if ( isMovable( mapX , mapY , map ) ) position.Y position.Y scalingFactor else MoveUp() private void MoveUp() motion.Y 1 public bool isMovable( int mapX , int mapY , int , map ) if ( mapX lt 0 mapX gt 19 mapY lt 0 mapY gt 20 ) return false int tile map mapX , mapY if ( tile 0 ) return false return true protected override void Update( GameTime gameTime ) turtle.Update( screenHeight , scalingFactor , map ) base.Update( gameTime ) EDIT What i have tried to do is get the postion of my sprite and over which tile it is, then check whether the next tile is a path or a wall.
12
How to handle input in Monogame I've just switched over to MonoGame from XNA. Since MonoGame is supposed to have the same API (implying that any copied code should work as usual), I've run into a strange issue input doesn't seem to be handled through MonoGame. When I tried to fix any missing "using" directives in that class, it automatically added using Microsoft.Xna.Framework.Input which implies that there's no MonoGame equivalent. Googling the issue had no success all the tutorials I found for MonoGame said to use XNA's input. Is there a MonoGame equivalent for handling input, or do I just need to use XNA for that?
12
How can I attach a model to the bone of another model? I am trying to attach one animated model to one of the bones of another animated model in an XNA game. I've found a few questions forum posts articles online which explain how to attach a weapon model to the bone of another model (which is analogous to what I'm trying to achieve), but they don't seem to work for me. So as an example I want to attach Model A to a specific bone in Model B. Question 1. As I understand it, I need to calculate the transforms which are applied to the bone on Model B and apply these same transforms to every bone in Model A. Is this right? Question 2. This is my code for calculating the Transforms on a specific bone. private Matrix GetTransformPaths(ModelBone bone) Matrix result Matrix.Identity while (bone ! null) result result bone.Transform bone bone.Parent return result The maths of Matrices is almost entirely lost on me, but my understanding is that the above will work its way up the bone structure to the root bone and my end result will be the transform of the original bone relative to the model. Is this right? Question 3. Assuming that this is correct I then expect that I should either apply this to each bone in Model A, or in my Draw() method private void DrawModel(SceneModel model, GameTime gametime) foreach (var component in model.Components) Matrix transforms new Matrix component.Model.Bones.Count component.Model.CopyAbsoluteBoneTransformsTo(transforms) Matrix parenttransform Matrix.Identity if (!string.IsNullOrEmpty(component.ParentBone)) parenttransform GetTransformPaths(model.GetBone(component.ParentBone)) component.Player.Update(gametime.ElapsedGameTime, true, Matrix.Identity) Matrix bones component.Player.GetSkinTransforms() foreach (SkinnedEffect effect in mesh.Effects) effect.SetBoneTransforms(bones) effect.EnableDefaultLighting() effect.World transforms mesh.ParentBone.Index Matrix.CreateRotationY(MathHelper.ToRadians(model.Angle)) Matrix.CreateTranslation(model.Position) parenttransform effect.View getView() effect.Projection getProjection() effect.Alpha model.Opacity mesh.Draw() I feel as though I have tried every conceivable way of incorporating the parenttransform value into the draw method. The above is my most recent attempt. Is what I'm trying to do correct? And if so, is there a reason it doesn't work? The above Draw method seems to transpose the models x z position but even at these wrong positions, they do not account for the animation of Model B at all. Note As will be evident from the code my "model" is comprised of a list of "components". It is these "components" that correspond to a single "Microsoft.Xna.Framework.Graphics.Model"
12
Farseer circle hangs where it's spawned I'm currently trying to simply spawn a circle in Farseer. However, it's stuck wherever I spawn it! The game is updating fine, as I can see the circle spinning in place when I spawn it because of how I currently have gravity set up (following code from Game1.cs) Initialise the screen center for use with the Level class screenCenter new Vector2(graphics.GraphicsDevice.Viewport.Width 2f, graphics.GraphicsDevice.Viewport.Height 2f) world new World(new Vector2(20, 20)) currentLevel new Level1(screenCenter, circleSprite, groundSprite, ref world) Level1 constructor public Level1(Vector2 screenCenter, Texture2D circleSprite, Texture2D groundSprite, ref World world) player new Player(ref world, screenCenter, circleSprite) ground new Ground(ref world, screenCenter, groundSprite) listLevelItems new List lt LevelItem gt () listLevelItems.Add(player) listLevelItems.Add(ground) Player constructor public Player(ref World world, Vector2 screenCenter, Texture2D sprite) setSprite(sprite) setPosition((screenCenter MeterInPixels) new Vector2(0f, 0f)) playerBody BodyFactory.CreateCircle(world, 96f (2f MeterInPixels), 1f, playerPosition) getBody().BodyType BodyType.Dynamic Ball bounce and friction getBody().Restitution 0.3f getBody().Friction 0.5f If I use a breakpoint and change the playerBody position while the game is halted, the ball does move, but stays fixed in its new location. Any help would be greatly appreciated.
12
XNA for multiplayer game? I've made a few games without using XNA and recently started to see some documents and samples around and took an interest on it but i have a few doubts for going into it or not. What limitations do i have if i am planning to create a mmorpg with XNA for distributing it (if it has a item mall or is paid to play for example) ? Do i need more accounts to test it (for example to login into my own game 3 players) or XNA does not cost anything at this level (heard something about LIVE Gold Membership plus which is why i am asking this one) ?
12
Developing Kinect game for Xbox360? Possible Duplicate Can you access Kinect motion sensing from XNA? bunch of questions Is it possible for me to create a Kinect application using XNA and deploy it to Xbox360 platform? What should I use, will Kinect SDK for Windows be okay for this task? What about licenses, is it free to use or should I pay for licenses? Thanks for any answer or url...
12
Save game state information I'm working on my first game, and are looking into the option to save a number of game state settings. One of the things I want to save is the high scores, this will contain a list of the 10 players that scored the highest. I have been looking into this for a while, and was wondering what the best way for this is. While being ingame I will have a list of high scores comprised of Player, Score, Level. This of course needs to be updated each time the score has been beaten, but it also needs to be saved somewhere where it won't be reset the whole time. I would think this kind of information should be saved into a file (either xml or comma separated values). The problem I'm facing is what to do on the initial set up (I would like to have some fake values in the high scores table), however if I add that to the file how do I know that the scores in there are the initial set up ones, or the real ones? Once the player has a endgame for the first time, these fake scores should not being shown anymore. However the player can also reset the scores, and at that point I would like to have the fake scores shown again. So my question is what is the best way of setting this up? Do I keep 2 files, one with the real scores, other with fake ones? or do I keep the fake ones in a list inside the game and when the file with high scores can't be found I use that list?
12
How do I render everything in software using XNA C ? I'm trying to find how to render everything with software in XNA, but I can't find what option I need to set. I'd like to know which method properties I have to call set to make my app run in software mode as opposed to hardware accelerated mode.
12
Creating a queue for BeginInvoke method loading chunks I have a voxel game similar to Minecraft. I have a funciton PushLoadedChunks(Direction) that pushes all of the loaded chunks forward, backward, left, right. This is done with sfd.BeginInvoke(PushLoadedChunks, null, null). This works great until I fire two of these quickly, which happens if the user goes diagnol. It errors out because two threads are pulled trying to modify the same data, both writing to the same thing because they try to load the same chunks. I wanted to do something like this Create one standard thread and a queue to push through. Instead of invoking PushLoadedChunks, I wanted to add it to the queue and have that single thread work through each chunk one after another, proving to be slower performing but more stable code. I am struggling because Invoke seems to wait for the chunks to return which works, but freezes my player until it is loaded. I need reference in creating a "queue" of sorts, or help setting up a single thread to run each method when they are called and wait until one is finished to do another. Does anyone have any advice or resources I could look at to see the best way to complete my task?
12
Copying render target texture loses all depth I have a render target RenderTargetScene that holds my scene texture with the scene's depth buffer rtScene new RenderTarget2D( graphicsDevice, graphicsDevice.PresentationParameters.BackBufferWidth, graphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Rgba64, DepthFormat.Depth24Stencil8, Requires a depth format for objects to be drawn correctly (e.g. wireframe model surrounding model) 0, RenderTargetUsage.PreserveContents ) If I attempt to copy the render target contents to another render target using the following code game.GraphicsDevice.SetRenderTargets(sceneCopy) game.GraphicsDevice.Clear(ClearOptions.Target, Color.Transparent, 0f, 0) game.GraphicsDevice.Clear(Color.Transparent) game.SpriteBatch.Begin( SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise ) game.SpriteBatch.Draw(game.RenderTargetScene, new Rectangle(0, 0, sceneCopy.Width, sceneCopy.Height), Color.White) game.SpriteBatch.End() Then the texture is copied across but the depth buffer appears to be lost. This is apparent when using DepthStencilState.DepthRead as there is no depth for the objects drawn with that render state to read. How can I make sure the depth buffer is copied across too? EDIT I have a depth texture created via my deferred rendering system so I thought I would use that. I'm now drawing a full screen quadrangle using a depth writing shader public void RestoreDepthBuffer(Texture2D depthTexture) Set the render states game.GraphicsDevice.BlendState BlendState.Opaque game.GraphicsDevice.DepthStencilState DepthStencilState.Default game.GraphicsDevice.RasterizerState RasterizerState.CullCounterClockwise game.GraphicsDevice.SamplerStates 0 SamplerState.PointClamp Effect effect restoreDepthBuffer effect.CurrentTechnique effect.Techniques "Default" effect.Parameters "DepthTexture" .SetValue(depthTexture) effect.CurrentTechnique.Passes 0 .Apply() game.GraphicsDevice.DrawUserIndexedPrimitives lt VertexPositionTexture gt ( PrimitiveType.TriangleStrip, NearPlaneVerticesVPT, 0, 4, Indices, 0, 2 ) The important parts of the shader look like struct PixelShaderOutput float4 Colour COLOR0 float Depth DEPTH PixelShaderOutput PixelShaderFunction(VertexShaderOutput input) PixelShaderOutput output output.Colour float4(0, 0, 0, 0) output.Depth 1.0f tex2D(DepthSampler, input.TextureCoordinates).r return output This is still not working though. EDIT2 I've got it to work but I have to set the depth and draw all the objects when the RenderTarget is first set and not unset it again. Should I post an answer based on my working method?
12
How do I plot individual pixels using the XNA APIs? If I wanted to fill my game screen with individually coloured pixels, how would I do this? For example, if I wanted to write a 'game of life' type game where each pixel was a cell, how would I achieve this using XNA? I've tried just calling SetData() on a Texture2D object using a screen sized array of Color values, but it complains with You may not call SetData on a resource while it is actively set on the GraphicsDevice. Unset it from the device before calling SetData. How do I do as it asks? Or better still... is there an alternative, better, efficient way to fill a screen with arbitrary pixels?
12
animate a drawn 2D image to move I am trying to make a game where the person can create their own character, but instead of using a character builder, i want the person to be able to draw their character. how do i code that in c so that they only have to draw their character once, and the code can animate that character without the player having to do very much except draw their character on the screen?
12
xna creating game stage management contrls I am under planning stage of my game where I am creating controls for my game. I have create below control for stages but have no idea how this we can achieve in xna. Please also help me with your views regarding how to load, play multiple stages and persist score for each stage in game using xna. What we normally used to do is just put everything in infinite loop but here I want more intelligence in game, as one stage over it should go back to menu. Example can be something like angry bird stages.
12
Best depth sorting method for a Top Down 2D game using a 3D physics engine I've spent many days googling this and still have issues with my game engine I'd like to ask about, which I haven't seen addressed before. I think the problem is that my game is an unusual combination of a completely 2D graphical approach using XNA's SpriteBatch, and a completely 3D engine (the amazing BEPU physics engine) with rotation mostly disabled. In essence, my question is similar to this one (the part about "faux 3D"), but the difference is that in my game, the player as well as every other creature is represented by 3D objects, and they can all jump, pick up other objects, and throw them around. What this means is that sorting by one value, such as a Z position (how far north south a character is on the screen) won't work, because as soon as a smaller creature jumps on top of a larger creature, or a box, and walks backwards, the moment its z value is less than that other creature, it will appear to be behind the object it is actually standing on. I actually originally solved this problem by splitting every object in the game into physics boxes which MUST have a Y height equal to their Z depth. I then based the depth sorting value on the object's y position (how high it is off the ground) PLUS its z position (how far north or south it is on the screen). The problem with this approach is that it requires all moving objects in the game to be split graphically into chunks which match up with a physical box which has its y dimension equal to its z dimension. Which is stupid. So, I got inspired last night to rewrite with a fresh approach. My new method is a little more complex, but I think a little more sane every object which needs to be sorted by depth in the game exposes the interface IDepthDrawable and is added to a list owned by the DepthDrawer object. IDepthDrawable contains public interface IDepthDrawable Rectangle Bounds get possibly change this to a class if struct copying of the xna Rectangle type becomes an issue DepthDrawShape DepthShape get void Draw(SpriteBatch spriteBatch) The Bounds Rectangle of each IDepthDrawable object represents the 2D Axis Aligned Bounding Box it will take up when drawn to the screen. Anything that doesn't intersect the screen will be culled at this stage and the remaining on screen IDepthDrawables will be Bounds tested for intersections with each other. This is where I get a little less sure of what I'm doing. Each group of collisions will be added to a list or other collection, and each list will sort itself based on its DepthShape property, which will have access to the object to be drawn's physics information. For starting out, lets assume everything in the game is an axis aligned 3D Box shape. Boxes are pretty easy to sort. Something like if (depthShape1.Back gt depthShape2.Front) if depthShape1 is in front of depthShape2. depthShape1 goes on top. else if (depthShape1.Bottom gt depthShape2.Top) if depthShape1 is above depthShape2. depthShape1 goes on top. if neither of these are true, depthShape2 must be in front or above. So, by sorting draw order by several different factors from the physics engine, I believe I can get a really correct draw order. My question is, is this a good way of going about this, or is there some tried and true, tested way which is completely different and has somehow completely eluded me on the internets?
12
Creating Primitives and Model from Texture2D Xna 4.0 So I was playing around with XNA working on a 3d engine with 2d sprites as characters and objects. After a while I became very unhappy with the way the sprites were being scaled and billboarded so I created a GameSprite class that takes all the information from the texture2D(pngs) and turns it into VertexPositionColor quads on init. these are drawn with a basic effect, a struct quad, and a quadList. basicEffect.CurrentTechnique.Passes 0 .Apply() foreach (ColorQuad quad in currentFrame.quadList) graphicsDevice.DrawUserIndexedPrimitives lt VertexPositionColor gt ( PrimitiveType.TriangleList, quad.Vertices, 0, quad.Vertices.Length, quad.Indices, 0, quad.Indices.Length 3) (frames are different quads chopped up from the original image for animation, like a sprite sheet) This creates a great 3D recreation of the sprite that can be zoom entirely with no blur. Each GameSprite has its own basic effect file. I was wondering if there was a way, maybe during LoadContent, that I could create these vertices and turn them into models for easier drawing and rendering in this 3D world and if this is even a good way to go about this and if I might experience longerterm problems using lots of these GameSprites and their many quads. Thanks for reading!
12
Some questions about lists I've been looking for articles or tutorials on this and I can't seem to find any, so I thought I'd ask here. I've created a bullet class in my game that is added and removed through a list. If I'm going to make these bullets work the way I want them to I need to be able to do two things One, I need to check if the bullets are colliding with each other and then remove the two bullets that are colliding. I've tried doing it by updating the bullet list with a for statement and then checking for collision with another for statement, but that occasionally crashes the game. Two, I need to be able to check how far away every other bullet in the list is from the current one. So how can I go about doing this?
12
Background Scrolling like Zelda A Link To The Past with XNA i am trying to create a background that scrolls like the one in zelda a link to the past. in other words i have a bigger "screen" than the camera covers, so i need to scroll over it, when moving. if the player reaches an edge of the screen, the camera is going to stop and the character moves out of the center. my actual problem is, that i have to draw the objects in an other way than the background. i am getting the camera to track the player, but if i want to add another object like an enemy, i have to draw it with screen coordinates, which are not the same as the background coordinates. (background image is 1280x720 with a source rectangle of 640x360). so the player is usually drawn at 640 2, 360 2. but the player also is at position 600,600 of the background image. so, if there is an enemy at 200,200 and the player moves to that point i want to draw the enemy on the screen. but, of course, i cant draw it at 200,200 in the screen that displays the sorucerectangle of the texture. so i am looking for a way to kinda get the object into the texture, that there is only one coordinate system or at least a second coordinate system where all the object are in., which is as big as the texture itsself. with such a coordinate system i could get the absolute positions of the objects and draw it like the sourcerectanlge of a texture.
12
What is the recommended way to store game entity data? The following is specific to my problem, but I believe the principles can be applied to any game. I am currently working on a 3D game which will have many different types of spaceships. The physics and behavior of the spaceships are controlled by a base 'Ship' class. This base class in turn derives from a 'Drawable Object' class which handles the transformations and drawing of the ship. I want the spaceships to have a set of stats such as Max speed Cargo capacity Weapon power etc that can be passed into the physics and behavior functions. However, during gameplay new spaceships will be able to be bought upgraded, but i want to be able to pre define a (possibly large) list of setups that will be available to the player. What is the best way to store the available stat setups? Should I be using a large JSON XML file or similar to store the stats which is loaded at runtime? Or might I just as well hard code the stats into the constructors of a set of derived classes? The actual physics attributes (location, velocity etc) and its stats of a particular spaceship are being saved to file when the game is actually played. I have researched about entity component system architecture, but I haven't found much about how to define these entity stats. Any advice on improving my entity architecture would be much appreciated this is one of my first attempts at hobby game development.
12
Light on every model and not in the whole scene I am using a custom shader and try to pass the effect on my Models like that foreach (ModelMesh mesh in Model.Meshes) foreach (ModelMeshPart part in mesh.MeshParts) part.Effect effect mesh.Draw() My only issue is that every Model now has its own light source in it. Why is this happening and is this a problem of my shader? Edit These are the parameters passed to the shader private void Get lambertEffect() if ( lambertEffect null) lambertEffect Engine.LambertEffect Lambert technique (LambertWithShadows, LambertWithShadows2x2PCF, LambertWithShadows3x3PCF) lambertEffect.CurrentTechnique lambertEffect.Techniques "LambertWithShadows3x3PCF" lambertEffect.Parameters "texelSize" .SetValue(Engine.ShadowMap.TexelSize) ShadowMap parameters lambertEffect.Parameters "lightViewProjection" .SetValue(Engine.ShadowMap.LightViewProjectionMatrix) lambertEffect.Parameters "textureScaleBias" .SetValue(Engine.ShadowMap.TextureScaleBiasMatrix) lambertEffect.Parameters "depthBias" .SetValue(Engine.ShadowMap.DepthBias) lambertEffect.Parameters "shadowMap" .SetValue(Engine.ShadowMap.ShadowMapTexture) Camera view and projection parameters lambertEffect.Parameters "view" .SetValue(Engine. camera.ViewMatrix) lambertEffect.Parameters "projection" .SetValue(Engine. camera.ProjectionMatrix) lambertEffect.Parameters "world" .SetValue( Matrix.CreateScale(Size) world ) Light and color lambertEffect.Parameters "lightDir" .SetValue(Engine. sourceLight.Direction) lambertEffect.Parameters "lightColor" .SetValue(Engine. sourceLight.Color) lambertEffect.Parameters "materialAmbient" .SetValue(Engine.Material.Ambient) lambertEffect.Parameters "materialDiffuse" .SetValue(Engine.Material.Diffuse) lambertEffect.Parameters "colorMap" .SetValue(ColorTexture.Create(Engine.GraphicsDevice, Color.Red)) Image
12
Keeping rotation between two objects In my XNA game I have two objects that collide. When the first object collides with the other it is able to latch on to it and move it about the world. I am having a problem with the math here (Math isn't my strong point). I currently have the second object latch on to the first and move around with it, but I cannot get it to keep it's original direction. So, if the object is facing up it should keep this direction relative to how it is being rotated with the original item. Any tips on how I could best to achieve this?
12
How to handle keyboard in worker thread in XNA I am using multithreading in my XNA application and run my update logic s in a update thread(witch is a worker thread) and rendring is being done by main thread, now the problem is updation is required there on keyboard event, and key Board handling can be done only in main thread. Note that my application was single threaded and I have implemented threading, synchronization is being done by 'data partitioning', both the threads are working correctly, except my keyboard is not working.. if any one have any suggestion or example, please allow me to know. thanx in advance.
12
Returning The Position Of A Sprite Drawn Updated By A List My problem is this, when iceBoy hits any of the newGrounds in the ground.groundAmmount list, it will return the specific position of this newGround so that i can set iceBoy's position based on the newGround that he touched. Here is the code that i have for this foreach (Ground newGround in ground.groundAmmount) if (HitGround()) iceBoy.position.Y newGround.position.Y but like Byte56 this will only loop through all of the newGrounds in the list and then iceBoy.position.Y will only equal the last newGround added to the list. how could i create another method that will have a return value of the position of the exact newGround that iceBoy is touching?
12
What's a simple way of sending game data between phones? Using windows phones I need to send small amounts of data between phones in a turn based game. It's only a few bytes of data and does not need to be real time, something like in wordfeud or similar. There could be 2 4 players in one game and one players actions need to be sent to the other ones. What would be the simplest way to manage this? If it would be possible to easily extend to other platforms with monogame that would be nice but not a requirement right now (guess I'll cross that bridge when I come to it). My initial hope was that this would be possible using some online service like scoreloop or openXlive that could handle all the online stuff (leaderboards, communications, social etc) but I haven't found one that can do it all.
12
Different types of cubes I'm looking into making 4 types of cubes grass, stone, dirt, and empty. I have a cube class that is just for storing the location of the cube. public Cube(GraphicsDevice Device, Vector3 Position, Texture2D Texture) I want the Texture2D to be changed to something like CubeType. In my cube class, I have a grass and stone class which both inherit cube, but I don't know how to make that work for what I want. public class Grass Cube public Grass() isMineable false public class Stone Cube public Stone() isMineable false The only thing that makes each cube differ from each other is the texture and if theyre mineable or not. What's the easiest way to implement what I want? I guess one way of doing it is just adding another parameter to Cube(bool isMineable), but for learning purposes I want to see if there's a better way to do it.
12
Should game services be global? (XNA) If one wants to use services, they can use the ones built in to XNA (Game.Services) and pass around the Game object to everything that needs to either query for a service or add a service. Alternatively, one can create their own game services class and make it static to avoid having to pass around Game everywhere. Instead of just passing Game to everything, just to query the services (a code smell already in my opinion, just pass the services) seems a bit silly to me. Instead of passing it everywhere, why not just make a public static GameServices class? What are the advantages and disadvantages of each approach? Which do you normally opt for?
12
Determining if a character is within the field of view in XNA I'm trying to creating a field of view for the camera I'm making for a game. It rotates around a circle for 180 degrees while the head moves accordingly. I'm going to bound the field of view within an isosceles triangle using the method described on this website. The problem I'm having is that I don't know how I'm going to detect if the field of view has intersected with the character as seen in this link. Any help with this would be greatly appreciated. EDIT sorry I meant an asset in game representing a camera much like the enemy in the second link, not an actual camera class in XNA(really sorry)
12
Collision detection with XNA and TiledLib I recently started learning XNA and after getting annoyed with creating individuals rectangles each time I wanted to add something I went with TiledLib so I could more easily create levels using the Tiled map editor. My problem is, though, I have no idea how to check for collision using TiledLib. There is very little documentation on it and where people have solved the problem it seems like the code they provide is outdated. For those who do not know TiledLib https bitbucket.org nickgravelyn tiledlib I'm using mostly the code that comes in the demo (such as Map.cs MapProcessor.cs) because I don't know too much how it works, but it does the job. I've heard to detect for collision I should use a seperate layer that contains all the tiles I want to collide with, but aside from updating the map to accomdate that I don't know how to actually check for that in my code and make those tiles collide with things. Also, attempting to add a layer to my tile map and then running my game provides this error Error 1 Building content threw ArgumentOutOfRangeException Index was out of range. Must be non negative and less than the size of the collection. Parameter name index at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List 1.get Item(Int32 index) at PlatformerContentPipeline.MapProcessor.Process(MapContent input, ContentProcessorContext context) in e Platformer Platformer PlatformerContentPipeline MapProcessor.cs line 94 at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor 2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context) at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item) at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item) at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild() at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem sourceAssets, String amp outputContent, String amp rebuiltContent, String amp intermediates, Dictionary 2 amp dependencyTimestamps, KeyValuePair 2 amp warnings) e Platformer Platformer Platformer PlatformerContent level1.tmx Platformer I'm at a loss at what to do. If anyone could help me with this, or perhaps let me know of a more updated and more well documented 2D engine for C XNA, that would be great.
12
Game development for multiple Microsoft platforms I intend to develop games for Microsoft's Windows Store, however, I'm confused between their platforms, so please clarify those questions Is there any technology (XNA, DirectX), so a game can be distributed to Xbox360, Windows Store, Windows Phone? What are the differences between Xbox360 and Windows? What is a good approach for 2D games? Does a Windows Store game work for Windows Phone just by recompiling it? Are the Windows Store and Windows Phone store separated?
12
How to use XML files as content files in XNA? I have an XML file representing different car manufactures that will be available in my game. The file looks like this lt ?xml version "1.0" encoding "utf 8" ? gt lt XnaContent gt lt Asset Type "List string " gt lt car gt Audi lt car gt lt car gt BMW lt car gt lt car gt Nissan lt car gt lt car gt Volvo lt car gt lt Asset gt lt XnaContent gt When adding it into my content folder, the compiler return this error There was an error while deserializing intermediate XML. Cannot find type "List 1" How can I create a list of strings, put it into XML and read it from XNA?
12
How can I implement voxel based lighting with occlusion in a Minecraft style game? I am using C and XNA. My current algorithm for lighting is a recursive method. However, it is expensive, to the point where one 8x128x8 chunk calculated every 5 seconds. Are there other lighting methods that will make variable darkness shadows? Or is the recursive method good, and maybe I am just doing it wrong? It just seems like recursive stuff is fundamentally expensive (forced to go through around 25k blocks per chunk). I was thinking about using a method similar to ray tracing, but I have no idea how this would work. Another thing I tried was storing light sources in a List, and for each block getting the distance to each light source, and using that to light it to the correct level, but then lighting would go through walls. My current recursion code is below. This is called from any place in the chunk that does not have a light level of zero, after clearing and re adding sunlight and torchlight. world.get at is a function that can get blocks outside of this chunk (this is inside the chunk class). Location is my own structure that is like a Vector3, but uses integers instead of floating point values. light ,, is the lightmap for the chunk. private void recursiveLight(int x, int y, int z, byte lightLevel) Location loc new Location(x chunkx 8, y, z chunky 8) if (world.getBlockAt(loc).BlockData.isSolid) return lightLevel if (world.getLightAt(loc) gt lightLevel lightLevel lt 0) return if (y lt 0 y gt 127 x lt 8 x gt 16 z lt 8 z gt 16) return if (x gt 0 amp amp x lt 8 amp amp z gt 0 amp amp z lt 8) light x, y, z lightLevel recursiveLight(x 1, y, z, lightLevel) recursiveLight(x 1, y, z, lightLevel) recursiveLight(x, y 1, z, lightLevel) recursiveLight(x, y 1, z, lightLevel) recursiveLight(x, y, z 1, lightLevel) recursiveLight(x, y, z 1, lightLevel)
12
Making sense of the Game State manager tutorial? I have come across the Game State Managemnet tutorial at http create.msdn.com en US education catalog sample game state management because I thought this would be a good place to start a game off. I have added a new screen, but I am still a bit lost on how everything works. When I make my game, do I only need one more additional screen? just for gameplay? or should I have a different screen for each level?
12
Getting BEPUphysics to draw its entities Isn't there a way, to force BEPUphsyics to show what it is doing? I am here with my existing XNA project, starting to put in BEPUphysics, but I am not seeing what it is doing. Take my model for instance. I think I made a StaticMesh here public BEPUphysics.Collidables.StaticMesh PhysicsMesh public Space space private Hero hero public override void LoadContent() ... space new Space() Vector3 vertices int indices TriangleMesh.GetVerticesAndIndicesFromModel( model.getCoreModel(), out vertices, out indices) PhysicsMesh new BEPUphysics.Collidables.StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, 40, 0))) space.Add( hero.PhysicsMesh) space.ForceUpdater.Gravity new Vector3(0, 9.81f, 0) That's the only thing I made BEPU Wise in my game. All other models don't have physics attached to them. But, like I said. I see nothing when the game is running. Only my model, not falling, not doing anything. I would like to see the full thing BEPU is doing in runtime.