Wednesday, December 8, 2010

4th Sprint and AI

Sprint Update
The last sprint was about AI. We used states to define which update function is used for AI ship. Then according the state the function is chosen and it overwrites the movement variables like the velocity and position of the ship. My part was to create explore (roam) state. I just used timer and after certain time the direction vector and thrust scalar are reset to random values. Question is if changing the thrust is necessary, probably exploring in random directions with constant speed may look better. The code was not tested yet.

AI Ideas
Here are some ideas that may make behavior of enemy ships look more realistic or interesting in gameplay:
  • Each enemy has its own scoring system and remembers in which states it got the highest score. This may help implement learning AI.
  • Changing AI state system that allows to apply several states at the same time. This would enable to have enemy for example hiding and chasing the player, or hiding and exploring, all at the same time.
  • Flocking and splitting the enemy and again flocking near the player.
  • Befriending some enemy ships so they work for you.

Monday, November 29, 2010

3rd Sprint and Pods Hud

For the 3rd sprint I was working on a part of the HUD that was showing the number of available pods and their types attached to the ship. The second part was to make it animated so for example the shield pod would have some graphical (for example moving bar) indicator of the remaining energy.

First part was easy, I just pulled out data from the ships class and passed it to PodsView class that represents the part of the HUD. Instance of PodsView class is inside the ship class since it is there were the number of pods changes (adding, removing pods). It also makes logical to update and draw PodsView there, in reality where is the HUD? It is inside the pilot's cabin and updates the state of the plane.

In regards to the second part making the HUD animated I am still not sure what those pods are supposed to do, I may need to talk to somebody about this.

Here is the video shot. It shows types and how many pods on the bottom left corner of the screen. There is no fancy graphic it is just showing functionality, there are currently 6 weapon pods.

Wednesday, November 17, 2010

2nd Sprint and GUI

GUI
This task was challenging for me since I was redoing it over, and over, and over ;-). It was about GUI interface, pop-up windows, scroll-boxes, buttons and their over, off, selected states and how all this stuff communicates among themselves. First I started with an idea that all those GUI elements can be just another screens but this unfortunately didn't work. I couldn't figure out how to make our game state management have more then 1 screen at a time. I think it is because it lists screens as states and only 1 state at a time is allowed. I found quite an interesting tutorial how to build a state machine that allows drawing multiple screens at a time and some really cool transfer-between-screens and "loading..." effects, the link is here . Unfortunately when I started implementing it I found It was over my head and even if I were able to pull it it would be like rebuilding the screen management from scratch. My final decision was to break everything in GUI classes and have GUIElement (it can be anything from button to scrollbox) that can be added on the screen and put into the screen class list as its member variable. All drawing and updates is then done by looping through their appropriate Draw and Update methods. Those GUI classes just take care of graphical updates on the screen, when anything is selected they just pass the appropriate index of selected item to its parent screen. Then it is up to the parent screen class to add any functionality and decide what to do with the selected item.



TODO:
  1. Right now I am having problem with transferring between screens that its buttons doesn't remember previous state (already pressed).
  2. It is missing Refresh screen method, when changing the screen resolution it doesn't update sizes appropriately
  3. Functionality, it needs to be decided on the whole New Game, Load Game flow and what information save in SavePlayerData structure.
File Management
I already had basic code for saving, loading, deleting files from the 1st Sprint so I just created a new Player class and move all these methods there. Since I am assuming that this Player class will contain all pertinent information about the player and his/her mission (name, level, score, which ship upgrades, weapons...) it should also carry methods for saving, loading, deleting itself. I found easier to do all operations on files only and then just update screen appropriately. Also to avoid any save or delete synchronization errors when overwriting data the file is actually first deleted and then again saved but with a different file name. The file name is always different and contains a time stamp.

Conclusion
I realized (unfortunately when I was almost finished ;-)) that I am trying to reinvent the wheel. Even that I haven't found some tutorial for GUI on XNA there must be tons of information how to do it in other programming languages. I suddenly remembered that we talked in CS3505 about Design Patterns. Good programmer has some ready programming receipts in his/her bag and I probably missed this opportunity to add a new one to mine.

Monday, November 8, 2010

GUI for XNA

It is surprising that XNA doesn't have any GUI classes to build something like drop-down menu, scroll boxes, buttons and so on. I went through some forums and it looks like all game developers just create those GUIs from scratch. I will probably try to do that also. It should have InputManager object as parameter, position on the screen, and more; the result should be some classes like PopOutWindow, ScrollBox, DropDownMenu, .... Then in order to use it I will need to create a Screen object and initiate and place those objects there.

