Thursday, November 25, 2010

Videogames Part 4: The First Game

This final part will be a quick tutorial on a basic program in XNA. The program will have an image bouncing of the edges of the window.

To start you'll need to create a new XNA windows project, should with Xbox, or WP7 but I'm focusing on the windows one right now. Once the project is created in the content section in the solution explorer right-click and add an existing item. Browse to any image (jpg, png or bmp preferably) and load it. This will be the image that will bounce in the program.
We add some variable:

        Texture2D theImage;                                           // our image (*.jpg, *.png *.bmp)
        Vector2 posImage = Vector2.Zero;                      // initial position of the image
        Vector2 velImage = new Vector2(150.0f, 150.0f); // velocity vector
        int MaxX, MinX, MaxY, MinY;                             //limits
Then in load content we need to load our image:

            theSprites = new SpriteBatch(GraphicsDevice);
            // load the images
            theImage = Content.Load("imageName");//note: no extension in the image name
            MaxX = device.Viewport.Width - theImage.Width;//calculate the horizontal limit
            MinX = 0;
            MaxY = device.Viewport.Height - theImage.Height;//calculate the vertical limit
            MinY = 0;
Now for the update, where we update our variables:


GamePadState theXbox = GamePad.GetState(PlayerIndex.One);
            KeyboardState theKeyboard = Keyboard.GetState();
            //a way for the user to exit the program with the keyboard or xbox controller.
            if (theXbox.Buttons.Back == ButtonState.Pressed || theKeyboard.IsKeyDown(Keys.Escape))
                this.Exit();
            // modify the image position with our velocity vector and the time.
            posImage += velImage * (float)gameTime.ElapsedGameTime.TotalSeconds;
            //chech for horizontal bounce
            if (posImage.X > MaxX)
            {
                velImage.X *= -1;
                posImage.X = MaxX;
            }
            else if (posImage.X < MinX)
            {
                velImage.X *= -1;
                posImage.X = MinX;
            }
            // check for vertical bounce
            if (posImage.Y > MaxY)
            {
                velImage.Y *= -1;
                posImage.Y = MaxY;
            }
            else if (posImage.Y < MinY)
            {
                velImage.Y *= -1;
                posImage.Y = MinY;
            }
            base.Update(gameTime);
 Finally in the draw, we tell the program what to draw in the screen:

            GraphicsDevice.Clear(Color.MidnightBlue);
            // draw the image
            theSprites.Begin();
            theSprites.Draw(theImage, posImage, Color.White); //here white acts like transparent
            theSprites.End();
            base.Draw(gameTime);
You can download the full solution here. It was made in VS2010 so you'll need VS2010 to open it. Also check a friend's blog for another XNA tutorial here. Note his blog is in spanish, but the code is universal :D

Videogames Part 3: Starting with XNA

The first thing you'll need to get started with XNA will be to get the tools for the job. You can get them here at App Hub or you can also get the at Dreamspark if you are a student. At Dreamspark is important to note you can get a free year of XNA Creators Club. With it you can test/run your games on your Xbox directly. Once you have all the tools for the job you'll need to learn the basics for XNA.


To get started I recommend getting a book on the subject. The book I recommend is Learning XNA 4.0 which includes many lessons on the latest version of XNA. But don't just use a book when you have the internet as a resource. The first page I recommend to anybody interested in XNA has to be Microsoft's App Hub. There you will find tons of tutorials for the PC, Xbox, and Windows Phone 7. From basic 2D stuff to more complex things in 3D. The other site I recommend is GameDev. This site is for anybody interested in game development and is great to interact with other game developers. The purpose of GameDev according to their about, "GameDev.net was created with the sole purpose of providing a public site where game developers could freely exchange information." Here you'll be able to ask fellow game developers for tips and tricks. You can also check the many articles the staff puts out for gamers to learn more about game development. Do note this site is for game development in general and not just XNA.

