Welcome Guest ( Log In | Register )

13 Pages « < 9 10 11 12 13 >Bottom

Outline · [ Standard ] · Linear+

 Game Design & Programming 101, cout << "Updated 11th February" << endl;

views
     
frags
post Jul 1 2010, 01:47 PM

The Wizard
Group Icon
VIP
1,640 posts

Joined: Oct 2006


QUOTE(plankton @ Jul 1 2010, 11:40 AM)
great info.

frags, applied for the group, will most probably be on the sideline for now until I get a bit familiar with Unity3d.
*
Good. Not a problem.


Added on July 1, 2010, 3:15 pmExample of a simple game logic. You can use this if you want. I haven't uploaded the game because I think it's not great at all. Still has some bugs. But anyway this is a pretty good basic code to learn Unity3D with. No player movement but some pretty important code stuff in it(such as Raycast). Ask here if you do not understand any bit.:
» Click to show Spoiler - click again to hide... «



Added on July 2, 2010, 6:04 pmWant to learn how video game AI/ player characters see the world?

QUOTE
I'd like to take some time out here to write about Raycasting. Might be helpful to those new to game development. If you ever wondered how your game characters will see or look at things in your game environment/level, or how users can select elements in your game world(like in an RTS, selecting units etc), Raycast is the main method of doing this.

Basically Raycast is a method of drawing a virtual line from one point to another point of the game world. Whatever intersects this line is registered as a hit. Think of the different applications for this. Mouse selection, AI 'seeing' the player character or the level objects, even simulating a weapon firing(such as a sniper rifle) and hitting enemies. This is a very basic game development concept.

In unity, thankfully you already have a raycast function available to you to do all these things. There are a lot of things you can do with raycasts but I'll stick to the basic. Here is the basic workflow of the logic behind using raycast:

QUOTE
DEFINE variable hitObject TYPE RaycastHit
IF left mouse button down THEN
  IF Raycast is true THEN
      Do whatever you want with hitObject.collider.GameObject
  END IF
END IF


RaycastHit is a necessary variable that gets what the raycast hits(well like it says really). Using RaycastHit, you can access the gameobject and manipulate its details(it has to have a collider btw)

Details on Raycast:
http://unity3d.com/support/documentation/S...cs.Raycast.html

Here is an example bit that is attached to a First Person Controller:

CODE
var hit : RaycastHit;

if (Physics.Raycast (transform.position, transform.forward, hit, 5)){

  if (hit.collider.gameObject.tag == "outpostDoor" && doorIsOpen == false && BatteryCollect.charge >= 4){
     currentDoor = hit.collider.gameObject;
     Door(doorOpenSound, true, "dooropen", currentDoor);
GameObject.Find("BatteryGUI").GetComponent(GUITexture).enabled = false;
}

  else if (hit.collider.gameObject.tag == "outpostDoor" && doorIsOpen == false && BatteryCollect.charge < 4){
GameObject.Find ("BatteryGUI").GetComponent(GUITexture).enabled = true;
TextHints.message = "The door seems to need more power..";
TextHints.textOn = true;
}
}



Okay it might be a little hard to read that but you get the idea. The transform.Position that you are passing into Physics.Raycast is the position of the player character, and transform.forward is the direction the raycast will be projected, hit is the RaycastHit variable, and 5 is the length of the raycast(you can make your AI see further etc using this).

This particular example also checks some other conditions that is relevant to that example game. Using hit.collider.gameObject.tag == "blablabla" you can check if the raycast hit a particular object. Just make sure you give that object a proper tag name.

Here is another example that creates a Raycast from the main camera towards the mouse pointer direction:

CODE
var hitt : RaycastHit;

if( Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition),  hitt, 500 ) ) {

  if (hitt.rigidbody) {
Debug.Log(hitt.rigidbody.gameObject);

hitt.rigidbody.gameObject.transform.position.x + 1;
hitObject = hitt.rigidbody.gameObject;
       hitObject.renderer.material.color.r = 0.1 * Time.deltaTime;
}




You can use this line:
mainCamera.ScreenPointToRay(Input.mousePosition)

http://unity3d.com/support/documentation/S...PointToRay.html

To make raycasts that function as mouse selections/mouse overs etc. camera.ScreenPointToRay basically sends position(based on the camera position) and direction(towards the mouse cursor location) to physics.raycast. Handy if you are making a strategy game or a game that requires users to select stuff. You don't need to use this for users selecting GUI stuff as for that you can use function onMouseDown

http://unity3d.com/support/documentation/S...nMouseDown.html

Anyway below, I have included an excerpt from Will Goldstones, Unity Game Development Essentials Book on the topic of using Raycast for a shooter(and why use them):

QUOTE
The frame miss
In the example of a gun in a 3D shooter game, ray casting is used to predict the impact of a gunshot when a gun is fired. Because of the speed of an actual bullet,simulating the flight path of a bullet heading toward a target is very difficult to visually represent in a way that would satisfy and make sense to the player. This is down to the frame-based nature of the way in which games are rendered.

If you consider that when a real gun is fired, it takes a tiny amount of time to reach its target—and as far as an observer is concerned it could be said to happen instantly—we can assume that even when rendering over 25 frames of our game per second, the bullet would need to have reached its target within only a few frames.

In the example above, a bullet is fired from a gun. In order to make the bullet realistic, it will have to move at a speed of 500 feet per second. If the frame rate is 25 frames per second, then the bullet moves at 20 feet per frame. The problem with this is a person is about 2 feet in diameter, which means that the bullet will very
likely miss the enemies shown at 5 and 25 feet away that would be hit. This is where prediction comes into play.

Predictive collision detection
Instead of checking for a collision with an actual bullet object, we find out whether a fired bullet will hit its target. By casting a ray forward from the gun object (thus using its forward direction) on the same frame that the player presses the fire button,we can immediately check which objects intersect the ray.

We can do this because rays are drawn immediately. Think of them like a laser pointer—when you switch on the laser, we do not see the light moving forward because it travels at the speed of light—to us it simply appears.

Rays work in the same way, so that whenever the player in a ray-based shooting game presses fire, they draw a ray in the direction that they are aiming. With this ray,they can retrieve information on the collider that is hit. Moreover, by identifying the collider, the game object itself can be addressed and scripted to behave accordingly.

Even detailed information, such as the point of impact, can be returned and used to affect the resultant reaction, for example, causing the enemy to recoil in a particular direction.

In our shooting game example, we would likely invoke scripting to kill or physically repel the enemy whose collider the ray hits, and as a result of the immediacy of rays, we can do this on the frame after the ray collides with, or intersects the enemy collider. This gives the effect of a real gunshot because the reaction is registered immediately.

It is also worth noting that shooting games often use the otherwise invisible rays to render brief visible lines to help with aim and give the player visual feedback, but do not confuse these lines with ray casts because the rays are simply used as a path for line rendering.


Noticed in Company of Heroes how your tanks shells auto lock on the enemy once fired. Well not sure how many people here play CoH but now you know why. If you have any uncertainties, please ask away. Hope this helps someone.


Join the mailing list for more such info.

This post has been edited by frags: Jul 2 2010, 06:04 PM
frags
post Jul 5 2010, 03:43 PM

The Wizard
Group Icon
VIP
1,640 posts

Joined: Oct 2006


QUOTE(kypronite @ Jul 5 2010, 03:34 PM)
hey frags ,dont want sound so picky but just want to comment ...

the yahoo group 'mailing list' style thread really an eye sore and the navigation also very confusing.

hopefully no offence ya sweat.gif
*
Well there is no navigation. It just displays the latest posts on the main page. I've been using it in another group and it's not too bad. For the basic purpose of communication and sharing. Sure it's a little dated now. Maybe not the best medium for lengthy articles as the rich text editor is very basic. It does look very flat. But I think there is no point to create something more than that(for now), like a dedicated forum etc.

BTW you might be surprised how many developers actually use mailing lists tongue.gif . There is one very famous top secret one that top designers are part off. I heard Will Wright and Sid Meier of part of it. Very secretive and everything said there is private to that group and we'll never know what they talk about. It's not the reason I choose this method but just telling you this if you might not know this.


Added on July 5, 2010, 3:45 pm
QUOTE(kypronite @ Jul 5 2010, 03:34 PM)
hey frags ,dont want sound so picky but just want to comment ...

the yahoo group 'mailing list' style thread really an eye sore and the navigation also very confusing.

hopefully no offence ya sweat.gif

also about last week meeting,did you guys got meet each other at klcc?
I want to come but i got no game development experience whatsoever,so  blush.gif
*
No I didn't go since I actually read their post late and I already had plans on Saturday. I don't check my yahoo email fyi. I just have it for the mailing list.


Added on July 20, 2010, 5:42 pmSomething I found at gamasutra about Game Development in Singapore:
http://www.gamasutra.com/view/news/28815/Q...stry_Growth.php


Added on August 1, 2010, 5:42 pmThis is an awesome game design talk:

http://www.gdcvault.com/play/1012259/Train-(or-How-I-Dumped

This post has been edited by frags: Aug 1 2010, 05:42 PM
maleficus
post Mar 11 2011, 01:15 AM

New Member
*
Newbie
0 posts

Joined: Mar 2011
To all of you dreaming of creating their own game...never give up! It is an incredible amount of work, and as someone before mentioned, it is one thing to start working on a game, and whole different ball game to actually finish it...but it is worth it. I had a chance to meet some of the people from the LGM team. What they had to endure to finally see the release of their debut title, Starpoint Gemini, is beyond belief. I remember when the guys started their work, from nothing, and with nothing, and talked about the RPG tactical space combat game they will create. We all laughed at them, and recently, their title has been released on Impulse, Gamersgate, Direct2Drive, Desura and soon will be in retail via Iceberg Interactive as well. I bought the game and must say, I can't believe they actually did it! Take a look at their site ( www.starpointgemini.com), and check the materials for yourself. And they also have an interesting topics regarding the creation of the game at www.spacesimcentral.com. All things consider, they proved that a complex project like a PC game can be completed despite the overwhelming odds on today's market rclxms.gif

kubing
post Mar 24 2011, 04:07 PM

Getting Started
**
Junior Member
263 posts

Joined: Dec 2008
great topic.
sirgames
post May 1 2011, 07:41 PM

New Member
*
Newbie
0 posts

Joined: Apr 2011
QUOTE(maleficus @ Mar 11 2011, 01:15 AM)
To all of you dreaming of creating their own game...never give up! It is an incredible amount of work, and as someone before mentioned, it is one thing to start working on a game, and whole different ball game to actually finish it...but it is worth it.
*
i'm 15 and together with my friends, we wanted to make our first video game for our ICT project, and guess what, we managed to do just that in merely 1 Months time! Of course that was a hell lot of work and we only managed to create a campaign which lasted approx. 15 min or so?? haha anyways that was an extreme experience definitely worthwhile xD so to those who dream of creating your own game, go for it and never let your spirits down! Gluck! biggrin.gif biggrin.gif
johnsongoh
post Jun 9 2011, 05:10 PM

New Member
*
Junior Member
9 posts

Joined: Jun 2011


woah.. didn't know that there was so many people working on game projects here.. i think we should get together some day! biggrin.gif
2mystore
post Jul 10 2011, 01:10 AM

Getting Started
**
Junior Member
125 posts

Joined: Jun 2009


jayaone got one training centre for 3d gaming, anyone know what name already?
kernel
post Jul 10 2011, 02:43 AM

Look at all my stars!!
*******
Senior Member
2,532 posts

Joined: Jan 2003
From: Petaling Jaya


would like to volunteer some sound design/audio skills if anyone needs some smile.gif


pian88
post Dec 23 2011, 06:30 PM

New Member
*
Newbie
0 posts

Joined: Dec 2011


Hi guys.. check this out: http://www.mediafire.com/?qw30dnn96l0bd . This is my unfinished mobile game project. I just make a basic game engine for demo purpose only.
nikwing
post Feb 12 2012, 01:14 PM

New Member
*
Junior Member
48 posts

Joined: Sep 2005


Hi,

I just develop a game for nokia s40 touch & type (x3-02/ asha/ etc)

store.ovi.com/content/250822

Check it out & give me comments biggrin.gif
infrasonic
post Mar 19 2012, 12:44 AM

--
****
Senior Member
648 posts

Joined: Jun 2011


nice topic u got here..should have found this earlier. wants to develop a game since I was young but duno whr to start. btw I'm 14 this year
kailoonthedog
post Mar 19 2012, 12:48 AM

I have no super cow power~~~
*******
Senior Member
2,470 posts

Joined: Nov 2007
QUOTE(infrasonic @ Mar 19 2012, 12:44 AM)
nice topic u got here..should have found this earlier. wants to develop a game since I was young but duno whr to start. btw I'm 14 this year
*
why you wanna mention your age = = , age has nothing to do with programming anyway . Just it's typical malaysian thinking
infrasonic
post Mar 19 2012, 01:40 AM

--
****
Senior Member
648 posts

Joined: Jun 2011


QUOTE(kailoonthedog @ Mar 19 2012, 12:48 AM)
why you wanna mention your age = = , age has nothing to do with programming anyway . Just it's typical malaysian thinking
*
haha, I saw some ppl mentioned their age in their post here, so I just folo only~
Ivan113
post Aug 21 2012, 01:42 PM

Enthusiast
*****
Senior Member
925 posts

Joined: Apr 2011
everyone's dream is to work with Valve and Bethesda!! at least it's for me
MiseriGhost
post Sep 2 2012, 10:11 PM

Getting Started
**
Junior Member
238 posts

Joined: Jun 2009
developing a game for final project.. rclxub.gif rclxub.gif rclxub.gif
Xeomuz
post Sep 2 2012, 10:50 PM

Getting Started
**
Junior Member
63 posts

Joined: Sep 2010


QUOTE(MiseriGhost @ Sep 2 2012, 10:11 PM)
developing a game for final project.. rclxub.gif  rclxub.gif  rclxub.gif
*
what kind of game did you make and what engine did you use?
come on share.
I always have problem with Texture and resources. This two thing really time consuming.
Sometime feel better to play a game rather then make one.
fwznssr-e1
post Sep 13 2012, 03:56 PM

New Member
*
Newbie
0 posts

Joined: Sep 2012
QUOTE(MiseriGhost @ Sep 2 2012, 10:11 PM)
developing a game for final project.. rclxub.gif  rclxub.gif  rclxub.gif
*
Nice, do share please. Would love to hear about how you start :-)
Shah.Legno
post Oct 9 2012, 12:45 PM

Getting Started
**
Junior Member
167 posts

Joined: Oct 2008
From: Bollinger On Bollinger Bands,Kuala Lumpur


anyone here expert in using Unity 3.5.6 software?
NengBoom
post Oct 31 2012, 06:31 PM

New Member
*
Junior Member
5 posts

Joined: Mar 2012


Are there any new resources where I can search up for other than those on this thread?
godofsquirrel
post Nov 7 2012, 09:47 PM

Getting Started
**
Junior Member
191 posts

Joined: Feb 2008
QUOTE(NengBoom @ Oct 31 2012, 06:31 PM)
Are there any new resources where I can search up for other than those on this thread?
*
I'm looking for malaysian indie game programming community too..do tell me if u find one =)

13 Pages « < 9 10 11 12 13 >Top
 

Change to:
| Lo-Fi Version
0.0316sec    0.42    6 queries    GZIP Disabled
Time is now: 26th November 2025 - 12:41 PM