Wednesday, November 3, 2010

1st Sprint and Simple AI with Acceleration (forces again)

Update on Capstone:
My part was to create load, save screen and device some means for it. In regards to screen I just reused the code from other screens made by Jason and James and tweaked it to my needs. The save, load, delete system had to be built from scratch. I made a choice to keep all files in the same directory and located it next to the executable file. This directory should not change anytime only the files inside it. After several tests and frustrations with file naming and their renaming on the fly it showed as best just to save them each time with different name made of a time-stamp. After each file operation the reloading files must follow together with refreshing the screen. I think this is the best way to avoid problems with any lag for file operations (saving, deleting,... is not instant) and related XML file corruption.

Simple AI with Acceleration (forces again)
Simple AI can be built quite easily with a notion of acceleration (forces). If we are passing the player's coordinates to all enemy ships then each of them can compute a force on itself with magnitude proportional to its distance to the player. Also at the same time we can introduce some small pushes in random directions. If the player's ship is moving the enemies will follow in its general direction, if the player stops they can just move randomly around one spot next to the player or if they acquired higher speeds they would be circling the player.


This effect can be applied to simulate the enemy flocking, instead of the player they would follow a leader.


Cool info on Flock simulation in Games

I found a cool info on more advanced flocking simulation http://www.red3d.com/cwr/boids/

Friday, October 29, 2010

3D Transformation Working!

Update on capstone:
I think I finished Level class methods save, load, delete. It was tested and works ok. Need something to save from Level, have no idea how to build the game level yet. I would like to start creating a load screen now.

Combined model working!
Back to previous block I think I finished it. My 3D model didn't have any ModelBones so it was done by combining several 3D models together. It uses AddChild() methods that add child GameObjects to its parent GameObject. Unfortunately it is a tree-like structure and I am not looping through it very efficiently. The question is if there are a lot of children what the game frame-rate would be. I believe it can be used for up to 2 levels of tree (child<-parent<-grandpa). I got a help with math from Yen, a phd student at SCI Institude. I have to admit this was hard to see how it works. I think it is still not finished and needs some testing. Here is the video shot from the XNA test, submoon<-moon<-planet<-sun, there are 4 planets, sun si moving in +x direction and the whole system is following it.

I put a forum thread about this at Gamedev.net http://www.gamedev.net/community/forums/topic.asp?topic_id=586310.

How to use it:
in Upload()
star = new GameObject(Content.Load("Models\\star"));
star.Scale = 4.0f;
star.Position = new Vector3(-10.0f, 0.0f, 0.0f);

planet1 = new GameObject(Content.Load("Models\\blue_star"));
planet1.Scale = 0.5f;
planet1.Position = new Vector3(3.0f, 0.0f, 0.0f);
star.AddChild("planet1", planet1);

planet2 = new GameObject(Content.Load("Models\\blue_star"));
planet2.Scale = 0.5f;
planet2.Position = new Vector3(-3.0f, 0.0f, 0.0f);

star.AddChild("planet2", planet2);
planet3 = new GameObject(Content.Load("Models\\blue_star"));
planet3.Scale = 0.5f;
planet3.Position = new Vector3(0.0f, 0.0f, 3.0f);

star.AddChild("planet3", planet3);
planet4 = new GameObject(Content.Load("Models\\blue_star"));
planet4.Scale = 0.5f;
planet4.Position = new Vector3(0.0f, 0.0f, -3.0f);

star.AddChild("planet4", planet4);
moon = new GameObject(Content.Load("Models\\red_star"));
moon.Position = new Vector3(0.0f, -2.0f, 0.0f);
planet2.AddChild("moon", moon);

moon2 = new GameObject(Content.Load("Models\\red_star"));
moon2.Scale = 0.5f;
moon2.Position = new Vector3(0.0f, 1.0f, 0.0f);
moon.AddChild("moon2", moon2);


in Update()
star.Rotation.Y += 0.01f;
star.Position.X += 0.01f;
planet2.Rotation.X += 0.01f;
moon.Rotation.Z -= 0.2f;

Thursday, October 28, 2010

Game Save and ModelBone Class

So I started working on game level save, load, delete options. In regards to file system I've chosen to save games in the given location the gamer can't change. Files will be handled in the directory next to .exe file (bin folder) where also the image storage is. Need to figure out exactly what StorageDevice class does.
Sources:
http://msdn.microsoft.com/en-us/library/bb199073(v=XNAGameStudio.31).aspx
http://msdn.microsoft.com/en-us/library/bb200105.aspx

