Jump to content

  • Log In with Google      Sign In   
  • Create Account

destructivArts

Member Since 27 Apr 2011
Offline Last Active Aug 09 2013 12:46 PM

Topics I've Started

Xna 3d coordinates problem

04 December 2012 - 11:28 AM

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);
}

Reviews with Perspective

12 November 2012 - 11:45 PM

"Give me some nice, fresh, perspective."
Posted Image


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: www.sourceworldgaming.com

Thanks guys,
Peter

Reviews with Perspective

12 November 2012 - 11:42 PM

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

Updating the Player in a Quad Tree

30 August 2012 - 11:54 PM

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[i].getClass() == new Player().getClass()){
    Player p = (Player)data[i];
    p.update(keyboard, mouse);
    data[i] = 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

Image/Animation Loading

23 August 2012 - 12:06 AM

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>(DataBufferInt.java:41)
at java.awt.image.Raster.createPackedRaster(Raster.java:458)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
at sun.awt.image.ImageRepresentation.createBufferedImage(ImageRepresentation.java:230)
at sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:535)
at apple.awt.OSXImageRepresentation.setPixels(OSXImageRepresentation.java:58)
at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:120)
at sun.awt.image.PNGImageDecoder.sendPixels(PNGImageDecoder.java:531)
at sun.awt.image.PNGImageDecoder.produceImage(PNGImageDecoder.java:452)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:246)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)

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

PARTNERS