Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:53:14+00:00 2026-06-16T00:53:14+00:00

I am developing a game and I’m having problems. Basically the idea is: Player

  • 0

I am developing a game and I’m having problems. Basically the idea is:

  • Player uses a spell at area.
  • Engine selects all units in the area and applies an effect on each.

The problem is that the game theoretically possess thousands of units, and run a loop to check if each is within the specified region spend much processing.

Is there any way to index and speed up this process?

Here’s an example (its THEORETICAL!!):

// Create the unit struct

typedef struct UNIT{

   int ID;
   int x;
   int y;

}unit;

// Initialize the global unit struct

unit* allunits;

// Do some code, expand the array and add more units

void addUnits(){

...

}

// Search for the number of units that are inside a random region using for and the unit array

int unitsInRegion(x1, x2, y1, y2){

  // Spend alot of processing because there is like 10.000 units and we need to look at each X and Y
}

I want to mix this kind of task with DirectX as a way to streamline the process of rendering excluding models that are not within sight of view (camera) from the buffers.

Sorry for my bad English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:53:15+00:00Added an answer on June 16, 2026 at 12:53 am

    Is there any way to index and speed up this process?

    As mentioned in the comments the usual way to do this, are trees like Quadtrees, Octrees or BSP-Trees.

    I want to mix this kind of task with DirectX as a way to streamline the process of rendering excluding models that are not within sight of view (camera) from the buffers.

    I think youre looking for View Frustum Culling (Tutorial). You can mix this approach with one of the in the comments mentioned trees to get an efficient culling to all objects in your scene.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a game where I update the height the player has already gone.
I am developing game editor in C# that uses c++ lib files. I want
I'm developing a game with android using andengine. Basically, I'm using 2 ArrayList to
I am developing a game. To test my map engine, I need pictures of
I am developing a game that uses a different controller for each level. It
I'm developing a game on iOS w/ cocos2d+box2d as the game engine, and am
Developing a game with AndEngine GLES2 I am having an issue trying to change
I'm developing a game on Facebook and having a problem to update the scores
I am developing a game that uses a massive amount of textures. Therefore I
I am developing a game which uses sine wave. I made use of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.