In regards to previous blog I finally found a tutorial for animations in XNA 3.1. It uses ModelBone class and seems to be quite usefull. I am planning to wrap it in AddChild(), RemoveChild(), Transfer(), Rotate() methods. Combined model can move as one and its parts can move independently relatively to the model's center. Here is the video shot from the tutorial to get the idea:



This would allow us to build modular ships and some cool animations with complex models.
Sources:
http://create.msdn.com/en-US/education/catalog/sample/simple_animation (XNA 4.0)
http://www.toymaker.info/Games/XNA/html/xna_matrix.html (XNA 3.1)
http://www.toymaker.info/Games/XNA/html/xna_models.html

Monday, October 25, 2010

3D Modularity and Animations

I spent some time on this but still not sure how to do it in XNA... the idea is to create some

parentModel.AddChild(childModel);

function that adds (attaches) a child 3d model to other parent 3d model. The coordinates of the child would be relative to the parent's one. If

parentModel.childModel.Position

is changed it will do that in regards to the center of the parent model but not change the parentModel position itself.
Then the beauty of all of it would be that moving or rotating the parent by changing

parentModel.Position
parentModel.rotate

would move or rotate all those 2 models together as one. By combining children and parents and changing their relative positions (rotations) would enable us to code in C# some cool animations or build complex models like we were able to do in our other class CS2420 with C++ OpenGL http://eng.utah.edu/~dusatko/CS2420-EAE/hw6.html (video shot).

Another example would be the automobile model. The automobile has wheels that turn independently when the whole model is moving (preferably wheels turning faster when car speeds up)

Thursday, October 21, 2010

Game Engine Ideas

I believe that introducing force will save a lot of time when working on effects or with the environment. Then we can introduce some more interesting game-play with puzzles. The only difference from the version we have now is that you put a Newton law between and calculate position and speed by it.

// this would be inside your Movable class (or defined by interface)
public void Move(float time)
{
position += velocity * time;
velocity += _force * inverseMass * time;
}

public void AddForce(Vector3 force)
{
_force += force;
}

public void ClearForces()
{
_force = Vector3.Zero;
}

Then from your game class inside your Update() you would just apply to certain (or to all, or to just one) Movable objects a force... this force can be anything... then if there are no forces it would just not move or stay moving in constant speed.

// Inside Update()
//whatever objects you decide to act force on
foreach (GameObject enemy in enemies)
{
//whatever force you decide
enemy.AddForce(GetGravityAt(enemy.position));
enemy.Move( 0.001f);
enemy.ClearForces();
}

aside from the movable class there would be collidable one making sure that everything explodes or bounces properly if their bounding boxes collide...

Some examples of use:

  1. ship's racket engine - just applying force in direction you want to move or in the opposite to break. Here is the example please notice how there is a lag when firing the engine and how the movements of the ship are smooth - this would not be possible without using forces http://eng.utah.edu/~dusatko/CS1410-EAE/asteroids.html (CS1410 class, forces used)
  2. simple AI - you can code it the way that your ship's position vector is passed to your enemies, enemy class then calculates its direction vector to your position and applies it as a force. If the enemy is already passing by your ship it will start circling around you, then if it gets to certain distance it can start shooting at you (you decide). Here is the example, sharks get the force applied so they are circling around you http://eng.utah.edu/~dusatko/CS2420-EAE/finalProject.html (CS2420 class, forces used)
  3. Tractor beam - lets say you want to pull some asteroid, just aim and push the button, this would create some long 3d cylinder object starting from you and if it touches your chosen asteroid then it would have a collision with it and trigger adding some force to it in your direction
  4. Sticky nebula - this would be position dependent, if you get between certain coordinates in whatever direction you are moving the small force (smaller then your engines have) would act in opposite direction of your velocity. This would go for all movable objects that get to this sticky area.
  5. Black hole - this would be also position dependent, once you create a black hole it will check the nearest objects and add forces to them so they move to it. There would be some effect when they collide with the actual bounding box of the black hole.
I believe we can come up with many more ideas how to use this force. I think it is ok without the forces but all effects will not come so naturally and we may actually spend more time just figuring them out how to do some hacks to the game
engine.

Wednesday, October 6, 2010

Possible Storyline and Game Levels

I was lately contemplating over the story that would fit our spacecraft game. Here are two options I think I may like:
  1. The player is fighting and at the same time running away from some evil corporation. The only way to win is to find enough evidence about the company and bring them to justice. The player wanders through the space following the scrums of information and getting closer to the final resolution. Similar to plot in the movie Firefly but with only one character. Hyper jumps available or just classic space travel between levels. Ship repair or upgrades available.
  2. The player is lost in space and with half damaged ship is trying to find the way back home to the Earth. Each hyper jump or classic space travel gets the player to other more difficult level but closer to the Earth. Similar to the plot in the movie Lost in Space. Ship repair or upgrades available.
