Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

205 Neutral

About destructivArts

  • Rank

Personal Information

  1. destructivArts

    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. vert[0] = new VertexPositionColor(variables); vert[1] = new VertexPositionColor(variables); vert[1] = new VertexPositionColor(variables); So thank you for your help, worked perfectly
  2. destructivArts

    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: 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); }
  3. destructivArts

    Reviews with Perspective

    "Give me some nice, fresh, perspective." 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 here, 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: Thanks guys, Peter
  4. destructivArts

    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. destructivArts

    where to go now?

    Here's some ideas: Progression
  6. destructivArts

    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 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. destructivArts

    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: public void updateInput(MouseHandler m, KeyHandler k){ //Mouse mousePos = m.getMousePos(); //Keyboard keys = k.getKeyStates(); } 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. public void update(Observable obs, Object obj){ } And the players: @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(); } } I'll keep looking in the meantime, Thanks again for all the help! Peter
  8. destructivArts

    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. 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: if(data.getClass() == new Player().getClass()){ Player p = (Player)data; p.update(keyboard, mouse); data = p; } 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. destructivArts

    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
  11. destructivArts

    Image/Animation Loading

    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
  12. destructivArts

    Image/Animation Loading

    Thanks! How would I do that from within the game? Because when the game is finished I don't want people to have to go through and do that just to run the game. I guess I'll go ahead and ask this just to be sure: Is the way I'm handling images and animations ok? Thanks again Peter
  13. Before I start I'd like to say that this is the first really big game I've worked on. So far my programming experience involves a high school level intro to Java class, and the writing of Snake, Pong, Space Invaders, Pac Man and Tetris. I realize that all of them are relatively simple compared to what I'm trying to do now, but I'm learning so if I'm doing something blatantly wrong please be gentle. I still am stumbling around in the dark. With that said, I'm writing a 2D sidescroller, and everything (so far) was working fine, until I tried to load my first background. The background is a large image that would scroll as the player moves. (It's an 11000 px x 6000 px .png file that is 6.3 MB) I have several other animations/images that loaded perfectly fine before this. The way I'm handling animations and images (if this is a bad idea please let me know so I can fix it.) is to load them all in the constructor of the game into two separate handler objects. For example, I have a DataStreamReader that reads an initial_load.txt file and passes the names, paths, and number of frames from this txt file to an AnimationHandler object as Strings. The animation handler takes these strings and uses them to load each frame into an animation object and then the animation into an ArrayList<Animation>. for(int i=0;i<numFrames;i++){ ImageIcon img = new ImageIcon(this.getClass().getResource(path+name+i+".png")).getImage(); frames.add(new Frame(img)); } animations.add(new Animation(frames, name)); For each object I create, I pass it the animationHandler and it finds the appropriate animations for itself. This way I'm not loading the images for each separate object. (This is how I've done it for my earlier games.) What I've learned is that Java creates a separate Thread for each image it is trying to load. After too many threads are loaded it will produce the error I'm getting: Exception in thread "Image Fetcher 0" java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.<init>( at java.awt.image.Raster.createPackedRaster( at java.awt.image.DirectColorModel.createCompatibleWritableRaster( at sun.awt.image.ImageRepresentation.createBufferedImage( at sun.awt.image.ImageRepresentation.setPixels( at apple.awt.OSXImageRepresentation.setPixels( at sun.awt.image.ImageDecoder.setPixels( at sun.awt.image.PNGImageDecoder.sendPixels( at sun.awt.image.PNGImageDecoder.produceImage( at sun.awt.image.InputStreamImageSource.doFetch( at sun.awt.image.ImageFetcher.fetchloop( at Nothing I've read has really explained how to go about fixing this. That's everything I know. I'm really not sure what to do although I'll keep looking. Any help is greatly appreciated, Thanks Peter
  14. Recently a friend tried to run a game I am creating on his computer. We both have mac's but his being a laptop had a much different resolution than my desktop. When he tried to run it all the graphics were scaled poorly, as in I have a function that scales the graphics, but not uniformly. My question is this: What is the best way to allow the game to run on different resolutions? The only option I see is to scale the graphics uniformly and allow the screen to show less. ie. On a higher resolution computer, scale everything up uniformly so the backgrounds either fit perfectly or are larger than the screen. Any help is much appreciated, Thanks, Peter
  15. destructivArts

    2D Collision detection, need some help.

    Ok, First off, I haven't found any easy way of doing collision detection. I was in your position a few months ago for the first time and everyone here was a huge help, but you're going to have to program it yourself. Here's my method (and by my, I mean the method I got from people on here). The Simple Version 1. Find the movement vector of the object your going to move 2. Do a 'Wide Pass' to find anything that might be in its way 3. Find the first collision the object would encounter 4. find the new movement vector based on the collision 5. Apply the vector to the player's position The Complete Version: 1. First find how far the player is going to move in both the x and y directions. 2. A wide pass is designed to quickly, and in a small number of calculations, find any object that the player might hit on its current trajectory. To do this I cast out lines from 2 or 3 of the corners of the character. Which corners I use is based on which directions the player is moving. ie. if he's moving down and left I cast lines from the top left, bottom left and bottom right because those are the only corners that could possible hit something. You then loop through all the objects in your scene to see which ones cross these lines. 3. Loop through the wide pass list of objects finding which one is closest to the player, as this one will be the first to be hit. I find the points at which the lines intersect the object, pick the closest one and use that to determine which collision would come first. 4. Based on that point, you can find the new movement vector. 5. Add the vectors to the current position. I've found it easier, at least with java, to write my own class for a bound object rather than using java.awt.Rectangle, but that might just be me. Hope this helps. Peter
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!