Car and AI problem

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

Hello everyone,
I have just started to make a GTA like game. I am facing a problem: The car body doesn't get aligned with the wheels. Thats when I am approaching a highway the body doesn't rotate perfectly. WHat currently I am doing for body rotation is that I am taking the differrence of the y positions of the spheres and difference of the Z positions, then taking Atan of :

Matrix.CreateRotationX(MathHelper.ToRadians((float)Math.Atan(yDiff / zDiff))); 

 Where yDiff and xDiff are calculated as:

car_punto.yDiff = sphereLeftFront[0].Bounds.Center.Y - sphereLeftFront[1].Bounds.Center.Y;  
car_punto.zDiff = sphereLeftFront[0].Bounds.Center.Z - sphereLeftFront[1].Bounds.Center.Z; 

where sphereLeftFront[0] is the ColliderSphere of the left front wheel and sphereLeftFront[1] is the ColliderSphere of the left rear wheel.
however the car body doesn't rotate perfectly as shown :

6ebc4_carbodyproblem Car and AI problem

What am I doing wrong? Please help.

AI QUES.:

I have just started my work on AI ie how other cars will run on the road. I have set coordinates in an array and for individual car I am checking on which coordinate it has reached keeping a range of about 5 px. For eg. when the other cars reaches a specific coordinate then it will check in the array what to do next. For eg: -1 to turn left and 1 to turn Right 0 to go straight, etc. However I am facing some problems thats sometimes the other cars work well while sometimes they go away straight or continue to revolve on the same place. Is there any other way to implement such kind of stuff???

ALPHA TEXTURE PROBLEM:
Also could anyone please provide some good tutorials about drawing objects with alpha mapped textures like the one used in making trees, railings? The modelling program I am using is 3ds MAX for making trees and assigning textures to them.
Thanks.

Rotating a collision rectangle (racing game)

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

Hi, I've looked all over for rotating collision rectangles but I couldn't find anything I could fully understand because the way I am doing collision is different to what i have seen.

How I have made the game is I have rows of tyres that I simply placed
on top of the background and made them each a collision rectangle.

Here's an image of the track and highlighted in red are the collision rectangles.

54505_Untitled-2 Rotating a collision rectangle (racing game)

Below is another image but shows how I think the collision rectangle for the car is reacting to the rotation of the car.

0cae9_Untitled-3 Rotating a collision rectangle (racing game)

I am just clueless at the moment on how I could rotate the collision rectangle alongside the car.

This is the code I have used to set the rectangles and how I move the car.