From our other EAE game design classes I found the level creation to be the most difficult task. To give it an early start I am brainstorming some possible ones here:
  1. To train the pilot the 1st level would be just classical getting out of the asteroid field
  2. Asteroid field + dangerous radiation star - pilot hast to pass by the dangerous radiation star, the only possible defence against the radiation is to tractor the asteroid so the player stays in its shadow. The asteroids are being vaporized and when too small the pilot needs to find another one to stay hidden from radiation rays.

  3. Defend the passenger ship against evil robots - classical space shooter fight defending the helpless ship
  4. Red matter escape - to finish this level and get to the other one is to penetrate an asteroid field surrounding the red star and avoid the evil enemy robot ships and shoot the Red matter into the star. This would create the black hole and the hyper-jump to next level would be possible.


  5. Sticky nebula - again fighting the evil robot ships with possibility to get stuck in dangerous slowing down sticky nebula
The final level can be a spectacular battle (similar to Star Wars) combined with all above difficulties, boss ship possible...

Saturday, October 2, 2010

Red Matter Test

Here is the small test I did in XNA for a possible new weapon, it works similar to the StarTrek's red matter. When it is shot into the star it creates a "black hole". The same game engine can be used for a tractor beam. Only instead of pulling all stars it would pull the one that collides with some tractor beam 3D model (maybe something like a long cylinder?). Here is the footage of the red matter prototype, the red star is the black hole now and it slowly pulses...

Friday, October 1, 2010

Space the Final Frontier

So I am a new member of the Space team. I am quite happy with this choice since I am a hard core Sci-Fi fan.

I think the idea of the red matter from the new Star Trek movie is just awesome. It can be used as a weapon (shooting it into the planet or star close to the enemies) or as a mean of escaping through its black hole. Here is some video that shows how the black hole may look like
http://www.youtube.com/watch?v=gCwlj4XJPMo&feature=related

In regards to changing gravity, we just need to tweak the game engine a little bit... in addition to checking on collisions it would recalculate distances between the enemy ships and the location of the gravity pull. This would also quite easily enable us to have the tractor beam.

I started playing with 3D engine and I hope to simulate some gravity pull and have it ready for the next week.

Tuesday, September 28, 2010

Final Game Pitch

For the final pitch I added health bar functionality. The colors correspond to following:
  1. Red - hungriness (food)
  2. Blue - thirstiness (water)
  3. Green - environment or physical health (weather)
  4. Orange - psychological health (happiness)
The red and blue are steadily decreasing and need to be recovered by food and water. The green bar changes with weather or illness and it can be recovered by hiding in the shelter. The orange one should respond to the character's psychological state, or how happy he is. In this prototype it increases a little when the character drinks or eats, and increases quite a bit when builds something (hut). It should also increase when the character rests inside the hut.

Tuesday, September 21, 2010

Video of Shipwrecked 2D Gameplay

This is just a very rough 2D prototype showing the game mechanics, it should be edited in some movie editor. It's missing health bars, full screen menu, some weather effects like storms to show decreased environment health bar would be nice. The health bars should be hopefully added before the final pitch.



The X BOX controls are the Stick to move, X to collect, A to build. Player needs to collect 3 sticks to build the hut skeleton, and another 3 palm leaves to finish it. We believe that it is fairly easy to build 3D game with the same mechanics; it would be only more time consuming to create all 3D assets.

More ideas about the game:
  • When health bars are low too often the character will get sick, he will need to find certain herbs to get cured also he will be required more often visit his hut to stay alive
  • When encountering dangerous wild animals the player can climb the tree, the animal will leave after a while (assumes some simple AI for animal class). It will randomly choose if the near carnivore is hungry (will attack and be more persistent) or sleepy with its belly full.
  • Player can find and domesticate some animals and make collecting his food easier (goat-like, turkey-like,...)

Friday, September 17, 2010

Pitch time is coming soon

After discussing our game with Bob and Roger we are doing short 3D walk-through and showing the game logic on simple 2D version. I'll be working on the 2D version, everything is mostly done, I am going to make the background scroll when the character is at about 1/3 of the game screen. My idea is to shoot a short video, character is walking on the beach or the outskirts of the forest collecting sticks, rocks, palm leaves. His health represented by thirst, hungriness, and environment bars will decrease. Thirst and hungriness bar will get improved by finding the water and food, to improve the environmental one (getting decreased when raining and bad weather), the character has to collect enough material and build a shelter. Building the shelter and checking how many more material is needed will open a full screen menu (this menu will be faked in a video editor).

Wednesday, September 15, 2010

Shipwrecked 2D


We work on 2D only, we need some menu on the right side with collected items and with some list of build-able things, grayed out ones means the player need to collect more items for it. Player collects items just by approaching them. On the right bottom side there would be health bars, thirst and hungriness.

update 1:
Right menu should be only icons with titles; drop-down lists or any text lists may not be the best pleasing solution.

update 2:
There should be only available tool menu, and health bars. With some combination of keys enable player use the tool. Choosing what to build should pause the game and open full-screen menu. Also things may be built gradually, requiring to collect more stuff, so the game experience is more real-like.

Tuesday, September 14, 2010

Hacking it together


We decided on 3D walk-through. I was kind of sawing together code from these tutorials:
3D tutorials
http://creators.xna.com/en-US/education/gettingstarted/bg3d/chapter1
http://msdn.microsoft.com/en-us/library/bb203897.aspx

First person view
http://msdn.microsoft.com/en-us/library/bb197901%28v=XNAGameStudio.30%29.aspx

It needs to be polished but it works. It's missing proper terrain and plant models but this can be easily changed and added. Works both with keyboard and XBOX controler. It has no engine so far, no 3D avatar.

Friday, September 10, 2010

Getting Ready for the Shipwrecked Pitch

This is just an another list of ideas for Shipwrecked:
  • this is to be a tropical island, so introducing some interesting animals, like living in Madagascar, Australia, ... may be a good idea
  • weather, day-night, seasons, wild animals would force the player to build a shelter, warm himself and cook meal, and regain his health there
  • player may escape the wild animals by climbing the tree
  • we may have to consider how to cut down on rendering the distance 3D objects, collisions may be calculated just in zones, but rendering is still a problem, too heavy on computer resources
  • the prototype will have some simple 3D walk-through, some sandy terrain, simple plants, maybe some shipwreck, also player's health bar may be put there

Thursday, September 9, 2010

Game Engine for Shipwrecked

So I am on the team building the game Shipwrecked. I am thinking about how the game engine should look like. We will need to explore the island, gather items, and finally build something from it. I found this simple flash game Build the Bridges where, well the player builds bridges... and I guess this should be a good start.

Wednesday, September 1, 2010

Adventures at the End of the Universe


After several years you wake up from the hibernation sleep and find out that you are hopelessly off the known star charts. Your colleges in other hibernation tombs are dead. The only way to return to home is to do almost blind hyper jumps in very inaccurate direction. Each hyper jump is another game level with more difficulties to get through but closer to the Earth.

  • cartoonish with public domain Hubble photos
  • new real-like physics engine that introduces warped gravity fields, magnetic force fields, vaporizing radiation rays, slowing down sticky nebula...
  • weapons: laser, bomb, protective force field (possible tractor beam as Bob suggested - that's doable)
  • driving: all directions, forward turbo-engine, on/off visibility of gravity field lines or dangerous radiation (radiation as reddish fog shaded out by asteroids - viz image below)
  • obstacles: physics, hot stars, black holes, asteroid fields, sticky nebula, warped space, increased radiation (will need to stay behind some big asteroid), magnetic meteorites (will be attracted to the spaceship),... many more and their deadly combination. When being pulled in by the black hole doesn't mean game over but reemerging in some other older level, player would have to repeat some number of levels between.
  • asteroids would also be driven by changed gravity field or "sticky nebula", vaporized by hot stars, breaking each other, magnetic meteorites would be sticking or repulsing each depending on polarity - this can be quite spectacular. Even that there is a vacuum in space there would be introduced some cool sound effects.
  • after finishing level option to go to hyperspace to the next level: effect something like in Star Wars but more colorful
  • easy controls, no cumbersome key combination
  • mystery touch, something like in the movie Aliens

Tuesday, August 31, 2010

Tentative Game Pitches

1. Quest for grail


Isn't it time that games start teaching us about ourselves?

  • main character is changing
  • puzzles with different solutions -> character is evolvingphysicssingle player, evolving game, prizes
    some psychology? AI that decides on brute-like, Zen-like, angel-like,... player's character
  • 2D, cartoonish
  • can be applied to any game genre Platformer, Asteroids, medieval Quest for a holy grail,...
  • easy controls, no cumbersome key combinations

2. Asteroids


Adventures at the end of the universe.
  • easy controls, no cumbersome key combinations
    weapons: laser, bomb, turbo-engine
  • physics, hot stars, black holes, asteroid fields, sticky nebulas, warped space
    after finishing level option to go to hyperspace
  • mystery touch, from movie Aliens