Raised This Month: $64 Target: $400
 16% 

Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-20-2016 , 10:58   Re: [2016.02.21] Dynamic Objects and Properties - v004
Reply With Quote #21

I just moved this to Github and released version 004.

The main post has been updated.

A new example is included on how this is used that covers almost all features of Dynamic.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-26-2016 , 21:51   Re: [2016.02.27] Dynamic Objects and Properties - v005
Reply With Quote #22

As we know, methodmaps require data backing the properties which steers people away from using them.

You can create methodmaps that inherit the Dynamic class and write properties that use the dynamic object to back the properties.

dynamic-example.inc

Quote:
In the linked example, I use static offsets in each property of the methodmap to cache member positions in the dynamic object to increase performance.

This then requires all the dynamic members to be in the same positions.

To get around this, you can see I set all the members in the initialiser for MyClass, this means over multiple instances of MyClass, the member offsets will always correct.
The key points to following when making your own dynamic classes are:

1. All members must be set to their default values in the constructer
2. Use static offsets in each property to increase performance

I'm about to make a webpage where you can define your class. It will then spit out the methodmap to make that class using Dynamic.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-27-2016 , 02:17   Re: [2016.02.27] Dynamic Objects and Properties - v005
Reply With Quote #23

Dynamic Classes
- Extend Dynamic to create your own Dynamic Classes
- A Class Builder to quickly generate basic Dynamic Classes
- You dont have to muck around with Dynamic Member Offsets to improve performance
- All of the same features that come with Dynamic Objects

I just finished a basic web based class builder.

I used these settings to...

Generate this methodmap...

Which can be used like this in a plugin!
__________________

Last edited by Neuro Toxin; 02-27-2016 at 02:25.
Neuro Toxin is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 02-27-2016 , 04:23   Re: [2016.02.27] Dynamic Objects and Properties - v005
Reply With Quote #24

not bad... not bad
__________________
zipcore is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 02-27-2016 , 06:14   Re: [2016.02.27] Dynamic Objects and Properties - v005
Reply With Quote #25

The latest profile stats...


I'm really curious around why the reading of members using a string membername is quicker than using integer offsets.

Quote:
Read 99000 dynamic member(s) in 0.139648 second(s)
Read 99000 dynamic member(s) using offsets in 0.141601 second(s)

Read 99000 dynamic member(s) in 0.139648 second(s)
Read 99000 dynamic member(s) using offsets in 0.141601 second(s)

Read 99000 dynamic member(s) in 0.139648 second(s)
Read 99000 dynamic member(s) using offsets in 0.141601 second(s)
__________________

Last edited by Neuro Toxin; 02-27-2016 at 06:16.
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-15-2016 , 08:05   Re: [2016.02.27] Dynamic Objects and Properties - v005
Reply With Quote #26

Just updated Dynamic to version 0.0.6

Changes...

The technical answer as to why offsets are now faster...

The latest profile stats...

Member name lookups vs Offset lookups...


Github Changes
Download

Edit:

I've completed a code generate tweak for the Dynamic Class Generator.

- Member offsets are stored when a member is set for the first time
__________________

Last edited by Neuro Toxin; 03-15-2016 at 10:51.
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-17-2016 , 05:30   Re: Dynamic Objects and Properties - v006 - [2016.03.15]
Reply With Quote #27

Just realised I need to add support for boolean types.

I'll do this soon by wrapping Get/SetBool around integer support. This will be similar to how Get/SetObject works if your familiar with how the Dynamic methodmap works.

In the mean time booleans can be used with Get/SetInt.
__________________
Neuro Toxin is offline
kossolax
AlliedModders Donor
Join Date: Jan 2008
Location: Belgium
Old 03-18-2016 , 05:35   Re: Dynamic Objects and Properties - v006 - [2016.03.15]
Reply With Quote #28

Quote:
Originally Posted by Neuro Toxin View Post
Just realised I need to add support for boolean types.
What about handle types ?
kossolax is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-18-2016 , 06:05   Re: Dynamic Objects and Properties - v006 - [2016.03.15]
Reply With Quote #29

Great question.

Handles can currently be used via Get/SetInt. You might need view_as casting to avoid type mismatch warnings.

I will however add support for Handles after completing bool support.
__________________
Neuro Toxin is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 03-18-2016 , 09:14   Re: Dynamic Objects and Properties - v006 - [2016.03.15]
Reply With Quote #30

This is amazing.

Thanks for this! this saved me hours of writing natives to cross communicate with plugins
__________________
ImACow is offline
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

Forum Jump


All times are GMT -4. The time now is 21:48.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode