473,785 Members | 2,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A way to unique store some instances reference

I have a map in a game. I need to make a list with all visible objects for a
player
So, any building and any unit offer a range of visibility over the map.

Now VB question:

How can I store the references of that visible objects in a collection, to
make sure I added one object only once...?

Moreover ..how to determine if a certain object belong to the visible
list...

I could have a GraphicsPath from all regions visible to the the Player and
iterate through all other players's objects, and check out if it is inside
the visible GraphicsPath, but I noticed that GraphicsPath.Is Visible is very
slow even with 2 circles added to the path...
Any thoughts?
--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------
Nov 20 '05 #1
11 1138
I am sorry I am not good at English.
But I can still guess what you want to express.
I can't express my thoughts clearly in English,so I try to
use some Example.
You can make a table of that map your have infered.
This table have a X,Y location.An array can eailsy store
it, A(640,480) restores an map's information which size
is 640*480.If you have a unit Called marine ,it's vision
sight is 10,and this marine's position is (400,300).Then
for i=400-10 to 400+10
for j=300-10 to 300+10
If a(i,j)=0 then
A(i,j)=1
End if
next
next
If another Marine come to nearbY, you can do same
operation too.
Wish this can help you .
Best Regards Menu Chen
Nov 20 '05 #2
And I only have to ckeck for each other object if it's location is 0 or 1 in
that array... good ideea

This way, no need for GraphPath

Say around, I may have some other q for you and seems you are up to date on
this issues :)

Thanks

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
I am sorry I am not good at English.
But I can still guess what you want to express.
I can't express my thoughts clearly in English,so I try to
use some Example.
You can make a table of that map your have infered.
This table have a X,Y location.An array can eailsy store
it, A(640,480) restores an map's information which size
is 640*480.If you have a unit Called marine ,it's vision
sight is 10,and this marine's position is (400,300).Then
for i=400-10 to 400+10
for j=300-10 to 300+10
If a(i,j)=0 then
A(i,j)=1
End if
next
next
If another Marine come to nearbY, you can do same
operation too.
Wish this can help you .
Best Regards Menu Chen

Nov 20 '05 #3
* "Crirus" <Cr****@datagro up.ro> scripsit:
I have a map in a game. I need to make a list with all visible objects for a
player
So, any building and any unit offer a range of visibility over the map.

Now VB question:

How can I store the references of that visible objects in a collection, to
make sure I added one object only once...?


You can add them to a 'Hashtable'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #4
Oh,I see.
I know now my solution is slow.
Have you ever played a game by Blizzard called
starcraft.Do you mean to make the effects like what it
have done? I think ther original map is all visible for
player.And when you place the black fog on it ,it will
seem as if there is a vision for each unit.I mean there
were be two layers on your program.One is covered by
another. So ,you didn't have to check the array every
time. Just place the fog one time and give the attention
to each change. for example ,if a marine move , his vision
will change withe him .And this time ,what you have to do
all is change the array and modify the the upper layer.You
don't have to redraw all the map now .In ohter words ,the
fog Layer can be seen as a picture paint on black.And when
you want to show the vision of a unit,just make modify the
picture's by pixels.
Say Sorry for my poor English again.
Wish this help.
Best Regards.


-----Original Message-----
And I only have to ckeck for each other object if it's location is 0 or 1 inthat array... good ideea

This way, no need for GraphPath

Say around, I may have some other q for you and seems you are up to date onthis issues :)

Thanks

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you
------------------------------

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in messagenews:09******* *************** ******@phx.gbl. ..
I am sorry I am not good at English.
But I can still guess what you want to express.
I can't express my thoughts clearly in English,so I try to use some Example.
You can make a table of that map your have infered.
This table have a X,Y location.An array can eailsy store
it, A(640,480) restores an map's information which size
is 640*480.If you have a unit Called marine ,it's vision
sight is 10,and this marine's position is (400,300).Then
for i=400-10 to 400+10
for j=300-10 to 300+10
If a(i,j)=0 then
A(i,j)=1
End if
next
next
If another Marine come to nearbY, you can do same
operation too.
Wish this can help you .
Best Regards Menu Chen

.

Nov 20 '05 #5
That is not a problem, neither your english.. I understand it...
I just was looking for a way to filte only visible objects from a specific
player point of view

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in message
news:06******** *************** *****@phx.gbl.. .
Oh,I see.
I know now my solution is slow.
Have you ever played a game by Blizzard called
starcraft.Do you mean to make the effects like what it
have done? I think ther original map is all visible for
player.And when you place the black fog on it ,it will
seem as if there is a vision for each unit.I mean there
were be two layers on your program.One is covered by
another. So ,you didn't have to check the array every
time. Just place the fog one time and give the attention
to each change. for example ,if a marine move , his vision
will change withe him .And this time ,what you have to do
all is change the array and modify the the upper layer.You
don't have to redraw all the map now .In ohter words ,the
fog Layer can be seen as a picture paint on black.And when
you want to show the vision of a unit,just make modify the
picture's by pixels.
Say Sorry for my poor English again.
Wish this help.
Best Regards.


