destructivArts

Member

77

205 Neutral

• Rank
Member

1. Xna 3d coordinates problem

Changing the order worked but it still is skewed. My view matrix is: view = Matrix.CreateLookAt(pos, target, up); and the Projection matrix is view = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)Game.Window.ClientBounds.Width / (float)Game.Window.ClientBounds.Height, 1, 100); Edit: Ok, well changing the order worked but that wasn't why it was skewed. I was defining the vertices in an array of VertexPositionColor and I was overwriting the Object at index 1. ie. [CODE] vert[0] = new VertexPositionColor(variables); vert[1] = new VertexPositionColor(variables); vert[1] = new VertexPositionColor(variables); [/CODE] So thank you for your help, worked perfectly
2. Xna 3d coordinates problem

I'm going through a book, and the example it gave me seems like is should work, but when I try and implement it, it falls short. My Camera class takes three vectors in to generate View and Projection matrices. I'm giving it a position vector of (0,0,5), a target vector of Vector.Zero and a top vector (which way is up) of Vector.Up. My Three vertices are placed at (0,1,0), (-1,-1,0), (1,-1,0). It seems like it should work because the vertices are centered around the origin, and thats where I'm telling the camera to look but when I run the game, the only way to get the camera to see the vertices is to set its position to (0,0,-5) and even then the triangle is skewed. Not sure what's wrong here. Any suggestions would be helpful. Just to make sure I've given you guys everything (I don't think these are important as the problem seems to be related to the coordinates, not the ability of the game to draw them): I'm using a VertexBuffer and a BasicEffect. My render code is as follows: [CODE] effect.World = Matrix.Identity; effect.View = camera.view; effect.Projection = camera.projection; effect.VertexColorEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionColor> (PrimitiveType.TriangleStrip, verts, 0, 1); } [/CODE]
3. Reviews with Perspective

"Give me some nice, fresh, perspective." [img]http://2.bp.blogspot.com/-0OHWvvLF4gc/Td259Yd1z0I/AAAAAAAAHSE/KguYDD0S8p4/s320/ratatouille-anton-ego-orders.jpg[/img] So there's this new, little review website on the web. And when I say new, I mean we launched last Wednesday. And now the line you knew was coming: You should go check it out! I'm going to give you the link [url="http://www.sourceworldgaming.com"]here[/url], BUT, I encourage you to read on and understand what we're trying to do. (It's relevant to you developers) Those of us who are writing for the site have recently decided what we want to do with the power we are given by the site. As a review website, we have the chance to alter the way games are treated. We are college students who want the world to appreciate these little gems as more than just toys. Games have the potential to stand among the other great artistic mediums. Personally, I want to see there be sections in English classes that deal entirely with video games. Imagine taking a class called "Narrative: From Shakespeare to Shooters". Wouldn't that be awesome? So this is our goal at Source World Gaming: to portray video games as an artistic medium rather than a toy. This means several things. 1. What are usually reviews, in our case, will be more of a critique. We will be talking directly to the developer, rather than to potential players. We figure in this way we can kill two birds with one stone: inform potential players, and improve the general quality of games by showering praise on quality work while not only condemning, but offering suggestions for improvement to low quality games. 2. This policy will affect the crowd that will be reading this article quite a lot. It means you have a new view of your games. Most of our writers don't want to create video games (I'm the only one as far as I know). And we're talking about what we want out of games. We, the consumer, are directly telling you what we want. This also means we expect to see them fulfilled where possible. Our demands aren't extreme. At the broadest level, we simply want games treated with the same respect movies and books are afforded. 3. And to make your jobs even easier, we are about to start a set of series aimed at talking about aspects of games by comparing several, rather than seeing each in its own light as we do in our 'reviews'. In these we are basically telling you what we like, what we dont, and most importantly why. We also might just spit ball some ideas. The most important thing about our site is that we want it to be viewed as a conversation, not us dictating to you. If you want to give us info, or be interviewed (preferably you have a game finished or in the works) feel free to make yourselves known to us. Also, if you have topics you want us to talk about, shoot us emails or post in comments. Now that I've explained our site, I encourage everyone to go check it out. Keep in mind that we are brand new, and a lot of the things I just spelled out will take time to implement. We don't want to screw up by giving out false information or by explaining concepts that are shallow because of lack of thought. We want to improve the worlds perception of video games, so we're taking this seriously. Once more, heres the link: [url="http://www.sourceworldgaming.com"]www.sourceworldgaming.com[/url] Thanks guys, Peter
4. Reviews with Perspective

Go look at the other one, this was a mistake. Sorry guys (Mods if you wanna delete this, thats cool) (Delete this one ;) ) Peter
5. where to go now?

Here's some ideas: [url="http://lazyfoo.net/articles/article01/index.php"]Progression[/url]
6. Java tips

