Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (alibaba, vicknick), 1,492 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Pointers without any trace functions #421923
04/28/13 03:54
04/28/13 03:54
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Lets say for example I have a button that I want a player to be able to step on;

action button()
{
if(player.x > my.x)
{
perform action
}
}

By itself it runs just as it should without any problems. But say for example we then introduce multiple players (split screen), when we try to run the function only one player will be able to press the button as the "player" pointer can only point to one object at a time. So now one would just say "Use c_trace/c_scan". Unfortunately this isnt an option as there are a LOT of buttons and tracing/scanning will slow down the game immensely. How would you be able to have an entity react to multiple players WITHOUT tracing/scanning?

Re: Pointers without any trace functions [Re: exile] #421926
04/28/13 08:34
04/28/13 08:34
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Just define your own pointers:

entity* Player1;
entity* Player2;

action aInitPlayer1()
{
Player1 = me;
...
...
...
}

action aInitPlayer2()
{
Player2 = me;
...
...
...
}


no science involved
Re: Pointers without any trace functions [Re: fogman] #422159
05/03/13 09:13
05/03/13 09:13
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Ok let me rephrase. Say I have an IF statement...

if(abs((player.x - my.x) * my.mysize) < 180)

And this is within an entity function, how/what can I replace the "player" pointer so it will react to any entity within range? Remember, I cant use c_trace or c_scan as it will destroy computers with the amount of entities I will be having on screen lol.

Re: Pointers without any trace functions [Re: exile] #422161
05/03/13 09:24
05/03/13 09:24
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
do a cycle on player entities and use vec_dist, it is faster, but lacks visibility, but can decrease the amount of visibility checks done by c_trace.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Pointers without any trace functions [Re: sivan] #422193
05/04/13 08:33
05/04/13 08:33
Joined: Apr 2005
Posts: 796
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 796
U.S.A. Michigan
Gotcha I'll give it a try. It'd be nice if we could trick the system with something like...

ved_dist(!my.x, my.x):

lol

Re: Pointers without any trace functions [Re: exile] #422198
05/04/13 12:29
05/04/13 12:29
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
do you need to check it for every entity or for just a bunch of them?


Visit my site: www.masterq32.de
Re: Pointers without any trace functions [Re: MasterQ32] #422200
05/04/13 13:43
05/04/13 13:43
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Yeah basicly check through the list
of entities wich are to be considered
for interaction with the button and then
check who among those entities are within
a given radius of the button and then only
can you simply trace for contact .. Well that's
one way


Compulsive compiler

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1