Wednesday, November 24, 2010

Videogames Part 2: The Technologies

X= -..-  N= -.  A= .-
When it comes to videogames there are many tools in which one can develop a game. You can use tool(s) like DirectX, OpenGL, Unreal Engine, Source Engine, Havok Engine, Flash, and XNA to name a few. But the one that really excited me was XNA due to the fact that you can publish your game to Xbox Live for other people to play. It's also pretty easy to use (compared to the others) when your just beginning to learn.

The XNA framework makes it simple to make games for Xbox, PC, and Windows Phone 7 without the hassles of worrying for compatibility issues. This is because XNA wraps all the low-level details, such as DirectX settings, so the user doesn't have to worry. The only real differences when developing for different platforms are the controls. Even these for the PC and Xbox can be the same as they a both compatible with the Xbox controller. Another good reason XNA is great to start developing games is that it has many predefine methods which simplify tedious tasks. This is why I would recommend any one interested in games to start with XNA which is great way to understand how games differ from any other application.

Videogames Part 1: My Passion explained


Videogames: One of the youngest, if not the youngest, forms of entertainment. They began to gain popularity during the 1980's. But they got my interest during the 1990's with NES, SNES & N64. I can't remember the first time I played a game, but I can't remember a time without them in my life. By the time the N64 came out (1997) I had already decided that I wanted to dedicate myself to creating games. Of course by then I didn't know any of the specifics about creating games, but I knew I would like it. Finally years later (high school) I learned the specifics and loved what they were. So with videogames being my main goal I set out to study Computer Science. So with videogames being this influential in my life, I have a great passion to make my own.

Monday, November 22, 2010

Comic-Con 2010: The Return of the Con (unfinished & will be left unfinish)

Unfinished post about comic con 2010:

This past week was my return to the San Diego Comic-Con after missing lasts year's due to tickets selling out. I was accompanied by my good friend Brawlio. This turn out to be one of the most memorable Comic-con's I've been to. Tons of things happened, everyday was mark with at least one thing worth talking about. So let us begin a recap of how this year's Comic-con was like.

Wednesday (aka Previews Night):

We arrived at the convention center about 90 minutes before the exhibit hall opened, so we had enough time to pick up our badges and get something to eat. Once we returned from eating the exhibit hall was open and Comic-Con had begun! The first thing we did was walk around the exhibit hall and see who had come to the convention. I have to say I was happy when I saw Nintendo was back this year, even though it was a small booth.
After we saw most of the exhibit hall we headed towards the Xbox booth and the Capcom booth. But we stopped at Funimation where I decided to make my first purchase a Brown Bag, fill with three random DVDs which turn out to be Beck, Speed Grapher, and Peach Girl, all complete series. From there we went to see what anime related figures were being sold. Here I was tempted to buy a figurine but I decided to think about it a little longer. Finally we made it to the Capcom booth, which is close to the Xbox booth. So here we decided to split up, Brawlio went to play Marvel vs Capcom 3 and I went to the Xbox booth to play some Halo Reach.
While I was in line to play Halo Reach, I had the opportunity to talk to one of the producers of Fable 3. He explained the main story of the game, some of the thing that have changed from Fable 2 and the brand new start menu. I have to admit the new menu is pretty cool, no more scrolling through a huge list of items. After this little preview to Fable 3 I got to play some firefight in Halo Reach. It was pretty awesome as usual, and I ended in the first position.
Afterwards we took a picture on Chuck Greene's motorcycle with his jacket and something to kill zombies with.


Finally the exhibit hall closed for the night.


Thursday (aka day 1)

On this day we arrived around 10:30 at the convention center. As any other day, the first thing we did was to walk around the exhibit hall. During this walk this happened:




