Vehicle pickups for racing purpose
#1

My server has a few skill maps (like this). Some of these fast-paced maps need to have vehicle pickups (yes, like in MTA). The problem is that SA-MP provides in no way support for decent vehicle pickups.

1. I tried using pickup ID 14, vehicles picks this up and it dissapears. Fair enough because I can just re-create it if it woulden't be for the fact that these pickups just don't appear once u head into sea (which applies for basically all of these maps). Not usable.

2. I can try other pickup IDs, ID 1 seemed promising and works fine but cannot be pickup up in a vehicle. Not usable.

3. I can use IsPlayerInRangeOfPoint() or equivalent: the players gets the pickup when he gets near it. because the maps are so fast paced the timer would need to loop too fast (<100ms) in order to keep up and there are too many pickups to make this an efficient sollution. Not usable.

4. My current solution (but far from perfect): every pickup has an extra checkpoint on it (checkpoints can be picked up by a vehicle). The checkpoints only stream once the player gets close (currently at 20.0) so when a player drives over a pickup he actually enters the checkpoint and gets the pickup's item. Genius? No. This because a) the streamer loops too slowly and b) the pickups are close to eachother which means the checkpoint will only appear at the very last second. It seems like even Incognito's streamer plugin is too slow (yes, even when I run it faster) to detect the player at times.

This application works fine as long as the player doesn't drive too fast, which isn't the fact in many cases with these kind of maps.

Discuss better options? And, Kye, if you're actually reading this, please fix pickup ID 14.
Reply
#2

Do not bother with SAMP's pickup function. Make your own or use for example this one:
https://sampforum.blast.hk/showthread.php?tid=316908

I'm saying this because I've made gamemode like that and I tried a lot of things with SAMP pickup native functions but its simply lame
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Why are you using a timer instead of OnPlayerUpdate?
Woulden't that cause lagg? I'm talking hundreds of pickups here and because sometimes you may want to pickup 2 items at once (pickups may be on top of eachother) you can't break at the first found pickup. Though that may be inefficient coding on my part.
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
You can use a search tree to partition the world and vastly reduce the search space.
Could you help me on my way? I know what you mean, I don't know how to implement it. Is there a library I can use?
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Not really; however, if you have a look in the y_areas or (old) YSI/objects source codes, they do this. Unfortunately, it is quite abstract and hard to view.
Alright, thank you
Reply
#6

Sinner, what. Just... like MicroD said, just use a simple filterscript, for example irinel one.
Reply
#7

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Sinner, what. Just... like MicroD said, just use a simple filterscript, for example irinel one.
That FS uses pickup ID 14, which doesn't work out in the sea
Reply
#8

Quote:
Originally Posted by Sinner
Посмотреть сообщение
That FS uses pickup ID 14, which doesn't work out in the sea
Ah, what about other id ?! You can edit it.
Reply
#9

Check out my sig ..

I'm working on a DD/DM/SHOOTER Race server wich will be released when I'll fully complete the script..

PS: The only good way to make those pickups is either to wait untill my server is made and you cand download and use the pickups' plugin wich I provide (with 15 functions for creating nitro/repair/vehicle/rotation/boost/velocity pickups) or make yourself one. Believe me in pawn you will never be able to make accurate pickups for vehicles (if you want to run it on a decent server with more than 2 players online ofc)..

I hope I helper ya
Reply
#10

Yes, to Kalcor, I really think you should take a look at vehicle pickups, or atleast try adding a totally new pickup if possible.

The current ID 14 has ALOT of bugs, in parts of bayside it isn't shown (nor can be pickedup) but it's created a taken a id out of it.. I can show picture proof of this, id 14 also has some bugs with custom objects I believe and out at sea as others said.. It's really annoying ;\
Reply
#11

True , this bug should be fixed
Reply
#12

Quote:
Originally Posted by ShOoBy
Посмотреть сообщение
Check out my sig ..

I'm working on a DD/DM/SHOOTER Race server wich will be released when I'll fully complete the script..

PS: The only good way to make those pickups is either to wait untill my server is made and you cand download and use the pickups' plugin wich I provide (with 15 functions for creating nitro/repair/vehicle/rotation/boost/velocity pickups) or make yourself one. Believe me in pawn you will never be able to make accurate pickups for vehicles (if you want to run it on a decent server with more than 2 players online ofc)..

I hope I helper ya
That's interesting, because I did it many years ago in the old YSI in pawn...
Reply
#13

Not an ideal solution, but you would be able to create any pickup (preferably none-pickupable) and create an area around it (preferably with the streamer plugin). When a player enters the area do an action.

Again not ideal, but would most likely work fine.
Reply
#14

You don't actually need to check that often - you just need their current position and vector, then you can check if they have recently passed through a pickup by backtracking.
Reply
#15

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
You don't actually need to check that often - you just need their current position and vector, then you can check if they have recently passed through a pickup by backtracking.
y_racepickups ?
Reply
#16

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
That's interesting, because I did it many years ago in the old YSI in pawn...
Well .. maybe my computer is bad (6GB RAM, I know that's not enough but I don't think that a host would offer more) but when I tested it with loops and timers (Yes using foreach and Y_Timers) when I was passing at high speed .. the pickups did not work ..

So my solution was to make a plugin in C++ to create small squares (for area) .. and check if the vehicle is in that square .. using OnPlayerUpdate .. it worked way better ..

You can do that with Incognito's streamer I guess..
Reply
#17

I suspect the problem is not the language but the algorithm! For a long time the best streamer was written in PAWN simply because it did things differently, and that code is the same. You can loop through every pickup every 10ms and check players, but that's a terrible system! On the other hand you can use zoning algorithms to vastly reduce the amount of work needed by only checking a tiny fraction of the pickups available, and as I said use code to project a player's movement vectors to see if they recently passed through a pickup.

90% of optimisation is not HOW you code it, but WHAT you code.
Reply
#18

Quote:
Originally Posted by Sinner
Посмотреть сообщение
4. My current solution (but far from perfect): every pickup has an extra checkpoint on it (checkpoints can be picked up by a vehicle). The checkpoints only stream once the player gets close (currently at 20.0) so when a player drives over a pickup he actually enters the checkpoint and gets the pickup's item. Genius? No. This because a) the streamer loops too slowly and b) the pickups are close to eachother which means the checkpoint will only appear at the very last second. It seems like even Incognito's streamer plugin is too slow (yes, even when I run it faster) to detect the player at times.
I know I am being afterwise here, but like Y_Less said you can check the moving direction and see if the vehicle is moving at the next pickup then just show the checkpoint without streaming as it's pretty obvious the car will be going through that pickup next.
Reply
#19

I wanna bring this back up.

Look at this, pickup id 14 is giving troubles in places such as bayside, which is pretty annoying.

Don't you guys think an alternative way is needed? like seriously.. we could start a project to combat this situation

/imageshack/img338/6761/samp007od.png
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)