<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: I&#8217;ve Started Working On A New Game: GHGC	</title>
	<atom:link href="https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/</link>
	<description>We&#039;re back on a default theme because comments broke on my custom one and I don&#039;t have the energy to figure out why</description>
	<lastBuildDate>Wed, 11 Dec 2013 17:54:22 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>
		By: Nick		</title>
		<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/#comment-504454</link>

		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Wed, 11 Dec 2013 17:54:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.pentadact.com/?p=6650#comment-504454</guid>

					<description><![CDATA[I&#039;ve been working on my own prototype for a game using GameMaker. Was surprised at how quickly I dumped drag &#038; drop for code (within a couple of hours). Given it&#039;s still early stages I&#039;ve been considering using Unity.

But that second video. Bloody hell. It&#039;s given me a much greater appreciation of the importance of how GM bakes in so much stuff. That you need a dozen lines of code for the GM equivalent of mouse_x, mouse_y kinda confirms that, yeah, GM is probably the place to start with making games...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on my own prototype for a game using GameMaker. Was surprised at how quickly I dumped drag &amp; drop for code (within a couple of hours). Given it&#8217;s still early stages I&#8217;ve been considering using Unity.</p>
<p>But that second video. Bloody hell. It&#8217;s given me a much greater appreciation of the importance of how GM bakes in so much stuff. That you need a dozen lines of code for the GM equivalent of mouse_x, mouse_y kinda confirms that, yeah, GM is probably the place to start with making games&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Torsten		</title>
		<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/#comment-458055</link>

		<dc:creator><![CDATA[Torsten]]></dc:creator>
		<pubDate>Thu, 24 Oct 2013 21:36:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.pentadact.com/?p=6650#comment-458055</guid>

					<description><![CDATA[That method to find the point is pretty much the only reasonable way to do it. In this particular instance, where you only want to find the point where z=0 along the ray, you could in theory simplify it more:

ray start.z + distance * (ray end.z - ray start.z) = 0 so
distance = -ray start.z/(ray end.z-ray start.z

But that is just harder to read, not applicable to the general case and not actually faster in any measurable way. Mathematically speaking, it is exactly the same thing for the specific plane you&#039;re using.]]></description>
			<content:encoded><![CDATA[<p>That method to find the point is pretty much the only reasonable way to do it. In this particular instance, where you only want to find the point where z=0 along the ray, you could in theory simplify it more:</p>
<p>ray start.z + distance * (ray end.z &#8211; ray start.z) = 0 so<br />
distance = -ray start.z/(ray end.z-ray start.z</p>
<p>But that is just harder to read, not applicable to the general case and not actually faster in any measurable way. Mathematically speaking, it is exactly the same thing for the specific plane you&#8217;re using.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Micael		</title>
		<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/#comment-457494</link>

		<dc:creator><![CDATA[Micael]]></dc:creator>
		<pubDate>Thu, 24 Oct 2013 10:31:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.pentadact.com/?p=6650#comment-457494</guid>

					<description><![CDATA[Not sure what you have seen in what concerns tutorials, but unity has their own tutorials http://unity3d.com/learn/tutorials/modules and while they don&#039;t cover everything, they do cover a good bit of ground (including scripting), those tutorials were created by the same guy that did this http://www.unity3dstudent.com/ which is a very good source of tutorials (highly advice it to anyone starting unity), then you have others like unity cookie and 3dbuzz, which also provide several tutorials on different subjects.

Now for a few tips, that problem you encountered with the camera requiring a rigidbody can be solved by script with a single line of code, you put this in your control script [RequireComponent (typeof (Rigidbody))] wherever you add said script will automatically add a rigidbody, obviously you can replace Rigidbody for other types of components, and it will automatically add those.
Also you can disable gravity on the rigidbody component, in fact you can make it kinematic which means it won&#039;t respond to input from physics (which would make your script not work since it&#039;s adding force to move the object).

Instead of adding several point lights to every scene you can instead go to edit -&#062; render settings -&#062; and change the color of the ambient light to something more white, ambient light, this will increase the ambient light of the scene making objects more visible (or less visible), alternative you can also use a directional light which acts kind of like the sun, and illuminates everything.

Also use ctrl+p to play and stop the game, and check vertex snapping, unit snapping, and surface snapping it will probably help you build levels faster.

Now for programming tips:

Don&#039;t comment every single line of code, it&#039;s not a good programming practice, comments should only be used as a last resort, when one cannot find any other way to make the code clear just by reading said code if you have this line of code:

Vector3 positionAfterTeleport = player.transform.position + teleportDistance;

there is no need to comment it out, since the name of the variables already says what the code is doing. One exception to this rule is XML method (basically what c# calls functions) commenting.

some of the reasons why you don&#039;t want to comment every single line of code are:

If you change the code but you don&#039;t change the comment (which happens more than one might think) which may lead to mistakes.
Reduces your ability to easily read the scope of the code, since effectively each line of code ends up taking two lines, halving the amount of visible code space.
In the end increases the amount of work, decreasing your ability to quickly change code, or test new things out in said code.


The out thing, in the raycast method is a way for a method to return additional variables, in the case of the raycast, all raycasts return a bool to indicate if they hit something or not, sometimes this information is enough and as such you do not require any more info from said raycast, however when you require the information about the hit (like where did it hit, at what distance did it hit, what collider did it hit and so on).
You can OFC create your own methods with your own outs, and you can use how many per method as you want, you can check msdn http://msdn.microsoft.com/en-us/library/ee332485.aspx in fact you should always check msdn for anything that is c# related.


In your ClickToCreate script you create a plane and raycast from said plane, an alternative to what you are doing could be to just simply put a plane in the scene background and raycast directly from the camera, you would get the raydistance from the difference between the camera and the plane z axis (you can also just give it a fixed distance, but less ideal in case you change stuff around), and you could spawn it using the returned x, y coordinates plus the z coordinate of the player (assuming you want to spawn stuff on the depth of the player).

Also a way to fix the all creating objects inside other obects is to see what the raycast hit, and then decide if it should create or not create said objects.
If for example you wanted to create objects in mid air (like those platforms) you would only create said objects if the raycast didn&#039;t hit anything besides the plane/camera.
If you only wanted to create those objects when it hit other things, like say if you wanted a swing mechanic like on bionic commando, you would only create the object when it hit other objects.
This doesn&#039;t fix things like creating an object that is half inside another object, but that can easily be fixed by just simply spawning a collider checking to see if there is any collision, and then proceed accordingly.

P.S. You wouldn&#039;t need to implement your own physics system, nor should you, you can use box2d for 2d physics, and bullet for 3d physics, they are both free and open source, that being said I doubt you would need to do either of these things, since unity already has 3d physics, and the next update that should be around the corner brings 2d physics (although you can do 2d physics using 3d physics)]]></description>
			<content:encoded><![CDATA[<p>Not sure what you have seen in what concerns tutorials, but unity has their own tutorials <a href="http://unity3d.com/learn/tutorials/modules" rel="nofollow ugc">http://unity3d.com/learn/tutorials/modules</a> and while they don&#8217;t cover everything, they do cover a good bit of ground (including scripting), those tutorials were created by the same guy that did this <a href="http://www.unity3dstudent.com/" rel="nofollow ugc">http://www.unity3dstudent.com/</a> which is a very good source of tutorials (highly advice it to anyone starting unity), then you have others like unity cookie and 3dbuzz, which also provide several tutorials on different subjects.</p>
<p>Now for a few tips, that problem you encountered with the camera requiring a rigidbody can be solved by script with a single line of code, you put this in your control script [RequireComponent (typeof (Rigidbody))] wherever you add said script will automatically add a rigidbody, obviously you can replace Rigidbody for other types of components, and it will automatically add those.<br />
Also you can disable gravity on the rigidbody component, in fact you can make it kinematic which means it won&#8217;t respond to input from physics (which would make your script not work since it&#8217;s adding force to move the object).</p>
<p>Instead of adding several point lights to every scene you can instead go to edit -&gt; render settings -&gt; and change the color of the ambient light to something more white, ambient light, this will increase the ambient light of the scene making objects more visible (or less visible), alternative you can also use a directional light which acts kind of like the sun, and illuminates everything.</p>
<p>Also use ctrl+p to play and stop the game, and check vertex snapping, unit snapping, and surface snapping it will probably help you build levels faster.</p>
<p>Now for programming tips:</p>
<p>Don&#8217;t comment every single line of code, it&#8217;s not a good programming practice, comments should only be used as a last resort, when one cannot find any other way to make the code clear just by reading said code if you have this line of code:</p>
<p>Vector3 positionAfterTeleport = player.transform.position + teleportDistance;</p>
<p>there is no need to comment it out, since the name of the variables already says what the code is doing. One exception to this rule is XML method (basically what c# calls functions) commenting.</p>
<p>some of the reasons why you don&#8217;t want to comment every single line of code are:</p>
<p>If you change the code but you don&#8217;t change the comment (which happens more than one might think) which may lead to mistakes.<br />
Reduces your ability to easily read the scope of the code, since effectively each line of code ends up taking two lines, halving the amount of visible code space.<br />
In the end increases the amount of work, decreasing your ability to quickly change code, or test new things out in said code.</p>
<p>The out thing, in the raycast method is a way for a method to return additional variables, in the case of the raycast, all raycasts return a bool to indicate if they hit something or not, sometimes this information is enough and as such you do not require any more info from said raycast, however when you require the information about the hit (like where did it hit, at what distance did it hit, what collider did it hit and so on).<br />
You can OFC create your own methods with your own outs, and you can use how many per method as you want, you can check msdn <a href="http://msdn.microsoft.com/en-us/library/ee332485.aspx" rel="nofollow ugc">http://msdn.microsoft.com/en-us/library/ee332485.aspx</a> in fact you should always check msdn for anything that is c# related.</p>
<p>In your ClickToCreate script you create a plane and raycast from said plane, an alternative to what you are doing could be to just simply put a plane in the scene background and raycast directly from the camera, you would get the raydistance from the difference between the camera and the plane z axis (you can also just give it a fixed distance, but less ideal in case you change stuff around), and you could spawn it using the returned x, y coordinates plus the z coordinate of the player (assuming you want to spawn stuff on the depth of the player).</p>
<p>Also a way to fix the all creating objects inside other obects is to see what the raycast hit, and then decide if it should create or not create said objects.<br />
If for example you wanted to create objects in mid air (like those platforms) you would only create said objects if the raycast didn&#8217;t hit anything besides the plane/camera.<br />
If you only wanted to create those objects when it hit other things, like say if you wanted a swing mechanic like on bionic commando, you would only create the object when it hit other objects.<br />
This doesn&#8217;t fix things like creating an object that is half inside another object, but that can easily be fixed by just simply spawning a collider checking to see if there is any collision, and then proceed accordingly.</p>
<p>P.S. You wouldn&#8217;t need to implement your own physics system, nor should you, you can use box2d for 2d physics, and bullet for 3d physics, they are both free and open source, that being said I doubt you would need to do either of these things, since unity already has 3d physics, and the next update that should be around the corner brings 2d physics (although you can do 2d physics using 3d physics)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Diego		</title>
		<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/#comment-457258</link>

		<dc:creator><![CDATA[Diego]]></dc:creator>
		<pubDate>Thu, 24 Oct 2013 04:31:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.pentadact.com/?p=6650#comment-457258</guid>

					<description><![CDATA[You were probably told to use C# because of reasons, but I use java script and find it much easier. I still haven&#039;t found anything you can only do in C#, neither a difference in performance.]]></description>
			<content:encoded><![CDATA[<p>You were probably told to use C# because of reasons, but I use java script and find it much easier. I still haven&#8217;t found anything you can only do in C#, neither a difference in performance.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: iwantyoutothinkiamapro		</title>
		<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/#comment-456931</link>

		<dc:creator><![CDATA[iwantyoutothinkiamapro]]></dc:creator>
		<pubDate>Wed, 23 Oct 2013 21:59:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.pentadact.com/?p=6650#comment-456931</guid>

					<description><![CDATA[You may want to read the first few chapters of a C# book to learn about variable types. &#039;f&#039; after numbers specify that the number is a single precision floating point number which is faster than the default double precision and thus always used in game engines ( 2.0 creates a variable of type &#039;double&#039;, 2.0f creates a variable of type &#039;float&#039; ).

For the pointer position in world space you can use Camera.ScreenToWorldPoint with the pointer screen space position ( Input.mousePosition ) as a parameter. Note that the z position will be the z position of the camera so you will need to change it to the z position of the player ( or the z position you wants the cubes to spawn ).

http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenToWorldPoint.html
http://docs.unity3d.com/Documentation/ScriptReference/Input-mousePosition.html

If you search the script reference you can find unity functions with examples.
Unity script reference : http://docs.unity3d.com/Documentation/ScriptReference/

If the game is only 2D you may change the camera projection to be orthographic.
Unity 4.3 ( currently in beta ) will bring a lot of 2D specific tools ( 2D physics engine, sprite support ... ).

And this books covers the basic math involved in computer graphics and is quite simple. http://www.amazon.com/Math-Primer-Graphics-Development-Edition/dp/1568817231]]></description>
			<content:encoded><![CDATA[<p>You may want to read the first few chapters of a C# book to learn about variable types. &#8216;f&#8217; after numbers specify that the number is a single precision floating point number which is faster than the default double precision and thus always used in game engines ( 2.0 creates a variable of type &#8216;double&#8217;, 2.0f creates a variable of type &#8216;float&#8217; ).</p>
<p>For the pointer position in world space you can use Camera.ScreenToWorldPoint with the pointer screen space position ( Input.mousePosition ) as a parameter. Note that the z position will be the z position of the camera so you will need to change it to the z position of the player ( or the z position you wants the cubes to spawn ).</p>
<p><a href="http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenToWorldPoint.html" rel="nofollow ugc">http://docs.unity3d.com/Documentation/ScriptReference/Camera.ScreenToWorldPoint.html</a><br />
<a href="http://docs.unity3d.com/Documentation/ScriptReference/Input-mousePosition.html" rel="nofollow ugc">http://docs.unity3d.com/Documentation/ScriptReference/Input-mousePosition.html</a></p>
<p>If you search the script reference you can find unity functions with examples.<br />
Unity script reference : <a href="http://docs.unity3d.com/Documentation/ScriptReference/" rel="nofollow ugc">http://docs.unity3d.com/Documentation/ScriptReference/</a></p>
<p>If the game is only 2D you may change the camera projection to be orthographic.<br />
Unity 4.3 ( currently in beta ) will bring a lot of 2D specific tools ( 2D physics engine, sprite support &#8230; ).</p>
<p>And this books covers the basic math involved in computer graphics and is quite simple. <a href="http://www.amazon.com/Math-Primer-Graphics-Development-Edition/dp/1568817231" rel="nofollow ugc">http://www.amazon.com/Math-Primer-Graphics-Development-Edition/dp/1568817231</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ghosttie		</title>
		<link>https://www.pentadact.com/2013-10-23-ive-started-working-on-a-new-game-ghgc/#comment-456866</link>

		<dc:creator><![CDATA[ghosttie]]></dc:creator>
		<pubDate>Wed, 23 Oct 2013 20:55:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.pentadact.com/?p=6650#comment-456866</guid>

					<description><![CDATA[Yeah, anything new hurts :)]]></description>
			<content:encoded><![CDATA[<p>Yeah, anything new hurts :)</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
