SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 02/06/2018, 04:15 PM   #21
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,129
Reputation: 3170
Default Re: UUID4 - Universal Unique Identifiers

Quote:
Originally Posted by Ada32 View Post
no



yes

the chances of a collision happening though is ridiculously low. like ridiculously ridiculously (did i say ridiculously?) low
I don't think you stressed ridiculously low enough (I'm not being sarcastic). If everyone on earth generated a million uuids per second for the age of the universe, there's a 50% chance any two of them would match.

For reference, there's a thing called the birthday paradox, which says that it takes only 30 people for a 50% chance that two of them will have the same birthday. So this huge age of the universe chance is massive despite being lowered by the same paradox.

Also, that article ignored two things:

1) some databases do support them natively.

2) binary trees are most efficiently balanced when the inserted data is random.
Y_Less is online now   Reply With Quote
Old 02/06/2018, 04:51 PM   #22
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,952
Reputation: 1548
Default Re: UUID4 - Universal Unique Identifiers

Some additional notes for this:

Yes, typical basic servers with an SQL database with a few thousand player records and auto increment IDs will not need this.

However, complex gamemodes often have many different entity types that are persisted. Often, these entities may be created by applications other than the gamemode itself, such as web services. The UUID format is standard and widely support in most programming languages and databases (yes, MySQL, Postgres, MongoDB and plenty of others actually support storing UUIDs as 128 bit fields not strings of text - I know from experience that Postgres provides optimised index features for UUIDs).

This isn't just for things in a database but for anything - you could assign UUIDs to vehicles, items, player login sessions, individual commands and chat messages or even every event that ever happens on a server ever - that beats using a combination of timestamp, event type, event contents, etc as a primary key.

The article does have some good points about UUIDs and is definitely worth a read by anyone considering using this plugin, but I wouldn't go as far as saying "you will almost never have to use uuids".
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 02/06/2018, 05:31 PM   #23
Ada32
Huge Clucker
 
Ada32's Avatar
 
Join Date: Apr 2013
Posts: 301
Reputation: 62
Default Re: UUID4 - Universal Unique Identifiers

