About the allegro provided coordinate system.
keprast

He is a linked list, which is very inconvenient.
Over time is too long.
How to change it into a hash table?
do you know? Similarly, can you help me?thanks.

--------------------------------

Of course, I hope it becomes a "map" structure.

--------------------------------

or,tell me 5.050*10^8 tick, need 1ghz cpu what time?

Edgar Reynaldo

I don't really know what you're talking about.

The old SGI STL Template Guide is no longer being hosted by SGI since their acquisition by Hewlett Packard (which is BS).

Luckily, I've got a copy I downloaded for reference.
SGI STL Reference Guide

Extract the 7z archive, and then view STL_doc/index.html .

Look at std::vector, std::map, and std::list .

You can store an ALLEGRO_VERTEX in whatever data structure you wish, and then process it as an array.

keprast

I am sorry.Although I use Google Translate.But obviously not easy.
I will use the programmer's common language.code.

array[1000]{1,2,3...};

for(int i = 0;i < 1000;i++)
{
    if(array[i] == x){
    //something
    }
}

Like this, if the array is 10000? 100000?
It takes too much time.

Edgar Reynaldo

Can you post more code? I need context - what are you using this with, and what for?

你能發表更多的代碼嗎? 我需要上下文 - 你在用什麼,以及為了什麼?

keprast

@Edgar Reynaldo

Projectile collision.This is the structure of my code.
But obviously, assuming I have 1000 objects and 1000 bullets, I need to count 1000 * 1000 times.
:o
Oh my god.
--------------------
I need a better algorithm.
But I can not find the literature at Baidu.
In Google, I can not find the location.Because it is English.

If you can, can you give me some information?

LennyLen
keprast said:

But obviously, assuming I have 1000 objects and 1000 bullets, I need to count 1000 * 1000 times.

The usual method is to divide your screen into sections and only check for collisions between objects in the same section.

Try looking up quadtrees.

keprast

@LennyLen

I lack relevant knowledge, need some literature.
On the Chinese search engine, only some useless crap.
Or, you tell me, what books have such knowledge.

LennyLen

I've never needed to use them, so I only know how they work in theory.

This might help, if you can translate it: Use Quadtrees to Detect Likely Collisions in 2D Space

keprast

Thanks! ;D

Thread #617243. Printed from Allegro.cc