-----Original Message-----
And I only have to ckeck for each other object if it's

location is 0 or 1 in
that array... good ideea

This way, no need for GraphPath

Say around, I may have some other q for you and seems you

are up to date on
this issues :)

Thanks

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all

from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote

in message
news:09******* *************** ******@phx.gbl. ..
I am sorry I am not good at English.
But I can still guess what you want to express.
I can't express my thoughts clearly in English,so I try to use some Example.
You can make a table of that map your have infered.
This table have a X,Y location.An array can eailsy store
it, A(640,480) restores an map's information which size
is 640*480.If you have a unit Called marine ,it's vision
sight is 10,and this marine's position is (400,300).Then
for i=400-10 to 400+10
for j=300-10 to 300+10
If a(i,j)=0 then
A(i,j)=1
End if
next
next
If another Marine come to nearbY, you can do same
operation too.
Wish this can help you .
Best Regards Menu Chen

.

Nov 20 '05 #6
Sorry ,this time I can't quite follow you.(Just because my
poor English Understanding.)
May you give me a example to descirbe your question
clearly.

-----Original Message-----
That is not a problem, neither your english.. I understand it...I just was looking for a way to filte only visible objects from a specificplayer point of view

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you
------------------------------

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in messagenews:06******* *************** ******@phx.gbl. ..
Oh,I see.
I know now my solution is slow.
Have you ever played a game by Blizzard called
starcraft.Do you mean to make the effects like what it
have done? I think ther original map is all visible for
player.And when you place the black fog on it ,it will
seem as if there is a vision for each unit.I mean there
were be two layers on your program.One is covered by
another. So ,you didn't have to check the array every
time. Just place the fog one time and give the attention
to each change. for example ,if a marine move , his vision will change withe him .And this time ,what you have to do all is change the array and modify the the upper layer.You don't have to redraw all the map now .In ohter words ,the fog Layer can be seen as a picture paint on black.And when you want to show the vision of a unit,just make modify the picture's by pixels.
Say Sorry for my poor English again.
Wish this help.
Best Regards.


>-----Original Message-----
>And I only have to ckeck for each other object if it's

location is 0 or 1 in
>that array... good ideea
>
>This way, no need for GraphPath
>
>Say around, I may have some other q for you and seems you
are up to date on
>this issues :)
>
>Thanks
>
>--
>Ceers,
> Crirus
>
>------------------------------
>If work were a good thing, the boss would take it all

from you
>
>------------------------------
>
>"Menu Chen" <an*******@disc ussions.microso ft.com> wrote

in message
>news:09******* *************** ******@phx.gbl. ..
>> I am sorry I am not good at English.
>> But I can still guess what you want to express.
>> I can't express my thoughts clearly in English,so I
try to
>> use some Example.
>> You can make a table of that map your have infered.
>> This table have a X,Y location.An array can eailsy

store >> it, A(640,480) restores an map's information which size >> is 640*480.If you have a unit Called marine ,it's vision >> sight is 10,and this marine's position is (400,300).Then >> for i=400-10 to 400+10
>> for j=300-10 to 300+10
>> If a(i,j)=0 then
>> A(i,j)=1
>> End if
>> next
>> next
>> If another Marine come to nearbY, you can do same
>> operation too.
>> Wish this can help you .
>>
>>
>> Best Regards Menu Chen
>>
>>
>
>
>.
>

.

Nov 20 '05 #7
Finaly
I know what you want to say.
U mean,how to make sure whether Marine A is in Marine B's
vision?
I will think about it.
Best regards.

-----Original Message-----
That is not a problem, neither your english.. I understand it...I just was looking for a way to filte only visible objects from a specificplayer point of view

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you
------------------------------

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in messagenews:06******* *************** ******@phx.gbl. ..
Oh,I see.
I know now my solution is slow.
Have you ever played a game by Blizzard called
starcraft.Do you mean to make the effects like what it
have done? I think ther original map is all visible for
player.And when you place the black fog on it ,it will
seem as if there is a vision for each unit.I mean there
were be two layers on your program.One is covered by
another. So ,you didn't have to check the array every
time. Just place the fog one time and give the attention
to each change. for example ,if a marine move , his vision will change withe him .And this time ,what you have to do all is change the array and modify the the upper layer.You don't have to redraw all the map now .In ohter words ,the fog Layer can be seen as a picture paint on black.And when you want to show the vision of a unit,just make modify the picture's by pixels.
Say Sorry for my poor English again.
Wish this help.
Best Regards.


>-----Original Message-----
>And I only have to ckeck for each other object if it's

location is 0 or 1 in
>that array... good ideea
>
>This way, no need for GraphPath
>
>Say around, I may have some other q for you and seems you
are up to date on
>this issues :)
>
>Thanks
>
>--
>Ceers,
> Crirus
>
>------------------------------
>If work were a good thing, the boss would take it all

from you
>
>------------------------------
>
>"Menu Chen" <an*******@disc ussions.microso ft.com> wrote

in message
>news:09******* *************** ******@phx.gbl. ..
>> I am sorry I am not good at English.
>> But I can still guess what you want to express.
>> I can't express my thoughts clearly in English,so I
try to
>> use some Example.
>> You can make a table of that map your have infered.
>> This table have a X,Y location.An array can eailsy

store >> it, A(640,480) restores an map's information which size >> is 640*480.If you have a unit Called marine ,it's vision >> sight is 10,and this marine's position is (400,300).Then >> for i=400-10 to 400+10
>> for j=300-10 to 300+10
>> If a(i,j)=0 then
>> A(i,j)=1
>> End if
>> next
>> next
>> If another Marine come to nearbY, you can do same
>> operation too.
>> Wish this can help you .
>>
>>
>> Best Regards Menu Chen
>>
>>
>
>
>.
>

.

Nov 20 '05 #8
In fact, My goal for this question was how to filter objects on the map from
a certain player point of view....
I mean, I ned a list with all object a player see and you gave me the
solution with that array :)

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in message
news:07******** *************** *****@phx.gbl.. .
Finaly
I know what you want to say.
U mean,how to make sure whether Marine A is in Marine B's
vision?
I will think about it.
Best regards.

-----Original Message-----
That is not a problem, neither your english.. I

understand it...
I just was looking for a way to filte only visible

objects from a specific
player point of view

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all

from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote

in message
news:06******* *************** ******@phx.gbl. ..
Oh,I see.
I know now my solution is slow.
Have you ever played a game by Blizzard called
starcraft.Do you mean to make the effects like what it
have done? I think ther original map is all visible for
player.And when you place the black fog on it ,it will
seem as if there is a vision for each unit.I mean there
were be two layers on your program.One is covered by
another. So ,you didn't have to check the array every
time. Just place the fog one time and give the attention
to each change. for example ,if a marine move , his vision will change withe him .And this time ,what you have to do all is change the array and modify the the upper layer.You don't have to redraw all the map now .In ohter words ,the fog Layer can be seen as a picture paint on black.And when you want to show the vision of a unit,just make modify the picture's by pixels.
Say Sorry for my poor English again.
Wish this help.
Best Regards.

>-----Original Message-----
>And I only have to ckeck for each other object if it's
location is 0 or 1 in
>that array... good ideea
>
>This way, no need for GraphPath
>
>Say around, I may have some other q for you and seems you are up to date on
>this issues :)
>
>Thanks
>
>--
>Ceers,
> Crirus
>
>------------------------------
>If work were a good thing, the boss would take it all
from you
>
>------------------------------
>
>"Menu Chen" <an*******@disc ussions.microso ft.com> wrote
in message
>news:09******* *************** ******@phx.gbl. ..
>> I am sorry I am not good at English.
>> But I can still guess what you want to express.
>> I can't express my thoughts clearly in English,so I try to
>> use some Example.
>> You can make a table of that map your have infered.
>> This table have a X,Y location.An array can eailsy store >> it, A(640,480) restores an map's information which size >> is 640*480.If you have a unit Called marine ,it's vision >> sight is 10,and this marine's position is (400,300).Then >> for i=400-10 to 400+10
>> for j=300-10 to 300+10
>> If a(i,j)=0 then
>> A(i,j)=1
>> End if
>> next
>> next
>> If another Marine come to nearbY, you can do same
>> operation too.
>> Wish this can help you .
>>
>>
>> Best Regards Menu Chen
>>
>>
>
>
>.
>

.

Nov 20 '05 #9
Hi Menu Chen,
Have an ICQ?
mine is 94678098
--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote in message
news:07******** *************** *****@phx.gbl.. .
Finaly
I know what you want to say.
U mean,how to make sure whether Marine A is in Marine B's
vision?
I will think about it.
Best regards.

-----Original Message-----
That is not a problem, neither your english.. I

understand it...
I just was looking for a way to filte only visible

objects from a specific
player point of view

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all

from you

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

"Menu Chen" <an*******@disc ussions.microso ft.com> wrote

