ASSIGNMENT NUMBER ONE
http://www.mediafire.com/?48p24sxq29ojqn9
What is done here is basic file IO as well as basic string manipulation.
The instructions are:
1)Create a separate file using IO and store user input into it.
2)Manipulate user input any way you wish (doesn't have to be creative, just show on cmd line it's adjusted)
-Use at least two different C++ functions of inputting data
3)Use an array anywhere and anyway you wish in the program.
This should cover a lot of basics in C++, in later programs we will touch base with a lot of more complicated C++ concepts.
*PLEASE NOTE: I am leaving this as vague as I possibly can because it will make you have to do a lot of reading and research to figure out how to do it. When everyone is done we can share our code and talk about it to see how each of us approached the problems in our own unique ways.
*I don't think there's a time limit if there should be one I don't wanna impose one talk that over with the group leads
ASSIGNMENT NUMBER TWO will be embedding the lua language into Visual Studio (my version I did it in is 2010 Express)
1)Embed Lua into a VS program
2)Have the C++ part of the program call on a Lua script and have it pass "Hello World" to the console.
I can't put the exe up here because it requires too many outside resources. When you are done let me know and we can share our code.
The reason for assignment number two is to have a clean slate to practice scripting in the lua language with it's own libraries. You will be using this project again in the future so make sure not to delete it.
*I will make a powerpoint very soon to go over a lot of simple concepts and problems you will most likely come across while writing this program with little to no c++ knowledge (I had my fair share of 'hiccups' writing it as well lol . the powerpoint to comewill also go over things that C# and C++ have in common and basic functions that'll be used that are different that may cause confusion. This exe will create a .txt file where ever you place it.
This is my portfolio where I post projects I have completed for school as well as my own personal projects.
Sunday, February 17, 2013
Thursday, January 17, 2013
Programming in CryEngine
Hello, I have spent many hours scouring the net to get cryenging ready for my own code. I am compiling what I know from what I have found to help save YOU (Thats' right, YOU, you intelligent, beautiful/handsome and witty reader) so many frustrating hours I have endured. Without further adieu, lets begin:
When first loading CryEngine with MicrosoftVisual Studio 2010 it will not be able to open up
the solution file for CryEngine, the files grayed out I just deleted. After
it is deleted I added the CryCommon file, and it works fine.
Compiling for the fist time I got an error with "cannot open afxres.h". Replacing it with "windows.h" fixes this.
Here's why: THIS is an MFC.
MFC stands for "Microsoft Foundation Class Library".
MFC is an OOP wrapper for windows API.
windows.h is a header file for C language which is not OOP.
windows.h contains declarations for ALL of the windows API.
It's just one of MANYannoying work arounds I came across in my CryEngine Adventures
T stands for sTupendous success!!! This is a 3D model and a 2D image on a lua script marking
out on the map where the entity is placed. Its a teleporter script and the code is below:
TWO important things on lua scripts in Cry:
1)The first block of LUA code is a .ent definition which is the name of this entity
and defines the scripts location.
(These lau scripts are not my own. Remember: It's a compilation of what I found to get started)
<Entity
Name="Teleporter"
Script="Scripts/Entities/Others/Teleporter.lua"
/>
(You may notice this is written as .xml and that's because I don't know... It's cryengine)
2)the actual .lua script is where the constructor and functions are.
Teleporter = {
Editor =
{
Icon= "AreaTrigger.bmp",
},
Properties =
{
teleportDirX = 0,
teleportDirY = 0,
teleportDirZ = 0,
object_3DModel = "Editor/Objects/T.cgf",
},
}
function Teleporter:OnInit()
self:OnReset();
end
----------------------------------------
function Teleporter:OnPropertyChange()
self:OnReset();
end
----------------------------------------
function Teleporter:OnReset()
--this will set the selected 3D Model on the entity
if (self.Properties.object_MyModel ~= "") then
self:LoadObject(0, self.Properties.object_3DModel);
end
end
--tell the engine that we can interact with this entity
function Teleporter:IsUsable(user)
return 1;
end
----------------------------------------
function Teleporter:OnUsed(user)
--check „user" being valid
if (not user) then
return 0;
end
--compute target position from current position + teleport
direction()
local vCurPos = {};
user:GetWorldPos(vCurPos);
local vTargetDir = {}; --assign a temp vector as targetDir „type"
vTargetDir.x = self.Properties.teleportDirX;
vTargetDir.y = self.Properties.teleportDirY;
vTargetDir.z = self.Properties.teleportDirZ;
local vTargetPos = vecAdd(vCurPos, vTargetDir);
--set target position on player entity
user:SetWorldPos(vTargetPos);
end
This picture just shows the properties that are written in the .lua script above.
This is a cpp script that will be called on another .lua teleporter script. It functions essentially the same,
but it's just showing how lua can call on a .cpp function.
This block of code also checks to make sure that the pointer is NOT NULL. Without this exception handler
the game will crash.
This is a script bind function. ALL BIND FUNCTIONS HAVE:
1)Always returns a script
2)ALWAYS gets an 'IFunctionalHandler *pH'
as the first argument.
This registers all that happy fun stuff I did earlier. All these start the same as you can see.
============================================================================================================================================================================================================
Here below I have succesfully utilized the 3rd Person Camera in CryEngine. This can be done in the flowgraph, but I chose to do it in C++. The code is going to be located here: GameRules.cpp, line 829 you should see this: bool CGameRules::OnClientEnteredGame(int channelId, bool isReset)
//so then add this right below
//Gives 3rd Person View
ICVar* pTmpVar = gEnv->pConsole->GetCVar("g_tpview_control");
pTmpVar->ForceSet("1");
pTmpVar = gEnv->pConsole->GetCVar("g_tpview_enable");
pTmpVar->ForceSet("1");
pTmpVar = gEnv->pConsole->GetCVar("g_tpview_force_goc");
pTmpVar->ForceSet("0");
//=======================
I hope this compilation of obscure tutorials will help you get started as it has helped me. I tried to put all the 'work arounds' to getting the code up and running in one easy place.
Terrain Editing
My first mountain range while learning how to use the
terrain editor in CryEngine3
I learned how to add my own textures. Found the
sand texture online and edited the colors a bit before
importing
Valley I made when I started getting decent with the
terrain editor. Designed it for close range viewing
Here it is. Butt Crack Valley.
The best house ever made. It's ok to be jealous.
Testing the 'solid' tool
Placing objects in Ass Crack Valley
Just more screenies.
I liked this view. You do too
Subscribe to:
Comments (Atom)