I took a class exactly like that. I signed up for the class and then over the summer taught myself the curriculum. So when I got to class, I was able to finish the projects the teacher assigned us while she was still teaching the new lesson. (ie. Today we're going to learn how to create a calculator program. To do that we need functions. She teaches, I type.) And while everyone else was working on the project, I was looking up stuff to make games with. If the class you're in is an AP track course you won't learn a whole lot more than the basics of java. Books and the internet are your best friends. I used Learn Java in 21 days (I didn't finish in 21 days, but it's still a good reference), and http://math.hws.edu/javanotes/. For game related programming tips I read Core Techniques and Algorithms in Game Programming. The code's in C++ but theres more in pseudo code and the C++ code is easy to read. Hope this helps, Peter
7. Updating the Player in a Quad Tree

Ok, I'll keep that in mind. One other question: I've implemented an ObservableInput object that calls this update function every frame: [CODE] public void updateInput(MouseHandler m, KeyHandler k){ //Mouse mousePos = m.getMousePos(); //Keyboard keys = k.getKeyStates(); } [/CODE] For some reason it's not calling the update function for it's observers. I don't know if this has anything to do with it but I'm setting the Entities as observers when they are placed in a data list of a node. I'm removing them when they have to be shifted, and adding them again when they are placed. I know the ObservableInput object sees them, so I don't know why it's not updating. Just to be thorough, heres the entity update function. [CODE] public void update(Observable obs, Object obj){ } [/CODE] And the players: [CODE] @Override public void update(Observable o, Object obj){ System.out.println("1"); if(o instanceof ObservableInput){ ObservableInput obs = (ObservableInput)o; buttonState = obs.getButtonState(); mousePos = obs.getMousePos(); keys = obs.getKeyState(); } } [/CODE] I'll keep looking in the meantime, Thanks again for all the help! Peter
8. Updating the Player in a Quad Tree

Thank you, I looked up the Observer/Observable, and I won't actually have to change much to implement it. As to your concern about putting too much into a base class, can't I just create children classes for each kind of entity I need? All I would have to do is put empty functions into the entity class so that its children could use them. (Entity already takes care of animation updates, rendering, and collision detection.) Thanks again for the help! Peter
9. Updating the Player in a Quad Tree

I'm writing my game in Java, but this seems pretty language independent. I have a quad tree set up to organize all my game entities. All game entities are children of an entity class, and that is what the quad tree sees all its data as. Almost all entities simply get a list of nearby entities for their update function. The player, however, needs this in addition to the keyboard info and mouse info. (I think in typing this I've figured out the solution but I'll ask anyways.) How do I make the tree recognize that it is a Player object and know that it is ok to pass the keyboard and mouse states to it? I've thought of two ways to solve the problem, I'm just wondering which is most effective (or if there's a better way all together). 1.) When I loop through each nodes data, check if each data object's class equals the player class. Create a new player object equal to this data object, update it, and then replace the original with the new one. Example: [CODE] if(data[i].getClass() == new Player().getClass()){ Player p = (Player)data[i]; p.update(keyboard, mouse); data[i] = p; } [/CODE] 2.) (And this is the way I think is best right now.) Create an update function in the Entity class that takes in the keyboard and mouse, which only its Player child class will ever call. In the Player class I just override it, and put in the player update code. Then all I have to do is check if the data's class is the same as Player (as I did above). I'm still new at this, so I'm just looking for input. If there's a better way, please let me know. Thanks, Peter
10. Making Screen follow the player?

Here's what I've done: Create a camera object that follows the player. Every frame, subtract all your active objects x and y coordinates from the camera's, and set those values into each objects local position variable. If either value is negative or outside the cameras view, dont draw it. Otherwise draw the objects at their local position. Then you just have to base all mouse clicks off local positions and you already have it calculated. I don't know if I explained this well enough so heres an example: Lets say you have an enemy at a global position of 35,40; The camera's top left corner is at 0,100 and has dimensions of 100,100; You would draw the enemy on screen based on the calculation: int locX = entX - camX; >> locX = 35-0 = 35 int locY = camY - entY; >> locY = 100-40 = 60 so you would draw the entity at 35,60. Drawing things in this way accomplishes a lot. You know what is visible so you don't draw things that don't need to be. You don't have to reposition everything in the world every frame. You also have things local positions for mouse events. Hope this helps, Peter

Thanks again for the advice. I'm not to the point yet where I am doing stand alone builds of the game yet, and I'm running it from within Netbeans. Is it possible to alter the amount of memory available to Netbeans? Also I split the background apart into pieces. They're now 2000 x 1500 px and as I'm loading them I'm getting the same error as before. If the problem is the game is loading too many images at once, is there a way to check if an image is finished loading before continuing? Thanks again, Peter