protected override void Update(GameTime gameTime)
        {

            //setting rectangles for collision detection
            blueCarRect = new Rectangle((int)blueCarPosition.X - 29, (int)blueCarPosition.Y -61,
                blueCar.Width,
                blueCar.Height);

            v43Rect = new Rectangle((int)v43Position.X, (int)v43Position.Y,
                v43Texture.Width,
                v43Texture.Height);
            v43_2Rect = new Rectangle((int)v43_2Position.X, (int)v43_2Position.Y,
                v43_2Texture.Width,
                v43_2Texture.Height);
            v35Rect = new Rectangle((int)v35Position.X, (int)v35Position.Y,
                v35Texture.Width,
                v35Texture.Height);
            v19Rect = new Rectangle((int)v19Position.X, (int)v19Position.Y,
                v19Texture.Width,
                v19Texture.Height);
            v16Rect = new Rectangle((int)v16Position.X, (int)v16Position.Y,
                v16Texture.Width,
                v16Texture.Height);
            h22Rect = new Rectangle((int)h22Position.X, (int)h22Position.Y,
                h22Texture.Width,
                h22Texture.Height);
            h22_2Rect = new Rectangle((int)h22_2Position.X, (int)h22_2Position.Y,
                h22_2Texture.Width,
                h22_2Texture.Height);
            h11Rect = new Rectangle((int)h11Position.X, (int)h11Position.Y,
                h11Texture.Width,
                h11Texture.Height);
            h11_2Rect = new Rectangle((int)h11_2Position.X, (int)h11_2Position.Y,
                h11_2Texture.Width,
                h11_2Texture.Height);
            h11_3Rect = new Rectangle((int)h11_3Position.X, (int)h11_3Position.Y,
                h11_3Texture.Width,
                h11_3Texture.Height);
            h10Rect = new Rectangle((int)h10Position.X, (int)h10Position.Y,
                h10Texture.Width,
                h10Texture.Height);

            KeyboardState keys = Keyboard.GetState(); // This is making the variable "keys" which purpose will be to get the state of the keyboard inputs 60 times a second.

            //if the up arrow key is pressed and it collides with a tyre barrier then the car speed is reduced to 0.1
            if (keys.IsKeyDown(Keys.Up) && (blueCarRect.Intersects(v43Rect) || (blueCarRect.Intersects(v43_2Rect) ||
               (blueCarRect.Intersects(v35Rect) || (blueCarRect.Intersects(v19Rect) ||
               (blueCarRect.Intersects(v16Rect) || (blueCarRect.Intersects(h22Rect) ||
               (blueCarRect.Intersects(h22_2Rect) || (blueCarRect.Intersects(h11Rect) ||
               (blueCarRect.Intersects(h11_2Rect) || (blueCarRect.Intersects(h11_3Rect) ||
               (blueCarRect.Intersects(h10Rect)))))))))))))
            {
                blueCarSpeed = 0.1f;
            }

            //when no collisions are active while the up arrow is pressed then the car will move at 5
            else if (keys.IsKeyDown(Keys.Up) )
            {
                blueCarSpeed = 5f;
            }

            //if the down arrow key is pressed and it collides with a tyre barrier then the car speed is reduced to -0.1
            if (keys.IsKeyDown(Keys.Down) && (blueCarRect.Intersects(v43Rect) || (blueCarRect.Intersects(v43_2Rect) ||
               (blueCarRect.Intersects(v35Rect) || (blueCarRect.Intersects(v19Rect) ||
               (blueCarRect.Intersects(v16Rect) || (blueCarRect.Intersects(h22Rect) ||
               (blueCarRect.Intersects(h22_2Rect) || (blueCarRect.Intersects(h11Rect) ||
               (blueCarRect.Intersects(h11_2Rect) || (blueCarRect.Intersects(h11_3Rect) ||
               (blueCarRect.Intersects(h10Rect)))))))))))))
            {
                blueCarSpeed = -0.1f;
            }
            //when no collisions are active while the down arrow key is pressed then the car will move at -5
            else if (keys.IsKeyDown(Keys.Down))
            {
                blueCarSpeed = -5f;
            }
            //when the left arrow is pressed then rotate the car anti-clockwise by 5 radians
            if (keys.IsKeyDown(Keys.Left))
            {
                blueCarRotation -= MathHelper.ToRadians(5f);
            }
            //when the right arrow is pressed then rotate the car clockwise by 5 radians
            else if (keys.IsKeyDown(Keys.Right))
            {
                blueCarRotation += MathHelper.ToRadians(5f);

            }
            //mathmatical calculations telling the car which direction to move depending on speed and rotation
            blueCarPosition.X += (float)Math.Sin(blueCarRotation) * blueCarSpeed;
            blueCarPosition.Y += (float)Math.Cos(blueCarRotation) * -blueCarSpeed;
            blueCarSpeed = 0f;

Any help would be appreciated.

Thank you.

Collisions

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

Hello eveyone,

I am having some problems on my project about collisions. I have some aparments in my game and my shipmodel now. I want to add some collisions for my model and for buildings. If I go out from my city or try to go through the buildings, I would like to re-start my ship from the beginning.

Any help would be appreciated.
Many Thanks.

I have tried to use something similar to this for prevent the ship going out from the city but it's not working either.

 private void SetUpBoundingBoxes()
 {
     int cityWidth = floorPlan.GetLength(0);
     int cityLength = floorPlan.GetLength(1);        
 

    List<BoundingBox>
bbList = new List<BoundingBox>
();    for (int x = 0; x < cityWidth; x++)
    {
        for (int z = 0; z < cityLength; z++)
        {
            int buildingType = floorPlan[x, z];
            if (buildingType != 0)
            {
                int buildingHeight = buildingHeights[buildingType];
                Vector3[] buildingPoints = new Vector3[2];
                buildingPoints[0] = new Vector3(x, 0, -z);
                buildingPoints[1] = new Vector3(x + 1, buildingHeight, -z - 1);
                BoundingBox buildingBox = BoundingBox.CreateFromPoints(buildingPoints);
                bbList.Add(buildingBox);
            }
        }
    }            
    buildingBoundingBoxes= bbList.ToArray();
}

Help with Pong

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

 I have a quick question say for something like pong if have a class paddle

    class Paddle 
    { 
        ContentManager mContentManager; 
 
       public Texture2D texture; 
 
       public static Vector2 PaddlePosition; 
 
       public Vector2 Center; 
 
       public Rectangle Rectangle; 
 
       public float Speed; 
 
        
 
 
       public void LoadContent(ContentManager theContentManager) 
       { 
           mContentManager = theContentManager; 
 
           texture = theContentManager.Load<Texture2D>("paddle"); 
            
           PaddlePosition = new Vector2(300, 300); 
 
           Center = new Vector2(texture.Width / 2, texture.Height / 2); 
 
           Rectangle = new Rectangle((int)PaddlePosition.X, (int)PaddlePosition.Y, texture.Width, texture.Height); 
 
           Speed = 5.0f; 
       } 
 
       public void Update(GameTime gameTime) 
       { 
           GamePadState Pad1 = GamePad.GetState(PlayerIndex.One); 
 
           KeyboardState KeyBoard1 = Keyboard.GetState(); 
 
            
 
           if (KeyBoard1.IsKeyDown(Keys.Left)) 
           { 
               PaddlePosition.X += Speed; 
           } 
 
           if (KeyBoard1.IsKeyDown(Keys.Right)) 
           { 
               PaddlePosition.X -= Speed; 
           } 
 
           Rectangle = new Rectangle((int)PaddlePosition.X, (int)PaddlePosition.Y, texture.Width, texture.Height); 
 
       } 
 
       public void Draw(SpriteBatch spriteBatch) 
       { 
           spriteBatch.Draw(texture, PaddlePosition, null, Color.White, 0f, Center, 1.0f, SpriteEffects.None, 0); 
       } 
 
 
    } 
 

now say i have a class for the ball now also like paddle and i want the ball when it goes off the screen to appear at the paddles position so do i make the paddle position static and say if the ball leaves the screen ballPosition = Paddle.paddleposition;

Car and AI problem

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

Hello everyone,
I have just started to make a GTA like game. I am facing a problem: The car body doesn't get aligned with the wheels. Thats when I am approaching a highway the body doesn't rotate perfectly. WHat currently I am doing for body rotation is that I am taking the differrence of the y positions of the spheres and difference of the Z positions, then taking Atan of :

Matrix.CreateRotationX(MathHelper.ToRadians((float)Math.Atan(yDiff / zDiff))); 

 Where yDiff and xDiff are calculated as:

car_punto.yDiff = sphereLeftFront[0].Bounds.Center.Y - sphereLeftFront[1].Bounds.Center.Y;  
car_punto.zDiff = sphereLeftFront[0].Bounds.Center.Z - sphereLeftFront[1].Bounds.Center.Z; 

where sphereLeftFront[0] is the ColliderSphere of the left front wheel and sphereLeftFront[1] is the ColliderSphere of the left rear wheel.
however the car body doesn't rotate perfectly as shown :

c5363_carbodyproblem Car and AI problem

What am I doing wrong? Please help.

AI QUES.:

I have just started my work on AI ie how other cars will run on the road. I have set coordinates in an array and for individual car I am checking on which coordinate it has reached keeping a range of about 5 px. For eg. when the other cars reaches a specific coordinate then it will check in the array what to do next. For eg: -1 to turn left and 1 to turn Right 0 to go straight, etc. However I am facing some problems thats sometimes the other cars work well while sometimes they go away straight or continue to revolve on the same place. Is there any other way to implement such kind of stuff???

ALPHA TEXTURE PROBLEM:
Also could anyone please provide some good tutorials about drawing objects with alpha mapped textures like the one used in making trees, railings? The modelling program I am using is 3ds MAX for making trees and assigning textures to them.
Thanks.

CodePlex Daily Summary for Wednesday, December 30, 2009

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

CodePlex Daily Summary for Wednesday, December 30, 2009

New Projects

  • Amazon AWS .Net Tools: A collection of tools that allow .net programmers to integrate with amazons services.
  • Artisan: Tired "wall-of-xml" build script development that Nant and Msbuild impose. Building my own…
  • BizArk: A collection of utilities and sample code built in C#. This includes a command-line parser, data type conversions, web helper, string templates, an…
  • C4F - Federated search provider definition generator: Creates search provider definitions (OSDX format) for Windows 7 federated search. (MSDN Coding 4 Fun).
  • DecoratorSharp: DecoratorSharp is a Decorator from python.
  • Discussion column for MOSS 2007: Discussion column for MOSS 2007/ (WSS 3.0) is a field column for different type lists such as Custom List, Document Library, Issue Tracking, not on…
  • Greek MP3 Mass Rename Tool: This tool solves the problem of sharing Greek mp3 files with devices that only support ASCII characters in ID3 tags and filenames (ie a car stereo…
  • inSight: in sight
  • Inumedia SDK: Inumedia SDK is an entire solution containing most if not all of my up to date projects. Consists of libraries containing common tools that I use …
  • Joomla install.xml Generator: Joomla install.xml Generator for Joomla developers. Automatize creation of installation XML file by crawling extension directory and getting subdir…
  • MDC Software: MDC Software Made in vb.net 2008 on windows 7 offers free software to the world with some open source products . browser hack visual basic vista fa…
  • PDF Merger for PHP: PDF Merger for PHP makes it incredibly easy to merge multiple PDFs together in your PHP web application. After merging you can either output to the…
  • PDF Search Engine: Open Source PDF Search Engine
  • Soluciones: El project contiene herramientas de marketing para todo tipo de tama~o de empresas. Estaba basada en el standard definido por el mercado mismo. E…
  • Soluciones Integrales: El projecto ve la necesidad de poder dar soporte al area de Marketing La finalidad de este proyecto es la implementacion de herramientas de market…
  • testiproject: testing only
  • TFS Global List Compare: The TFS Global List Compare Tool compares two local global list files and highlights differences. In pink color for different nodes, and in green …
  • Up or Down (Azure Sample): "Up or Down" is a simple service monitor and dashboard application that demonstrates use of Azure web and worker roles using Azure table storage.
  • VESI/PowerGUI VMware Community PowerPack: A Community provided PowerPack for use with VESI and PowerGUI, a collection of multiple scripts to enable the ultimate in VMware management using P…
  • Virtual File System (VFS): Abstracts arbitrary hierarchical resources as a virtual file system, and provides access via a simple yet extensible and powerful API. VFS' off…
  • WavePoint: Some Tools For SharePoint
  • WS-Man.NET: WS-Man.NET is an open-source written in pure managed code WS-Management protocol implementation. It contains both server and client code. WS-Man.NE…

New Releases

Most Popular Projects

Most Active Projects

CodePlex Daily Summary for Tuesday, December 29, 2009

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

CodePlex Daily Summary for Tuesday, December 29, 2009

New Projects

  • 51money11: 51money11
  • ASP.NET Autenticación por Formulario: Proyecto de ejemplo de autenticación vía Formulario para una determinada sección de una aplicación Web, como puede ser la sección de administración
  • ASP.NET Web Forms Model-View-Presenter (MVP) Contrib: A series of community made extensions for the ASP.NET Web Forms Model-View-Presenter framework.
  • bizagefwk: this is the fwk used to write s4 system
  • Event Comb CSV: Event Comb CSV is a console utility to gather event logs for a daily email. This helps support staff to become more aware of and proactive in reso…
  • FloodWarn: A series of server and client apps for monitoring flood levels on the Snoqualmie River in King County, Washington.
  • Fluent.NET: The Fluent.NET library introduces extension methods to make .NET code easier to read and more fluid to write.
  • FrogBlogger: FrogBlogger is a simple blogging engine built on top of ASP.NET MVC in .NET 4.0. Current code status is in the alpha stage. Please use at your own …
  • Mangos Vendors: This is a vendor NPC project for Mangos core based databases.
  • ModularCMS: ModularCMS is a modules based Content Management System running on PHP5 and PostgreSQL. Users are offered and easy and quick way to create and mana…
  • Plugwise Library: This is a library that enables users of the Plugwise energy saving system to communicate directly with the plugwise devices without using the Sourc…
  • Probability Not: How often does an expected background fluctuate up to some number of events? Silverlight 3 program that graphically calculates this (gaussian backg…
  • SAM[P]CE: SAM[P]CE (San Andreas Multiplayer PAWN Code Editor) is a code editor created for San Andreas Multiplayer.
  • Silverlight Console: Silverlight Console provides a Console Window Control and an extensible Executable Commands (Script-Action) Framework for use in a Silverlight Appl…
  • SilverSearch: SilverSearch is a simple tool for make easier searches on Internet. Just by a click, you can change the website where you want to search. Make with…
  • SilverSwitch Tooltip: SilverSwitch is an help to make slide show in Silverlight, very quickly and easily. You can use Pictures, photos, text and titles. Developed in C#…
  • StarRun Project: StarRun is a Habbo Hotel V26 to R42+ Emulator. You can create your own Habbo and play it with your friends
  • Swiss Tools: This is an umbrella project for some components and libraries I wrote in C#. Some I've already used for years in Borland Delphi but did not find …
  • Symbonix Starter Kit: Symbonix Starter Kit Project for Asp.net 3.5. The project helps to initially setup a web project quickly.
  • Windows Services Dependency Viewer: Windows Services Dependency Viewer is a simple tool that provides the following information: * Windows service dependent and antecedent services *…

New Releases

Most Popular Projects

Most Active Projects

CodePlex Daily Summary for Monday, December 28, 2009

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

CodePlex Daily Summary for Monday, December 28, 2009

New Projects

  • Authorize.Net C# API: C# API for doing basic transactions with Authorize.Net.
  • b2bCommerce: E-Commerce project for B2B solutions
  • ByDan Codesmith Java Templates: templates para generacion java en codesmith
  • ByDan Codesmith Php Templates: permite realizar codigo php
  • Chala Gauge 1.0: Control desarrollado en Silverlight , utilizable en ASP.NET , SharePoint y PHP que sirve de indicador de medición, como dice su nombre un GAUGE
  • Cultiv MediaCache for Umbraco: Provides a caching mechanism for the Umbraco Media Library.
  • frontdoor - http request interpolator / interpolater: frontdoor is used to transmit http requests to other machines in intranet / internet according to configuration. one outgoing internet access can s…
  • Fusion Charts for SharePoint: Fusion Charts for SharePoint (FCS) provides a set of 22 different charts (2D & 3D) that integrates easily into your SharePoint environment (WSS 3.0…
  • Image Update Builder: Builds Image Update packages for custom roms for Windows Mobile 6.5 and Windows Mobile 6.5.x
  • MineSweeperChallenge: C# programming exercise. Simulates a given number of minesweeper games using a given ISweeper implementation. Create your own implementation and se…
  • mPayroll: attempt to build a payroll online
  • ProteusBasic: ProteusBasic can generate code in c# based in the database structure and configurations. create a fully functional basic application in a few of mi…
  • QReal: CASE-system
  • SharpBoard.NET: SharpBoard.NET is an educational and school-oriented application that implement a WhiteBoard using a Wiimote, an IRPen and a PC. It's an OpenSource…
  • SharpKit for ASP.NET Ajax: A C# library that enables developers to write C# instead of JavaScript in ASP.NET Ajax projects.
  • SmartProject: SmartProject is a web-based project management software. We will be including several features and enhacements over the next several months. Please…
  • storoom - a simple distributing storage: storoom is a simple distributing storage system, it uses key-value pair to store data. contains client/clientlib stornode, node to store data to ph…
  • wiivre: A VR environment based on Bing maps and Wiimote Library.

New Releases

Most Popular Projects

Most Active Projects

CodePlex Daily Summary for Sunday, December 27, 2009

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

CodePlex Daily Summary for Sunday, December 27, 2009

New Projects

New Releases

Most Popular Projects

Most Active Projects

CodePlex Daily Summary for Saturday, December 26, 2009

December 31, 2009 by admin · Comment
Filed under: Xbox360 News 

CodePlex Daily Summary for Saturday, December 26, 2009

New Projects

  • Analysis of Pressed Keys: APK is a tool to help developers to find out how the end users are using the software.
  • AVIcode Holidays: SharePoint layout-based application for presenting list of Holidays for the international offices of world-wide company.
  • BlogEngine.NET for Windows Azure: Azure Blog Engine.NET is an Windows Azure conversion of BlogEngine.NET. We are compromissed to do small changes to original source code just for …
  • CODE-coretc1: name code : code_coretc1
  • Google Maps v3 Script# Library: Script# library for Google Maps v3 JavaScript API
  • KLP Project: Kim Loc Phat
  • Learning Graphics using Opengl: i want to record and track the version of my code during my study of opengl. if others are also interested, the code maybe helpful for their learni…
  • OneCMS: OneCMS is a content management system that allows you to easily manage content, games, etc with such features as its own forum software, custom fie…
  • Pomodoro Sharp: A timer to apply Pomodoro Techinique: http://www.pomodorotechnique.com/
  • Removable Media Content Manager: This application enables the user to insert the removable media once & run this application to get the details of the files & folders available in …
  • ShareVision: ShareVision is a customized WSS3 set of sites and services that support social services organizations. The code here represents some of the customi…
  • The Doughnut List: Doughnut List to coordinate and notify participating employees to their Doughnut Day duties.
  • TS3QueryLib.Net: This library allows to query team speak 3 servers using the query port. All queries are implemented type safe and the library is written to work wi…
  • YAB - Yet Another Blog(Engine): Couple of goals here: - A BLOG Engine + some related stuff - A exercise on programming

New Releases

Most Popular Projects

Most Active Projects

Next Page »