in message
news:06******* *************** ******@phx.gbl. ..
Oh,I see.
I know now my solution is slow.
Have you ever played a game by Blizzard called
starcraft.Do you mean to make the effects like what it
have done? I think ther original map is all visible for
player.And when you place the black fog on it ,it will
seem as if there is a vision for each unit.I mean there
were be two layers on your program.One is covered by
another. So ,you didn't have to check the array every
time. Just place the fog one time and give the attention
to each change. for example ,if a marine move , his vision will change withe him .And this time ,what you have to do all is change the array and modify the the upper layer.You don't have to redraw all the map now .In ohter words ,the fog Layer can be seen as a picture paint on black.And when you want to show the vision of a unit,just make modify the picture's by pixels.
Say Sorry for my poor English again.
Wish this help.
Best Regards.

>-----Original Message-----
>And I only have to ckeck for each other object if it's
location is 0 or 1 in
>that array... good ideea
>
>This way, no need for GraphPath
>
>Say around, I may have some other q for you and seems you are up to date on
>this issues :)
>
>Thanks
>
>--
>Ceers,
> Crirus
>
>------------------------------
>If work were a good thing, the boss would take it all
from you
>
>------------------------------
>
>"Menu Chen" <an*******@disc ussions.microso ft.com> wrote
in message
>news:09******* *************** ******@phx.gbl. ..
>> I am sorry I am not good at English.
>> But I can still guess what you want to express.
>> I can't express my thoughts clearly in English,so I try to
>> use some Example.
>> You can make a table of that map your have infered.
>> This table have a X,Y location.An array can eailsy store >> it, A(640,480) restores an map's information which size >> is 640*480.If you have a unit Called marine ,it's vision >> sight is 10,and this marine's position is (400,300).Then >> for i=400-10 to 400+10
>> for j=300-10 to 300+10
>> If a(i,j)=0 then
>> A(i,j)=1
>> End if
>> next
>> next
>> If another Marine come to nearbY, you can do same
>> operation too.
>> Wish this can help you .
>>
>>
>> Best Regards Menu Chen
>>
>>
>
>
>.
>

.

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2398
by: Tony Clarke | last post by:
Hi, I'm trying to write a system thats used for about 50 clients that uses html forms and php to log details. The problem is that when a client loads the form page it's given a value which is the last record in a table +1 (i.e. so its the next record). The problem with that is that a client could sit on that page for 20 mins (or whatever length of time) and a different client could use that record number and there what be an error...
22
2766
by: Claudio Jolowicz | last post by:
Is it possible to store unique objects in an STL container? Suppose an object of class C is unique: class C { public: C() {} ~C() {} private:
3
3425
by: BVO | last post by:
I need to keep track of my MDI child forms to activate any one of them whenever I need to. There are two possibilities as far as I can see: - each forms index in the MDIChildren collection - each forms Handle property. The first one doesnt offer my a unique reference cause the indexes change when forms are closed. I guess I
3
2710
by: Kilroy Programmer | last post by:
Is there a way to store a unique numeric identifier (say, for example, an int) into a TreeNode, so that when the TreeNode is checked (since CheckBoxes is enabled) the eventhandler AfterCheck() can examine the responsible Node's identifier to see which TreeNode triggered the event? Analyzing the Node's Text string is undesirable because it would mean performing a string compare to a set of predefined strings. This is slower and not easily...
2
1405
by: Peter Oliphant | last post by:
Sometimes it's hard to get straight when passing or storing or returning an instance of a class whether you are still dealing with the original object or a copy. For example, the '=' operator used on pointers to two instance of a class can be overloaded to return the pointer to the target instance or a pointer to a copy of the target instance. When passing an instance of a class it can be done so the method will manipulate the instance...
5
2165
by: Joseph Geretz | last post by:
Of course, I can store a C# class instance to the Server Cache (this.Context.Cache). I've tried it. My question is, will this destroy the scalability of my application? My background is VB6. With VB6 we learned very early on that you do *NOT* store VB6 class instances on the server. That is because a VB6 class can only be accessed on the thread on which it is created (thread affinity). This is just incompatible with stateless web...
4
4265
by: Rob Stevens | last post by:
Is there some sort of unique identifier in every treenode that is consistent? I was looking at the handle of every treenode, but it appears that the handle changes everytime the tree is built. I have seen in some databases where they store the treenodes they are using some serial number of the node. I don't have a clue what that is, but can someone tell me if there is something that is unique to every node.
4
4024
by: Benjamin | last post by:
Is there a way to obtain a unique ID for the current thread? I have an object that I need to store local thread data in, and I don't want to use threading.local because each thread might have multiple instances of my object.
17
1726
by: Matija Papec | last post by:
I would like to be able to convert any reference (function, object, or array) into unique string id and retrieve original reference afterwards using same id. The following code does this but only for functions, and for some unknown reason does not work properly for other kind of references. var func = function(){}; var ref_id = $GS(func);
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.