Search Results

Search found 6580 results on 264 pages for 'boost foreach'.

Page 66/264 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • Resolving collisions between dynamic game objects

    - by TheBroodian
    I've been building a 2D platformer for some time now, I'm getting to the point where I am adding dynamic objects to the stage for testing. This has prompted me to consider how I would like my character and other objects to behave when they collide. A typical staple in many 2D platformer type games is that the player takes damage upon touching an enemy, and then essentially becomes able to pass through enemies during a period of invulnerability, and at the same time, enemies are able to pass through eachother freely. I personally don't want to take this approach, it feels strange to me that the player should receive arbitrary damage for harmless contact to an enemy, despite whether the enemy is attacking or not, and I would like my enemies' interactions between each other (and my player) to be a little more organic, so to speak. In my head I sort of have this idea where a game object (player, or non player) would be able to push other game objects around by manner of 'pushing' each other out of one anothers' bounding boxes if there is an intersection, and maybe correlate the repelling force to how much their bounding boxes are intersecting. The problem I'm experiencing is I have no idea what the math might look like for something like this? I'll show what work I've done so far, it sort of works, but it's jittery, and generally not quite what I would pass in a functional game: //Clears the anti-duplicate buffer collisionRecord.Clear(); //pick a thing foreach (GameObject entity in entities) { //pick another thing foreach (GameObject subject in entities) { //check to make sure both things aren't the same thing if (!ReferenceEquals(entity, subject)) { //check to see if thing2 is in semi-near proximity to thing1 if (entity.WideProximityArea.Intersects(subject.CollisionRectangle) || entity.WideProximityArea.Contains(subject.CollisionRectangle)) { //check to see if thing2 and thing1 are colliding. if (entity.CollisionRectangle.Intersects(subject.CollisionRectangle) || entity.CollisionRectangle.Contains(subject.CollisionRectangle) || subject.CollisionRectangle.Contains(entity.CollisionRectangle)) { //check if we've already resolved their collision or not. if (!collisionRecord.ContainsKey(entity.GetHashCode())) { //more duplicate resolution checking. if (!collisionRecord.ContainsKey(subject.GetHashCode())) { //if thing1 is traveling right... if (entity.Velocity.X > 0) { //if it isn't too far to the right... if (subject.CollisionRectangle.Contains(new Microsoft.Xna.Framework.Rectangle(entity.CollisionRectangle.Right, entity.CollisionRectangle.Y, 1, entity.CollisionRectangle.Height)) || subject.CollisionRectangle.Intersects(new Microsoft.Xna.Framework.Rectangle(entity.CollisionRectangle.Right, entity.CollisionRectangle.Y, 1, entity.CollisionRectangle.Height))) { //Find how deep thing1 is intersecting thing2's collision box; float offset = entity.CollisionRectangle.Right - subject.CollisionRectangle.Left; //Move both things in opposite directions half the length of the intersection, pushing thing1 to the left, and thing2 to the right. entity.Velocities.Add(new Vector2(-(((offset * 4) * (float)gameTime.ElapsedGameTime.TotalMilliseconds)), 0)); subject.Velocities.Add(new Vector2((((offset * 4) * (float)gameTime.ElapsedGameTime.TotalMilliseconds)), 0)); } } //if thing1 is traveling left... if (entity.Velocity.X < 0) { //if thing1 isn't too far left... if (entity.CollisionRectangle.Contains(new Microsoft.Xna.Framework.Rectangle(subject.CollisionRectangle.Right, subject.CollisionRectangle.Y, 1, subject.CollisionRectangle.Height)) || entity.CollisionRectangle.Intersects(new Microsoft.Xna.Framework.Rectangle(subject.CollisionRectangle.Right, subject.CollisionRectangle.Y, 1, subject.CollisionRectangle.Height))) { //Find how deep thing1 is intersecting thing2's collision box; float offset = subject.CollisionRectangle.Right - entity.CollisionRectangle.Left; //Move both things in opposite directions half the length of the intersection, pushing thing1 to the right, and thing2 to the left. entity.Velocities.Add(new Vector2((((offset * 4) * (float)gameTime.ElapsedGameTime.TotalMilliseconds)), 0)); subject.Velocities.Add(new Vector2(-(((offset * 4) * (float)gameTime.ElapsedGameTime.TotalMilliseconds)), 0)); } } //Make record that thing1 and thing2 have interacted and the collision has been solved, so that if thing2 is picked next in the foreach loop, it isn't checked against thing1 a second time before the next update. collisionRecord.Add(entity.GetHashCode(), subject.GetHashCode()); } } } } } } } } One of the biggest issues with my code aside from the jitteriness is that if one character were to land on top of another character, it very suddenly and abruptly resolves the collision, whereas I would like a more subtle and gradual resolution. Any thoughts or ideas are incredibly welcome and helpful.

    Read the article

  • Why You Need a Web Content Writer With Marketing Know-How

    SEO web content writing is the key to bringing potential customers to your website, but you can do much better if your writer has marketing experience on her side. Such a writer can utilize her expertise in writing SEO content that will not only increase your site traffic, but which will set you up as the person to deal with in your chosen niche. This will boost your presence online, and help convert traffic into customers.

    Read the article

  • Trending Buffer Pool Performance Using DMV sys.dm_os_performance_counters

    I'd seen you posted a tip on capturing SQL based PerfMon counters using sys.dm_os_performance_counters. What queries can I run against those stored results that would allow me to examine memory usage on my SQL instance? Join SQL Backup’s 35,000+ customers to compress and strengthen your backups "SQL Backup will be a REAL boost to any DBA lucky enough to use it." Jonathan Allen. Download a free trial now.

    Read the article

  • How to Become a SEO Expert Within a Short Time

    Do you want to become a SEO expert? If you are a small business owner, you will like to know more about the SEO techniques to give that additional boost to your business. There are some great resources which will help you to become a SEO expert.

    Read the article

  • High Value DoFollow Backlinks and Their Importance to Your Site Rankings

    For a website to be popular, it needs to be ranked rather high in the search engines. There are multitudes of ways this can be achieved. Among the most popular would be the amassing of backlinks to boost the site's popularity. Of course, not all backlinks have the same value and those procuring links for their site may wish to look towards dofollow backlinks as the prime links to acquire.

    Read the article

  • Advanced SEO Services

    If you really want to give your website a significant boost on search engine rankings then you will have to opt for advanced SEO services. In general these services are available after the preliminary optimization efforts have been conducted on your website.

    Read the article

  • Search Engine Optimization - The Five Factors Search Engines Use to Rank Websites

    At the end of the day, SEO requires a lot of extremely specialized knowledge, time, and attention - on an ongoing basis. But because a SEO effort can give a website's rankings a dramatic boost in the search results - and there is a significant connection between search engine ranking and search referral traffic - it is well worth doing whatever it takes to develop the knowledge and to be able to invest the time and attention.

    Read the article

  • How SEO Services Work to Improve Your Online Popularity

    There are assorted SEO Services available to help boost your online popularity. You might not know it but all these Internet Marketing strategies work together to make sure you appear on search engines, increase your rankings to outdo your competition, and of course, make a name for yourself on the Web.

    Read the article

  • Backlink Your Way to the Top of Google by Tapping Into Seven Easy Sources of Backlinks

    Because backlinks boost a web page's level of authority - and authority is a key search engine ranking factor - it is absolutely essential that any web page you are trying to promote has a lot of high-quality backlinks pointing to it in order to achieve high search engine rankings. While the best backlinks are those that are earned on the strength of great content, great content will not be seen unless the web page it occupies is highly visible in the search results.

    Read the article

  • Search Engine Optimization - The Five Factors Search Engines Use to Rank Websites

    At the end of the day, SEO requires a lot of extremely specialized knowledge, time, and attention - on an ongoing basis. But because a SEO effort can give a website's rankings a dramatic boost in the search results - and there is a significant connection between search engine ranking and search referral traffic - it is well worth doing whatever it takes to develop the knowledge and to be able to invest the time and attention.

    Read the article

  • XNA - 3D AABB collision detection and response

    - by fastinvsqrt
    I've been fiddling around with 3D AABB collision in my voxel engine for the last couple of days, and every method I've come up with thus far has been almost correct, but each one never quite worked exactly the way I hoped it would. Currently what I do is get two bounding boxes for my entity, one modified by the X translation component and the other by the Z component, and check if each collides with any of the surrounding chunks (chunks have their own octrees that are populated only with blocks that support collision). If there is a collision, then I cast out rays into that chunk to get the shortest collision distance, and set the translation component to that distance if the component is greater than the distance. The problem is that sometimes collisions aren't even registered. Here's a video on YouTube that I created showing what I mean. I suspect the problem may be with the rays that I cast to get the collision distance not being where I think they are, but I'm not entirely sure what would be wrong with them if they are indeed the problem. Here is my code for collision detection and response in the X direction (the Z direction is basically the same): // create the XZ offset vector Vector3 offsXZ = new Vector3( ( _translation.X > 0.0f ) ? SizeX / 2.0f : ( _translation.X < 0.0f ) ? -SizeX / 2.0f : 0.0f, 0.0f, ( _translation.Z > 0.0f ) ? SizeZ / 2.0f : ( _translation.Z < 0.0f ) ? -SizeZ / 2.0f : 0.0f ); // X physics BoundingBox boxx = GetBounds( _translation.X, 0.0f, 0.0f ); if ( _translation.X > 0.0f ) { foreach ( Chunk chunk in surrounding ) { if ( chunk.Collides( boxx ) ) { float dist = GetShortestCollisionDistance( chunk, Vector3.Right, offsXZ ) - 0.0001f; if ( dist < _translation.X ) { _translation.X = dist; } } } } else if ( _translation.X < 0.0f ) { foreach ( Chunk chunk in surrounding ) { if ( chunk.Collides( boxx ) ) { float dist = GetShortestCollisionDistance( chunk, Vector3.Left, offsXZ ) - 0.0001f; if ( dist < -_translation.X ) { _translation.X = -dist; } } } } And here is my implementation for GetShortestCollisionDistance: private float GetShortestCollisionDistance( Chunk chunk, Vector3 rayDir, Vector3 offs ) { int startY = (int)( -SizeY / 2.0f ); int endY = (int)( SizeY / 2.0f ); int incY = (int)Cube.Size; float dist = Chunk.Size; for ( int y = startY; y <= endY; y += incY ) { // Position is the center of the entity's bounding box Ray ray = new Ray( new Vector3( Position.X + offs.X, Position.Y + offs.Y + y, Position.Z + offs.Z ), rayDir ); // Chunk.GetIntersections(Ray) returns Dictionary<Block, float?> foreach ( var pair in chunk.GetIntersections( ray ) ) { if ( pair.Value.HasValue && pair.Value.Value < dist ) { dist = pair.Value.Value; } } } return dist; } I realize some of this code can be consolidated to help with speed, but my main concern right now is to get this bit of physics programming to actually work.

    Read the article

  • Monitor SQL Server Agent Jobs with Policy Based Management

    I need to monitor all the SQL Agents to find out if a job failed in the last 24 hours. Could this be done with policy based management? If so, can you show me how to create the policy? Join SQL Backup’s 35,000+ customers to compress and strengthen your backups "SQL Backup will be a REAL boost to any DBA lucky enough to use it." Jonathan Allen. Download a free trial now.

    Read the article

  • Lenovo W530 microphone problem

    - by user214245
    Lenovo W530 running Xubuntu 13.10 The microphone appears not to be working. 2 tests made one with audacity and a second with skype. In both instances there appears to be no input. 'Input devices' in the volume control module, also 'recording' indicates background static only. I have opened alsamixer and ensured that everything including microphone boost is set to high. I have tried the changes to alsa-base.conf without success.

    Read the article

  • Three Main Differences Between SEO and PPC

    Today, many webmasters that want to boost traffic to their website mistakenly believe that SEO (search engine optimization) and PPC (pay per click) campaigns are the same thing. While both traffic driving methods have a common set of goals, they tend to have very different long term effects. This is just one of many reasons why you need to make use of both tools in order to expand your web presence as much as possible.

    Read the article

  • Configuring Database Mirroring

    This article contains a set of instructions for configuring SQL Server mirroring, including pre-requisites. It also includes notes on how to resolve a few issues that I have encountered. Join SQL Backup’s 35,000+ customers to compress and strengthen your backups "SQL Backup will be a REAL boost to any DBA lucky enough to use it." Jonathan Allen. Download a free trial now.

    Read the article

  • Link Building For Your Online Business

    Link Building plays a major role in the success of business online. To get quality back links for your website and boost your search engine rankings, legitimate techniques should be adopted. Otherwise, there may be chances that your website is banned by search engines and it is very difficult to get itself restored.

    Read the article

  • Getting Started with Data Bars in SQL Server 2008 R2 Reporting Services

    I'm looking at several new visualization features in SQL Server 2008 R2 Reporting Services and the data bar looks like something that I could really use. Can you provide an example of how to use this in a report? Join SQL Backup’s 35,000+ customers to compress and strengthen your backups "SQL Backup will be a REAL boost to any DBA lucky enough to use it." Jonathan Allen. Download a free trial now.

    Read the article

  • What is the Need of Website Development?

    In the corporate world, the danger of not having a strong web presence cannot be imagined by the businesses. Every business needs to be up to date, to be successful and boost up their business; it needs to have a place in the World Wide Web.

    Read the article

  • Popularizing SEO Through Link Building

    The most important thing for a starting SEO site is by creating an authoritative facade that will boost confidence for the site. By this one will be committing the site into an easily accessible link with secure policies for the user such as a posting requesting the user to check out the private data protection criteria once they log on to the site.

    Read the article

  • What Search Engine Optimization Can Offer Your Business

    What can search engine optimization offer you? In today's world, it pays to have a website that can grow traffic organically. The days of black hat marketing tactics where pages were flooded with a certain keyword in order to boost ranking, while the content provided carried with it no real use to the person searching are long gone. Most companies are well equipped enough to weed out these tactics and punish you severely for engaging in them.

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >