Thursday, November 28, 2013

INFR 3110 Blog entry 9

This  week, I have been working on the question 9 of homework question. After finishing the base question, I will have enough 40 exp for the final exam, but I would still looking forward for more exp to increase my final grade.

Q9) Inventory System Mini Game: Implement a triggering system that lets you collect objects when your character hits them.

I think the most difficult part of this question is the collision between character and objects. Fortunately, we got an example of ray picking from the twoloc engine and we can find some clue on how to do the collision in this sample. In the ray picking sample, we can find that it created ray to check if the mouse had clicked on any entity by normalized the mouse input. After ray created, we can then createRayQuery to store the items into the query then find and return to the closest one.

  float xNorm = OGRE_CORE->mMouse->getMouseState().X.abs / 
    float (mCam->getViewport()->getActualWidth());
  float yNorm = OGRE_CORE->mMouse->getMouseState().Y.abs / 
    float (mCam->getViewport()->getActualHeight());

  Ogre::Ray lMouseRay = mCam->getCameraToViewportRay(xNorm, yNorm);

Basically, the pickObject(); function in the ray picking did the most part of collision for question 9 base. For the ray function, we can use the object's position and direction to fire the ray. We just need to change the way where the ray being created. To do so, I searched and found some very useful material from here. In this website, we can learn how to detect objects when you shoot out fire.

Ogre::Ray::Ray (const Vector3 & origin, const Vector3 & direction)

For the position, we just simply characterMesh->getPosition(); but for the direction we have something needed to be work on. 

Ogre::Vector3 direction = Ogre::Vector3(Ogre::Math::Cos(mMechDirection),0,Ogre::Math::Sin(mMechDirection))

This is what we can find from the above website, to get the direction of a moving character we have to cosine the x and sine the the z. But if we just put this directly to our pickObject function, your character will pick up all of the the items through the ray remotely before it actually touches the object. We need to shorter the ray!

Ogre::Vector3 direction = Ogre::Vector3(Ogre::Math::Cos(0),0,Ogre::Math::Sin(bForward));

While the y axis is going upward and downward, we can just ignore it and put a zero for it. Then depend on which direction your character is facing to, we change the x or z value to the variable where you declared how much the character move forward. Finally, I can pick up the items when my character hits them rather then grab them up by ray.

Wednesday, November 27, 2013

PVP Fight

Mackenzie Sturrup's Tectonic Shifting Device Review

Trigger and Enemy placement
When I first entered the level, I saw some spiny objects moving around and I can easily realize that those are the enemies of the level. Enemies are floating in balance around the level. When the player character approaches them and touch them, player will lose 1 health. By running through the level, player can also see there are some pink cubes that distributed around the level, the cubes were collectible and player were supposed to collect all of them in order to open the exit. Therefore, in terms of the trigger and enemy placement, I think they were placed at key locations in the level.

I really like the main character model, it was very detailed and animated where my character doesn't... 

Mechanic Design
The objective of this sidescroller game is to collect all the pink cubes in order to win the game. Player character has the ability of shooting bullets from his gun. The enemies have certain amount of health, so that the player can't kill them in one shoot. While the player character got hit by enemies too many times, player lose and have to restart from the beginning. The level did not provide any power up for health support, so player can only depend on the original health points. After playing for a few minutes, the game reach to the end of the right side, player had to jump down to the much lower platform and pass a sliding platform. However, the game has to be ended beyond this point, since every time when I was on the sliding platform and almost arrive the other side, I will fall down through the platform. In all, Mackenzie's game has an interesting core mechanic that is used competently.

Challenge and Progression
At the beginning, there were only enemies to be killed and cubes to be collected, enemies can be killed by shooting several times, and this gave moderate challenge to player. By more exploration, I can find that other than the collectible and enemies, this game also featured with sliding platform. The platform not only made the game more interesting, but also gave player more challenges. Therefore, this game has a progression of difficulty, easier at the beginning and more challenging towards the end.

Design considerations
When I first played this game, when player has to use the mouse to click in order to shoot out bullets, I felt this design is quite inconvenient. While controlling the character direction with keyboard arrow keys or WASD keys with my right hand, I am lack of coordination to use my left hand shooting with mouse. I think this design may be much more suitable for left hand writer while I am not. The other design consideration would be the problem about the collectible; even though player collected all the cubes, the game did not show an ending. I think this part is lack of design consideration and can be improved simply by showing an ending text on screen.

