Posts: 1,036
Threads: 118
Joined: Aug 2006
Question for the devvers, but related to mapping.
Is it possible to use pickups for vehicle repairs and nitro like in MTA? I think the icons they use are probably hardcoded into MTA, but we could use checkpoints for this too.
I'm very addicted to DD/DM servers in MTA lately. It's basically making insane jumps and loops and finishing a map. Things like loops always damage your car badly, there's no way to make them smooth enough to prevent damage (especially with the sa-mp object limits). That's why repairs are necessary. Car-change pickups could be awesome to, that could just be a checkpoint with a 3d text. A total rewrite of the race handler should not be needed though, but I think a lot of players could like maps like this.
Examples to give you an idea of what a DM map is like:
[html]<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/IYP4kj7EOYs&hl=nl_NL&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/IYP4kj7EOYs&hl=nl_NL&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>[/html]
[html]<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/BE5IYSy8qPE&hl=nl_NL&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BE5IYSy8qPE&hl=nl_NL&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>[/html]
|
Posts: 2,425
Threads: 86
Joined: Dec 2008
These maps are quite cool
(05-26-2010, 06:23 PM)Chillosophy link Wrote: Is it possible to use pickups for vehicle repairs and nitro like in MTA?
Im not sure, but there is something like "OnPlayerPickUpPickup" part. It supplies pawno users to do lots of things at pickups.
LR
|
Posts: 6,609
Threads: 788
Joined: Dec 2006
I love MTA
Yeah we have plans to excessively improve races.
Let me quote the part about pickups:
Quote:Race pickups
Racers should be able to grab pickups during a race course (similar to that of Crash Tag Team Racing). Different pickups have different effects:
Gas Can Velocity (Speed) increase
Heart Vehicle repair
Wheels Offroad wheels
Exhaust 2x Nos
Stop sign Vehicle stop
Road Spikes Tyre Pop
Single Skull Large health decrease
Double Skull Vehicle explodes
Bomb Vehicle land mines (player can drop a mine out the back of their vehicle)
Rocket Vehicle Missile (player can fire a missile directly infront)
Question Mark Random
Pickups should be synced. They should only be enabled in certain races (race_enable_pickups function). They should not ever work in street or drift races.
Racing is going to be the biggest part of this version, and will have unique things that you won't see on any other SA-MP server.
For example, an NPC women walking to the starting line of a race, and waving racers off like Need For Speed. Not to mention Drift, Drag, Street and Circuit racing, along with players being able to custom build their own races and invite other players on the street to a Drag Race challenge.
Anyway, referring to maps: There is already a /vr command for vehicle health, but I suppose it wouldn't be a bad idea to remove this and indeed add pickups.
|
Posts: 3,930
Threads: 114
Joined: May 2009
That sounds very nice and unique, jay
|
Posts: 1,036
Threads: 118
Joined: Aug 2006
That is awesome Jay! Longer reply might follow later. Good to know it's possible!
|
Posts: 1,036
Threads: 118
Joined: Aug 2006
If a developer has some time I'm interested in how the object handler would work.
First of all it's awesome that we finally can use a lot more objects then we'd been used to, but I'm sure there are some limits.
I guess that every x seconds the handler iterates through every online player, and checks which world and region the player is in. If player A is in the main world near the pirate ship, the handler would return all objects in the vicinity and stream it to the player, and also destroy the objects that are out of sight. Player B could be in a race map and will get other objects from, maybe, another array.
If we have thousands and thousands of objects (which we will), how will this remain responsive enough? Will there be seperate arrays (or tables, I don't know what it's called in pawn) for each world? Will the interval for checking the position of the player change based on the amount of players to reduce lag? Will it be world-based or will there be one massive array? Will it distribute the checks or will it check every player at once at the predefined interval?
Since I'm not really active (sorry about that, but I would like to be active in creating maps, if everything works as good as advertised) I don't know if we use an existing streamer, and if it's pawn-based or a C++ plugin. I guess the latter one could speed up things even more.
In some other map-related topic I learned that there can be 255 objects per 600x600 (meters?) area, is that correct?
|
Posts: 6,609
Threads: 788
Joined: Dec 2006
06-02-2010, 05:56 PM
(This post was last modified: 06-02-2010, 06:07 PM by Jay)
The object streaming is done via a plugin coded in C++ by Incognito, which makes it about 20x faster than any version that could be written in PAWN alone.
Code: void
CStreamer::processObjects(Data::Player & player)
{
std::multimap<float, Data::Object>
discoveredObjects;
for (std::vector<Data::Object>::iterator o = CCore::objects.begin(); o != CCore::objects.end(); ++o)
{
float
distance = std::numeric_limits<float>::infinity();
if (checkPlayer((* o).interiorID, player.interiorID, (* o).playerID, player.playerID, (* o).worldID, player.worldID))
{
distance = checkDistance3D(player.x, player.y, player.z, (* o).x, (* o).y, (* o).z);
}
std::map<int, int>::iterator
s = player.objects.find((* o).objectID);
if (distance <= (* o).distance)
{
if (s == player.objects.end())
{
discoveredObjects.insert(std::make_pair(distance, * o));
}
}
else
{
if (s != player.objects.end())
{
gInvoke.callFunction(&PAWN::DestroyPlayerObject, player.playerID, (* s).second);
player.objects.erase(s);
}
}
}
for (std::multimap<float, Data::Object>::iterator d = discoveredObjects.begin(); d != discoveredObjects.end(); ++d)
{
if (player.objects.size() == CCore::global.visibleObjects)
{
break;
}
(* d).second.internalID = gInvoke.callFunction(&PAWN::CreatePlayerObject, player.playerID, (* d).second.modelID, (* d).second.x, (* d).second.y, (* d).second.z, (* d).second.rX, (* d).second.rY, (* d).second.rZ);
if ((* d).second.internalID == INVALID_OBJECT_ID)
{
break;
}
if ((* d).second.move)
{
gInvoke.callFunction(&PAWN::MovePlayerObject, player.playerID, (* d).second.internalID, (* d).second.move->x, (* d).second.move->y, (* d).second.move->z, (* d).second.move->speed);
}
player.objects.insert(std::make_pair((* d).second.objectID, (* d).second.internalID));
}
}
Above is the source of the object streaming part of the plugin. Obviously it's missing some functions that are called there. My C++ knowledge isn't up to scratch, but it looks to me gathering from function names that it is indeed as you suggested looping through all players and objects and checking distance accordingly at once. I'm sure there are better ways of doing it, like splitting it up into object grids, but I don't see why it should be slow. C++ is nothing like PAWN - looping isn't slow to begin with, so I'm not sure if it would even make a difference whether map zones were in different worlds. But anyway, we'll be changing the map zone handler soonish so that each map zone has it's own virtual world (again), which, in turn, should reduce the amount of iterations.
In short: Don't worry. It's fast. I've benchmarked this plugin in the past with 1,000,000 objects - heh, check out GamerX. They often have 400+ players, have over 1/2 mil objects, and I get normal ping when going there!  I _think_ Awesome Stuntages use it too, and again, they get 400+ players on a regular basis.
(06-02-2010, 04:55 PM)Chillosophy link Wrote: In some other map-related topic I learned that there can be 255 objects per 600x600 (meters?) area, is that correct?
255 is the SA-MP object limit, so therefore there can't be more than 255 objects spread over the whole map (Unless you're including static objects as well as SA-MP objects - in that case I'm unsure, although it would explain an old mystery..).
|
Posts: 1,036
Threads: 118
Joined: Aug 2006
You've just answered all my questions
Thanks a lot, I'll get back to mapping now
|
|