After a while Brawlio decided to go to the Dead Rising 2 panel, so we decided to meet afterwards at the Viz Media booth. I decided to go to the Xbox booth and 'waste' my time there. I got to play Comic-Jumper and got a sign poster from the creators (same as Splosion Man). Afterwards I decided to start making the line for the Viz Bags which this year were black. When I got to the booth there was already a line but for something else, so they didn't let me start a new line for the bag yet. So I decided to start the line for the line for the bag :D Finally the real line was created and soon after it started moving! During this process of picking up the bag I met with Brawlio, and once we had our bags we decided to try and get another one by going to the end of the line. The plan was a success and we had two bags each.
Now it was around 3 o'clock and we were getting hungry and I wanted get into the Force Unleashed 2 panel which was going to start in about and hour and a half. So with these in mind we decided to eat something, and we headed out towards Horton Plaza. There we met with our old friend teriyaki. I think he was happy to see us, though my stomach was happier :D
Once our teriyaki plates were empty and our stomachs full we went back to the con, where we headed towards the SW:TFU2 panel. We were able to get in to the panel without any problems. During the panel they showed the trailer, which was already out, and they showed us a demo of the game. The demo was pretty long and fun, afterwards they showed another video were we got to see that Boba Fett was making an appearance in the game! The panel ended with a Q&A as usual. I do have to say I'm really interested in this game, looks like a lot of fun just like the first one. As soon as this ended we decided to stay in our seats and wait for the start of the next panel.
For me the next panel turn out to be pretty boring, I almost fell asleep! But for Brawler it was a lot fun. The panel was Capcom's. The problem with the panel was that there was too much talking and few videos. They didn't show much of Marvel vs Capcom as that had it's own panel the next day. Another problem the panel had was that most of the presenters were japanese and didn't speak english so they had translators and this usually slows things down. Once this ended we decided to once again stay for the next panel.
Of course the next panel was the main reason I arrived two panels ago to this room. Halo: Reach. That was the panel I've been waiting all day for, and it didn't disappoint. They started with Firefight, and the first thing they revealed was versus mode in firefight. And this actually looks like fun, though after seeing beast mode (GoW3) I wished we could play as something apart from elites. But never mind that, it still looks like fun. Now afterward they showed what most of us wanted to see, the new Blood Gulch now known as Hemorrhage. But just as interesting was the gametype in which they were showing us the map: Forge. So they began showing us how forgeable the map actually was, by deleting a whole base and some rocks. Then they decided to get in a falcon and show us beyond the canyon. It was huge we could see down below another spartan driving around in a warthog and he looked tiny. Forge World, as they named it, is going to be a great addition to an already great game. Afterwards they showed some the new items available in forge. They also showed the new options like physics (yay for phased physics) and angle snaps. These will make forge a great sandbox to play with and build cool new maps. Seriously cannot wait to see what other people will build with these if I am already impressed with some of the stuff they build with the now crappy options in Halo 3. After showing of Forge World they announced the new Xbox 360 Halo reach SKU. It looks pretty nice but my Xbox still works perfectly and hoping for it to never go to the RRoD side, so I'm not interested in this new SKU. Finally they finished with some questions from the audience, some were interesting but the only one worth mentioning is that now you'll be able to have 1000 items per type of item(ie 1000 maps, 1000 game variants, and 1000 clips). This is great a new as it was tedious in Halo 3 having to use a silver live account to save items that didn't fit in my gold account. With these the conference ended and we went home stopping at a store to buy ingredients to prepare ourselves some sandwiches so we won't need to eat outside of the con.



Friday, August 27, 2010

I just remember that I still have a Blog!

To think my last post was about a year ago :O This is what happens when you work and study without giving up anytime for videogames (good priorities). It was natural that somethings got canned from my mind completely like my blog. Can't say the next will not be in a year as I'm still in school and working, but now I'll try and remember that I have a blog. And time is not an excuse for not doing anything; time is only a way of creating boundaries to convince yourself not to do things you really want to do. So yeah time as an excuse is only an illusion.