Recommendations for future improvement
For improvements, I think the designer can add some direction notes for player. The game did not give player direction when they were supposed to jump down to the very lower level. This may make player confuse where they should go. Create an exit or a simple door, or text to let the player know that the game is ended, this is also very important to make this game more complete. At the very beginning, I recommend to notice player the aim of the game which is to collect all the cubes in order to win the game.

Monday, November 25, 2013

INFR 3110 Blog entry 8

This week, I have been working on the mesh morpher and the myGUI system. In the morph targets question, we need to morph at least mroph 5 targets and they should be move continuously back and forth. In the nice ogre library, we can do it in a very straight forward way by using the function softwareVertexMorph().

entity->getMesh()->softwareVertexMorph(t,morphTarget1,morphTarget2,targetVertexData);

Where t is how much you want to morph in time, morphTarget1 is the original mesh data, morphTarget2 is the mesh data that you want to mroph to from the original mesh, and the targetVertexData is the target mesh data that you want to apply this morph to. Therefore, the mrophing action will apply on the third object and it has to apply on a third object, otherwise errors will occur. and this third mesh has to have the same number of vertices with the original mesh and the target mesh, or they have to by edited from the same model.

To upgrade the morph question, we need to use myGUI to select different object and morph between them depending on the user input. Since we already had a tutorial about how to use myGUI layout editor to create myGUI window, we can do it very quickly.

The other homework question that required myGUI in a major part is the inventory system where we have to collect the items and have a preview of the item in 3D, spinning. This is the most difficult part for me and I have to figure it out as soon as possible before the homework question deadline.

Friday, November 22, 2013

INFR 3110 Blog entry 7

This week, I went over the homework question 1 and finally found a way to export keyframes from Maya to Twoloc successfully. To do that we first need to load a fbx file in Ogre and we can simply just grab the code from the fbx loader sample in twoloc engine.

std::string lFilePath = TOOLS::GetEnvPath ("TwoLoc_PATH", "\\Samples\\Resources\\Models\\cameraPath.fbx");
std::string lMaterialPath = TOOLS::GetEnvPath ("TwoLoc_PATH", "\\Samples\\Resources\\Materials\\");

TwoLoc::OgreSceneInfo lInfo(mMgr);
TwoLoc::OgreFbxLoader lNewLoader(lFilePath.c_str(), 
                                &lInfo, 
                                NULL, 
                                lMaterialPath.c_str());

Although I tried very hard to use the directory of the homework question project to keep it neat, I just felt so annoying to fix the path errors, so I put the fbx and the material files in the engine folder. Otherwise, I would get errors for the wrong file path or you will render a gray scene with nothing on it.

lNewLoader.Initialize();
lNewLoader.ParseScene();


The fbx loader sample said ogre would automatically load the scene in normal! However, I don't know why, maybe some abnormal things happened. If I don't put this two lines after I loaded my fbx, the project could not be compiled. After, loading the scene, we just need to get the locators' positions we created earlier for the camera path and lerp between them using the Ogre::Animation class.

To get the locator, first we need is getting the locators name which ogre already got it when it loaded the scene.
std::string locateName = "locator1";

Get the scene node of the locator from Maya, ogre automatically created the nodes when loading the fbx.
Ogre::SceneNode* locatorNode = TOOLS_OGRE::GetOgreSceneNode(locateName .c_str(), lInfo.GetRootNode());

Store the position to vector.
locatorVec = locatorNode ->getPosition();



Next is to keyframing the animation. Ogre makes our life much easier by having the animation class, although its still takes time to figure it out.

1)  Create an animation, name it and set the length for it. Then LERP IT!
Ogre::Animation* animation = mMgr->createAnimation("cameraPath",yourAnimationLength);
animation->setInterpolationMode(Animation::IM_SPLINE);

2) Create the route for the animation you just set, and decide what object do you want to animate. Here I use my camera node camNode.
Ogre::NodeAnimationTrack* track = animation->createNodeTrack(0, camNode);

3) Create keyframes on specific time and translate the object to the locator's position.
Ogre::TransformKeyFrame* key = track->createNodeKeyFrame(timePos);
key->setTranslate(locatorVec);

4) After setting up how the animation works and it path, we put the animation on screen
Ogre::AnimationState* camAnimState = mMgr->createAnimationState("cameraPath");

5) Update the animation in the update function.
camAnimState->addTime(0.5);

Crafting a Dekonstruer

In this blog, I would like to identify the game design atoms of the iPhone/iPad/iTouch game: Kingdom Clash, and how they work together to form a complete and enjoyable experience for me.

Players
Kingdom Clash is a single player game in which the player have to against other player in the game. You become a landowner of a kingdom and your knights will teach you how to play the game and tell you the story within the game at the very beginning. After that, you take the whole control of the game and decide to continue the story to fight the evil Iron Swarm or fight other players to gain resources. You can also join an alliance to gain troops from it to improve your kingdom.

Objectives
The goal of this game is to grow and expand your kingdom as strong as possible and crush all of your opponents. You can choose to fight battles to gain resources from other players or just collecting them from your own kingdom, but in either way, other players may still take their chances to attack you. Therefore, you better protect your kingdom and grow stronger to against the intruder.

Rules
In Kingdom Clash, when someone attacked your kingdom and you lose the battle, you will get a shield to protect your kingdom by blocking any player to attack you in a certain time depending on the percentage of your kingdom had being destroy. However, you can only attack other kingdoms when you are not protecting by a shield, otherwise, the system will ask to take off your shield. Once you decided to attack other kingdom, you have to pay coins to find a match, the higher level you are, the more you need to pay for. The system will find a match for you randomly and different kingdom has different loot to gain, if you are not satisfy with the loot you can gain, you can choose the next match and of course you still have to pay for it.
Another important thing in this game is to build and upgrade the resource and other useful buildings, but it is limited by your worker numbers. Each player can purchases two workers by coins and a worker can only build or upgrade one building per time. The building needs more time to upgrade when it reaches the higher level. If the player wants to get more workers, then they have to win the tournament or it costs real money. When placing the building, you can't put it on the area with trees and rocks, or you have to remove them by demanding your workers.

Resources
There are three very important resources in Kingdom Clash: coins, spellstones, and gem.
Coins: use to build the spellstones storage, spellstones quarry(where you can collect spellstones by time), removing trees, all the building that related to the troops, and also training troops for battle.
Spellstones: use to build the coins safe, market(where you can collect coins by time), removing rocks, and the defenses.
Gem: use to buy more workers and shorter the time used to build or upgrade.
These resources are extremely in this game, because without them you can do nothing and you are not even playing a game.

Game States
The main game states for this game are including your kingdom level, royal points where you gain it from a battle, coins, maximum number of coins that you can obtain, number of spellstones, maximum number of spellstones that you can obtain, and the gems.

Information
All the information as stated at the game states are visible to the player. When player visits others' kingdoms, they can also get the information of others such as his/her kingdom level and royal points, but the total coins, spellstones, and gem he/she has are private to the player. Once you decided to attack a kingdom, you can see the available loot, royal points you can get, and royal points you will lose if you lose; that is the privileged information to the player who paid to find the match. However, the opponent's alliance troops in kingdom is hidden from the player even you paid to find this match. The alliance troops will pop up when the player's troops step over the alliance castle.

Sequencing
Players take their actions in time limits during battles.Each player has 3 minutes to storm the opponent's place in each battle, they can gain as much as resources as they can in this 3 minutes. Player wins the battle while they can destroy 50% of opponent's kingdom. However, other than the battle the rest of the game is in simultaneous play, player can build and upgrade and do anything they want at anytime.

Player Interaction
Players get direct conflict between each other. They attack each to gain valuables; while someone attacks you, you will lose coins and spellstones no matter you win or lose the battle. Your royal points also decrease when you lose. The other part of the Kingdom Clash that has player interaction is when you join an alliance, you can request troops from them. Likewise, your alliance would request troop from you too.

Theme/Setting
Kingdom Clash has a very simple theme within the game: defeat the evil forces of the Iron Swarm. When player press the attack button, the screen will display two choices for you, one is to pay and attack other kingdom, the other one is to attack the Iron Swarm kingdom. While player chooses to defeat the Iron Swarm, you will then enter the story mode and versus the game system.