the problem isn't uuids itself, it's how they're implementated. for starters they aren't (and shouldn't be) primary keys! i think that's what most people seem to think. they're more so references to a system designed to be made up of very different parts but are still part of that system

so this

Quote:
Originally Posted by [HLF]Southclaw
Itís also perfect for identifying entities such as vehicles, pickups, items, etc. A good example of this is the Scavenge and Survive gamemode: on each server restart, around 10-20,000 items are generated and placed in the world, each of these items is assigned a unique identifier so if a player picks one up and keeps it in their inventory or in a vehicle trunk, the unique identifier persists throughout the itemís lifetime and everywhere it goes can be tracked. This is very useful for auditing and anti-cheat.
i'd argue would actually be unnecessary as you would still need something (your db) to help differentiate between the items, vehicles etc.

which contradicts

Quote:
Originally Posted by [HLF]Southclaw
The problem with this is youíre relying on the database implementation to handle the uniqueness. This locks you into using that database and also means thereís a reliance on sequentiality in the identifiers.
maybe my words were brash so i'll reclarify by saying "you will almost never have to use uuids in samp"
Ada32 is offline   Reply With Quote
Old 06/08/2018, 01:33 PM   #24
zsoolt997
Little Clucker
 
zsoolt997's Avatar
 
Join Date: Aug 2015
Location: Hungary
Posts: 25
Reputation: 3
Default Re: UUID4 - Universal Unique Identifiers

OK, so I got this when I type to console 'exit'

Code:
Console input: exit
[15:20:33] --- Server Shutting Down.
[15:20:33] [debug] Server crashed due to an unknown error
[15:20:34] [debug] Native backtrace:
[15:20:34] [debug] #0 022bb2e8 in ?? ()
[15:20:34] [debug] #1 00494ad1 in ?? () from samp-server.exe
[15:20:34] [debug] #2 00492d25 in ?? () from samp-server.exe
[15:20:34] [debug] Registers:
[15:20:34] [debug] EAX: 15bbbcda EBX: 022bb278 ECX: 02380000 EDX: 02380000
[15:20:34] [debug] ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: 0019fe30
[15:20:34] [debug] EIP: 00492d25 EFLAGS: 00010213
[15:20:34] [debug] Stack:
[15:20:34] [debug] ESP+00000000: 00000000 000023f0 0019ff80 0021c000
[15:20:34] [debug] ESP+00000020: 00000224 00001724 02399bf0 656d6167
[15:20:34] [debug] ESP+00000040: 0021c000 004b1ed0 0019fe68 0019ff70
[15:20:34] [debug] ESP+00000060: 004a1e11 004a1e21 004b1ed0 0019ff70
[15:20:34] [debug] ESP+00000080: 023913d0 02391418 00000094 00000006
[15:20:34] [debug] ESP+000000a0: 00000000 00000000 00000000 00000000
[15:20:34] [debug] ESP+000000c0: 00000000 00000000 00000000 00000000
[15:20:34] [debug] ESP+000000e0: 00000000 00000000 00000000 00000000
[15:20:34] [debug] ESP+00000100: 00000000 00000000 00000000 00000000
[15:20:34] [debug] ESP+00000120: 004a34d7 0021c000 00000000 00000000
[15:20:34] [debug] ESP+00000140: 0019ffcc 004a3ba4 004c0790 00000000
[15:20:34] [debug] ESP+00000160: 6b126546 0019ffdc 77722fea 0021c000
[15:20:34] [debug] ESP+00000180: 00000000 00000000 00000000 00000000
[15:20:34] [debug] ESP+000001a0: 77732500 967f28a6 00000000 0019ffec
[15:20:34] [debug] ESP+000001c0: 00000000 004a34d7 0021c000 00000000
[15:20:34] [debug] ESP+000001e0: 000000dc 00000000 00000020 00000000
[15:20:34] [debug] ESP+00000200: 0000017c 00000001 00000000 00000000
[15:20:34] [debug] ESP+00000220: 1a26ef4e 00000298 00000044 000002e0
[15:20:34] [debug] ESP+00000240: 0000004a 00000588 00000342 00000000
[15:20:34] [debug] ESP+00000260: 000002fa 00000000 32ceeacd 00000bfc
[15:20:34] [debug] ESP+00000280: 38505fc8 00000f70 0000005e 00000fd0
[15:20:34] [debug] ESP+000002a0: 00000056 0000138c 00000392 00000010
[15:20:34] [debug] ESP+000002c0: 0000017c 000015dc 00000001 00000002
[15:20:34] [debug] ESP+000002e0: 00001ef8 00000e8c 00000001 00000004
[15:20:34] [debug] ESP+00000300: 00003098 00000098 00000002 00000006
[15:20:34] [debug] ESP+00000320: 000031fc 000000f0 00000001 00000009
[15:20:34] [debug] ESP+00000340: 00003314 00000004 00000001 64487353
[15:20:34] [debug] ESP+00000360: 00000006 0000008c 00000001 000015a4
[15:20:34] [debug] ESP+00000380: 00000000 00000000 00000000 00000000
[15:20:34] [debug] ESP+000003a0: 00000002 00000024 00000038 00000000
[15:20:34] [debug] ESP+000003c0: 00530057 0057005c 006e0069 00780053
[15:20:34] [debug] ESP+000003e0: 00000044 00000164 0000025c 00000001
[15:20:34] [debug] Loaded modules:
[15:20:34] [debug] 00400000 - 0051f000 samp-server.exe
[15:20:34] [debug] 776c0000 - 77850000 ntdll.dll
[15:20:34] [debug] 74180000 - 74260000 KERNEL32.DLL
[15:20:34] [debug] 6cd40000 - 6cd6f000 aswhookx.dll
[15:20:34] [debug] 757a0000 - 75984000 KERNELBASE.dll
[15:20:34] [debug] 74260000 - 755aa000 SHELL32.dll
[15:20:34] [debug] 76aa0000 - 76b5f000 msvcrt.dll
[15:20:34] [debug] 767f0000 - 76829000 cfgmgr32.dll
[15:20:34] [debug] 75a60000 - 75b7e000 ucrtbase.dll
[15:20:34] [debug] 76510000 - 76598000 shcore.dll
[15:20:34] [debug] 75e10000 - 75ed0000 RPCRT4.dll
[15:20:34] [debug] 73f80000 - 73fa0000 SspiCli.dll
[15:20:34] [debug] 73f70000 - 73f7a000 CRYPTBASE.dll
[15:20:34] [debug] 77520000 - 77578000 bcryptPrimitives.dll
[15:20:34] [debug] 764c0000 - 76504000 sechost.dll
[15:20:34] [debug] 76c50000 - 76eac000 combase.dll
[15:20:34] [debug] 75ed0000 - 7648a000 windows.storage.dll
[15:20:34] [debug] 759e0000 - 75a58000 advapi32.dll
[15:20:34] [debug] 76f10000 - 76f55000 shlwapi.dll
[15:20:34] [debug] 75990000 - 759b2000 GDI32.dll
[15:20:34] [debug] 74010000 - 74174000 gdi32full.dll
[15:20:34] [debug] 76830000 - 768ad000 msvcp_win.dll
[15:20:34] [debug] 75b80000 - 75d0d000 USER32.dll
[15:20:34] [debug] 759c0000 - 759d7000 win32u.dll
[15:20:34] [debug] 76b60000 - 76b6f000 kernel.appcore.dll
[15:20:34] [debug] 76a50000 - 76a68000 profapi.dll
[15:20:34] [debug] 76b70000 - 76bb5000 powrprof.dll
[15:20:34] [debug] 76680000 - 76688000 FLTLIB.DLL
[15:20:34] [debug] 731c0000 - 731c8000 WSOCK32.dll
[15:20:34] [debug] 73fa0000 - 74007000 WS2_32.dll
[15:20:34] [debug] 73bc0000 - 73be4000 WINMM.dll
[15:20:34] [debug] 738b0000 - 738d3000 WINMMBASE.dll
[15:20:34] [debug] 76490000 - 764b6000 IMM32.DLL
[15:20:34] [debug] 77b30000 - 77b81000 crashdetect.DLL
[15:20:34] [debug] 77ac0000 - 77b29000 MSVCP100.dll
[15:20:34] [debug] 77a00000 - 77abf000 MSVCR100.dll
[15:20:34] [debug] 5e7f0000 - 5e801000 uuid.DLL
[15:20:34] [debug] 766f0000 - 767ec000 ole32.dll
[15:20:34] [debug] 6f4c0000 - 6f52d000 MSVCP140.dll
[15:20:34] [debug] 70b30000 - 70b44000 VCRUNTIME140.dll
[15:20:34] [debug] 70f20000 - 70f76000 mswsock.dll
[15:20:34] [debug] 70ec0000 - 70ed1000 napinsp.dll
[15:20:34] [debug] 70ea0000 - 70eb6000 pnrpnsp.dll
[15:20:34] [debug] 70e80000 - 70e93000 NLAapi.dll
[15:20:34] [debug] 72970000 - 729fe000 DNSAPI.dll
[15:20:34] [debug] 76a70000 - 76a77000 NSI.dll
[15:20:34] [debug] 734d0000 - 73500000 IPHLPAPI.DLL
[15:20:34] [debug] 70e70000 - 70e7c000 winrnr.dll
[15:20:34] [debug] 6ca20000 - 6ca6f000 fwpuclnt.dll
[15:20:34] [debug] 734b0000 - 734c9000 bcrypt.dll
[15:20:34] [debug] 6dc00000 - 6dc08000 rasadhlp.dll
I'm using these plugins only.

Code:
plugins crashdetect uuid
zsoolt997 is offline   Reply With Quote
Old 06/08/2018, 04:58 PM   #25
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,952
Reputation: 1548
Default Re: UUID4 - Universal Unique Identifiers

I've not seen that before, though I use ^C to exit rather than the command.

I suspect it's because of the missing parameter on this: https://github.com/Southclaws/pawn-u...c/main.cpp#L47
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 06/08/2018, 08:44 PM   #26
zsoolt997
Little Clucker
 
zsoolt997's Avatar
 
Join Date: Aug 2015
Location: Hungary
Posts: 25
Reputation: 3
Default Re: UUID4 - Universal Unique Identifiers

Soooo, can you fix it or should I use another method to stop the server?

Also crashes the server when I try to restart with the 'gmx' command.
zsoolt997 is offline   Reply With Quote
Old 06/08/2018, 09:04 PM   #27
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 481
Reputation: 35
Default Re: UUID4 - Universal Unique Identifiers

what is this plugin real usage because databases have auto increcment system and again samp is too basic to add some long strings for identfing whn you could just use simple number variable.
CodeStyle175 is offline   Reply With Quote
Old 06/08/2018, 09:10 PM   #28
DBZdabIt3Bro7
Banned
 
Join Date: Sep 2017
Location: Lovely name, right?
Posts: 76
Reputation: 8
Default Re: UUID4 - Universal Unique Identifiers

Quote:
Originally Posted by CodeStyle175 View Post
what is this plugin real usage because databases have auto increcment system and again samp is too basic to add some long strings for identfing whn you could just use simple number variable.
did you read any of the comments or even the main post?..



all your questions is honestly answered right there, point to point.
DBZdabIt3Bro7 is offline   Reply With Quote
Old 06/08/2018, 09:13 PM   #29
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 481
Reputation: 35
Default Re: UUID4 - Universal Unique Identifiers

again southclaw hasnt built any gamemode. on gamemode you dont rely other things on player name but on the auto increcmwnt id
CodeStyle175 is offline   Reply With Quote
Old 07/08/2018, 01:49 AM   #30
Ada32
Huge Clucker
 
Ada32's Avatar
 
Join Date: Apr 2013
Posts: 301
Reputation: 62
Default Re: UUID4 - Universal Unique Identifiers

Quote:
Originally Posted by CodeStyle175 View Post
again southclaw hasnt built any gamemode
https://github.com/Southclaws/ScavengeSurvive
Ada32 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dialogs unique identifiers (no longer maintained) Donny_k Help Archive 67 27/11/2009 10:40 PM


All times are GMT. The time now is 02:10 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.