How they work together
In Kingdom Clash, the objectives are very depending on the theme. The theme of defeating the Iron Swarm let the player to have a proper reason of attacking other players for resources and grow themselves stronger to fight the boss, although the storyline is optional. After attacking someone else, they probably want to revenge you, and this made the objectives make sense. The rule of limiting the construction number per time define the workers (game state) that you have and giving player more challenges to grow the kingdom. Resources cause the player interaction where they attack each other to gain and grow. The rule also affects the sequence of the game, when player has the shield protecting their kingdom, they have to make decisions on whether attack other or not. This rule actually prevents player to take turns for battle and affecting the sequence of player's actions.

Sunday, November 17, 2013

Game Design and Production II Lecture 7

Play Spaces and level Design

In this lecture, we talked about the play spaces and level design. Play spaces are the areas where players can interact with the game and also other players in multiplayer game. Level design is to create challenges, triggers, events, and also to make the level more interesting. While the game designer designs the game play rules, level designer's job is also to design how a player is confronted with the rules.

“Level design is putting theory into practice”
Level designer need to think a lot about how are the rules going to be interpretive. One of the other very important thing to level designer is how do you make people learn in the level . Often times, in the game there would be new weapons, new abilities, and new mechanics and level designer needs to design how to allow the player to understand what's going on, and how to use that new abilities and new weapons. The responsibility to a game designer is to ensure that the player knows how to use the mechanic. Therefore, designers always need to imagine themselves as the actual players in the game in order to think that how he/she can challenge himself/herself to use and understand it.

What do you teach to players?
While the players start your game, they need to understand the physical rules of the environment. This is especially important to the games that are not using our real world as their environment base. In the real world, we knew there's gravity, we knew we will sink if we fall into water. However, when we are designing a magic game world that is overhead or undersea, we need to let the player know the physical rules of your environment, how to survive in the game world that you designed. The next thing that level designer need to teach to the player is the abilities of player's in-game character. What can the player actually do in the level? How to use this ability and weapon? What's the effect if I ate this or grab this item? Level designers should provide instruction or guidance, and give player novice mission/training mode to let them understand. The next thing to teach is the behavior of enemies. Different type of enemies may have different kind of attacks and behaviors. While the player character attacks the enemies, they may get more familiar with their own abilities and controls. The last thing is the game's reward system. So the player knows if they do this, they can get certain kind of reward or damage back.

Level design golden rules

  • Be consistent
  • Don't require skills in a level that you have not taught the player
  • Always teach main goals and rules first

One of the most important golden rules is to be consistent, because if you have the mechanic keeps changing in the game, the player will need much more time to learn how to use it and this may decreases their focus/attentions and makes the game very hard.

Goals
During the game design process, designer should try to achieve the external goals and internal goals.
External goals are basically the things that could make your company money. It is the things that are high value to the company and the developer. Internal goals are things that derived from game play specifications. Internal goals can also be trying to give the player the sense of achievement and when do you want to reward the player.

Linear Levels
Linear levels are the levels that go straight from the start to the end and doesn't have any extra quest other than the main quest. Linear levels perfect control for level designer and it's very consistent. The disadvantages of Linear levels would be constrained players' freedom and game play events might be forced on players. No matter what the player do, the game would only get into the main story theme. Single player games would usually be considered as linear level game. A very good example of linear level game would be Mario.

Semi-Linear Levels
Semi-linear levels give enough freedom for players to feel they are controlling the game. In this kind of level, players have the main quest but there are still many other side levels, side quest, or even side story for the player to explore. The disadvantages for semi-linear levels would be leading players by nose when uninspired and logically inconsistent.

Non-Linear Levels
In non-linear levels, players get the maximum control of the game and take responsibility for their own failures. It also gives player the sense of gameplay ownership and it's free content. Most kind of MMORPG were non-linear levels, player controls their character to go anywhere they want. They can challenge the higher level of enemies if they want and they take their responsibilities like dying when they fail. Of course non-linear levels are extremely hard to test, players may break the game with unforeseen actions, and loopholes in gameplay logic, that's why MMORPG always have their regular maintenance time to fix this errors.

Wednesday, November 6, 2013

INFR 3110 Blog entry 6

Last week, I was still working on the errors I've got with twoloc engine. Although I found a method to solve the bin\Debug\..\..exe errors, the problem actually still can't be fixed. I knew that it was pretty lame to just copy and paste the .exe file to fix this errors, that's why I asked our nice TA for help during today's tutorial.

I kept getting 17 errors when I was compiling the engine. :(

Uable to start program because the system cannot find the .exe file.
I tried re-cloning and re-installing the twoloc dependencies over 20 times but still got the exact same 17 errors while compiling the engine. And Visual Studio kept saying that it can't find the .exe. After asking TA for help today, I understood that the PC's system language DOES matter! Although I got errors before I changed the system language, I still tried to change it back to Canadian English base, and then the engine complied successfully.

The other thing that I have done this week is the robot arm homework question:
+
While we were doing question 3, we needed to include a box generator header file to completed it.

#include "ProceduralBoxGenerator.h"

However, you probably will get some errors if just including the header file. What we can do to solve this is very similar to the solar system question as I talked about in the previous blog post. The difference between them is just changing VS2008 to VS2010 format.
Go to the project properties and add the following stuff:

C/C++ -> Preprocessor add:
PROCEDURAL_STATIC_BUILD

Linker -> General -> Additional Library Directories add:
$(TwoLoc_PATH)\lib\VS2010\$(Configuration)\$(Platform)\OgreProcedural

Linker -> Input -> Additional Dependencies add:
OgreProcedural_$(ConfigurationName).lib

After adding the above items, the project runs perfectly fine. In this question, what we were supposed to do are very similar to the solar system too except for the planet's orbit. For the robot arm we just need to nodes: a rotation node and a translation node for each part of the arm rather than the planets' three nodes(orbit, rotation, translation). The whole thing is about parenting the nodes to the right places.

Scene graph for my robot arm


Robot arm that I did. 

Game Design and Production II Lecture 5

Digital Prototyping

In the fifth lecture, we talked about digital prototyping for games. Digital prototyping is the main concept as a blueprint of a game. We can understand how is the game going to work, how does it feel, and how does it look like through the game prototype. There are four areas of digital prototyping: Game Mechanics, Aesthetics, Kinesthetics, and Technology.

Game mechanics is the formal aspect of the game. It is generally the main question or the problem that you want to model in the game. Every game design starts with a problem and player is the one who is supposed to solve it. When prototyping the game mechanics, designer should think of what rules they should put in the game to make it interesting and focus on the core mechanics. We should prevent to put too many design questions in the game at once, since it may make the game feels scattered. When designing the game mechanics, we should also keep it balanced, so that the game won't be too easy or too hard. Game mechanics also included designing the game logic like how much will it be demaged when you attack or being attacked, your health and experience points when you each time level up. Those mechanic questions can be done on spreadsheet like in Excel.

Aesthetics is referring to the the view of your game, it is the visual, audio and dramatic elements of the game, like how things are being performed and showed to the player. It is like how the things look like when they are in motion within the game. How does an avatar run or attack, how does it work in the game? Do we make the animation very smooth by putting many details on it or just make it with very simple animation? Which one fits more to the visual style of your game? What kind of audio we should put in certain areas? Those are all the questions that we need to consider when prototyping aesthetics of a game. We can prototype aesthetics by storyboards, concept art, animistic, interface prototypes, audio sketches etc.

Kinesthetics is referring to the feeling of your game, which is like how the controls feelings and how the interface feelings. The types of control that are available to the player like mouse, keyboard or special controller such as Wii mote, are the things that we should consider about when we are prototyping. When we first design our game, we should always keep in mind that what controller we are designing for, because different kind of controllers can make the game "feels" very differently. For example, it would be much more fun if we use a Wii mote to play a dancing game rather than using classic keyboard or mouse.

Technology is generally all the software that make the game works in a technical way. Nowadays, digital prototypes are mostly based on technologies. When prototyping, when should think of what kind of technology we can use to create the certain graphics, AI, and physics in your game. Since the technology is changing constantly today, we should not just stick on the programming language that we usually use to create the prototype, its always better to prototype with some easy and effective languages that we can rapidly build out something. If we always reuse the same code that is written by a specific language, we cannot learn anything new; we may not easily move on or adjust to a new programming language.

One thing that I have learned in this lecture is that digital prototyping before start building a game is important, because a good prototype gives us an easier way and guide us to build what we want. We may also be able to fix the game mechanical problems before we have those issues.