Author Topic: My Decal Sample Plugin and the same plugin converted to VVS
Mag-nus 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
This is just a sample plugin I wrote to help beginners get into decal plugin development.

It shows the basics of:
drawing things in the in-game view
firing on user click events
firing on decal triggered events
converting a plugin to VVS (virindi view service)

VI did the VVS conversion, thanks!

You can download it here:
(No compiled binaries provided, you must build it yourself)
http://www.virindi.net/junk/Mag_SamplePlugins.zip

If you have any questions about how the plugin works, why I did certain things the way I did, or how to go about performing other basic actions, feel free to ask and I'll do my best to answer.

 

-----signature-----
Link to this post
FreestyleDT 
Posts: 4,851
Registered: Oct 14, '08
Extended Info (if available)
Real Post Cnt: 4,847
User ID: 1,331,273
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Thanks a lot for this.

 

-----signature-----
Gingers don't shit, they asshole puke.
lil vulno perhaps looks like a young conan obrien (very intelligent), not some kind of fucking leprachaun - Darklord
Official Get Down Forums - www.gd-gaming.com
Link to this post
Saloben_ign 
Posts: 2,555
Registered: Oct 30, '03
Extended Info (if available)
Real Post Cnt: 2,531
User ID: 851,114
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Very nice ty!

 

-----signature-----
Never! Never! Never! take a sleeping pill and a laxative at the same time.
Link to this post
azv4 
Posts: 10,585
Registered: Jul 14, '08
Extended Info (if available)
Real Post Cnt: 10,565
User ID: 1,309,146
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Looks like Virindi considers it junk...

 

-----signature-----
(none)
Link to this post
Mag-nus 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Here's VI's sample on how to wire up controls:
http://www.virindi.net/repos/virindi_public/trunk/Examples/AutoWireupExamplePlugin/

Notice here the ObjectTracker.cs class. This is a well designed object. It's purpose is to simply track objects in AC. When it detects a new object, or deletes an object from its list, it raises an event to indicate it.

The MainView.cs subscribes to these events and modifies the GUI.


After talking with VI, I've come up with a slightly different approach.

I would design ObjectTracker.cs just as VI.
MainView.cs would exposes all the GUI variables, but does not control interaction with them.
A new class ObjectTrackerGUI.cs would be created that would manage the modification of the GUI from an ObjectTracker.


This may sound a little complicated to those just getting started with programming.


I've also started publishing my open source project here:
http://magtools.codeplex.com/
I'll post pictures and a binary later, but for now its a good place to look at source.
I have not implemented the GUI pattern as described above yet. For instance Tracker.cs and ItemInfoOnIdent.cs both work with the GUI directly. This isn't "bad" but it makes it difficult to re-use these objects.

My code is LGPL licensed. You can modify it as long as you share the source. You can also use any public exports (there currently are none) in any non-shared source projects.

 

-----signature-----
Link to this post
-Eps 
Title: I Love Boobies. And Butts, too!
Posts: 17,344
Registered: May 30, '07
Extended Info (if available)
Real Post Cnt: 32,011
User ID: 1,226,605
Subject: My Decal Sample Plugin and the same plugin converted to VVS
I dont get it.
decal already has on object create and release events

 

-----signature-----
#dnn #og-ac http://tinyurl.com/ACDTChat
Fastest 1-275 in AC history.
Plugin Users: 100+
Buy Plugins Relogger, ValSalv, and AutoVendor(route trigger): http://bit.ly/ACaCAl
[Trade] +Envoy Sparker says, "Rep check: Eps Levelin, PST."
Link to this post
Virindi-Inquisitor 
Posts: 6,908
Registered: Nov 18, '01
Extended Info (if available)
Real Post Cnt: 6,646
User ID: 511,923
Subject: My Decal Sample Plugin and the same plugin converted to VVS
The ObjectTracker class is just an example of a logic class. The idea is to demonstrate how plugin logic can be placed in a separate class from view interaction.

 

-----signature-----
Virindi
---
****Virindi Plugins FAQ**** http://www.virindi.net/wiki/index.php/Virindi_Plugins_FAQ
http://www.virindi.net - Virindi Tank, Follower, Integrator, Reporter, VCS5, XPHelper, Item Tool, HUDs, etc...
Decal Core Dev - http://www.decaldev.com
Link to this post
-Eps 
Title: I Love Boobies. And Butts, too!
Posts: 17,344
Registered: May 30, '07
Extended Info (if available)
Real Post Cnt: 32,011
User ID: 1,226,605
Subject: My Decal Sample Plugin and the same plugin converted to VVS
i peeked at it. i see.

 

-----signature-----
#dnn #og-ac http://tinyurl.com/ACDTChat
Fastest 1-275 in AC history.
Plugin Users: 100+
Buy Plugins Relogger, ValSalv, and AutoVendor(route trigger): http://bit.ly/ACaCAl
[Trade] +Envoy Sparker says, "Rep check: Eps Levelin, PST."
Link to this post
shontsu 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Hi. All my plugins have been created from the old Wolfs C# Plugin Template, so I've grabbed your samples to help sort out converting to VVS. So thanks for posting these happy .

One question unrelated to VVS. I notice you subscribe to events like:

[BaseEvent("LoginComplete", "CharacterFilter")]
private void CharacterFilter_LoginComplete(object sender, EventArgs e)

Whereas I'm used to the Wolfs way of doing it like:

Core.CharacterFilter.LoginComplete += new EventHandler(CharacterFilter_LoginComplete);


Is there any meaningful difference between the two options (i.e.,. is it worth me going through and changing all my event code to do like yours)?

 

-----signature-----
Link to this post
Virindi-Inquisitor 
Posts: 6,908
Registered: Nov 18, '01
Extended Info (if available)
Real Post Cnt: 6,646
User ID: 511,923
Subject: My Decal Sample Plugin and the same plugin converted to VVS
shontsu posted:
I notice you subscribe to events like:

[BaseEvent("LoginComplete", "CharacterFilter")]
private void CharacterFilter_LoginComplete(object sender, EventArgs e)

Whereas I'm used to the Wolfs way of doing it like:

Core.CharacterFilter.LoginComplete += new EventHandler(CharacterFilter_LoginComplete);


Is there any meaningful difference between the two options


Yes. If you do everything the same, the latter method is slightly faster depending on the size of your plugincore class.

How much does it matter? I converted GoArrow from the first to the second method and it saved 50ms of startup time on my system. Not a huge deal, but I don't like something else 'magically' dealing with my events anyway. Also, the latter method allows you to utilize intellisense and compile time checking...with the former, if you misspell something, it will just silently fail.

My personal theory is that as many errors as possible should be caught at compile time, rather than runtime. It's why I hate javascript and loose typing grin

 

-----signature-----
Virindi
---
****Virindi Plugins FAQ**** http://www.virindi.net/wiki/index.php/Virindi_Plugins_FAQ
http://www.virindi.net - Virindi Tank, Follower, Integrator, Reporter, VCS5, XPHelper, Item Tool, HUDs, etc...
Decal Core Dev - http://www.decaldev.com
Link to this post
shontsu 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Thanks happy .

 

-----signature-----
Link to this post
Chazcon 
Title: FOR THE VITAE!
Posts: 5,298
Registered: Dec 11, '01
Extended Info (if available)
Real Post Cnt: 5,149
User ID: 541,776
Subject: My Decal Sample Plugin and the same plugin converted to VVS
What language are Decal and decal plugins written in? C++? C#?

 

-----signature-----
Chazcon - Aluvian swordsman
You say, "FOR THE VITAE!"
Ru tells you, "CHAZ!"
Simply Red tells you, "I am SO not recovering your body!"
-- Good times.
Link to this post
Mag-nus 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Both. You can also write decal plugins in VB6.

 

-----signature-----
Link to this post
Chazcon 
Title: FOR THE VITAE!
Posts: 5,298
Registered: Dec 11, '01
Extended Info (if available)
Real Post Cnt: 5,149
User ID: 541,776
Subject: My Decal Sample Plugin and the same plugin converted to VVS
I know C++, C# and VB not so much. Thank you.

 

-----signature-----
Chazcon - Aluvian swordsman
You say, "FOR THE VITAE!"
Ru tells you, "CHAZ!"
Simply Red tells you, "I am SO not recovering your body!"
-- Good times.
Link to this post
Mag-nus 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Check out the link in my sig, it has C# code.

If your plugin needs a view (views are not required for plugins), personally I think its much easier to just write it straight for Virindi View System (VVS).

Decal Views are very slow and cause client crashes.

Virindi does offer a wrapper to convert decal views to virindi views but its quite complex. If you don't understand how interfaces work then really you're just copying/pasting and hoping all works.

Virindi Views are fast and stable and just about everyone runs them now.

The plugin in my link has code my plugin that uses only virindi views. I think its much easier to understand/follow.

Also, whatever view system you write, your plugin logic shouldn't depend on your view objects. Your view may or may not load, may crash, etc.. Your plugins functionality should work with or without views.

Code your logic and views separately. Then create a view manager object that takes one of your functional objects as a parameter, and your view object as a parameter. This new view manager has the responsibility of updating the view as well as updating your functional objects with user input from the view.

This is proper technique. If you're just learning though, you'll probably just reference your view directly from your logic objects, which for learning, is just fine. happy You can refactor it later if you have OCD like me. happy

 

-----signature-----
Link to this post
Hazridi 
Posts: 8,386
Registered: Mar 15, '01
Extended Info (if available)
Real Post Cnt: 8,277
User ID: 74,558
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Or you can just code your logic right into the view handler classes like a real man, instead of needing 14 classes of bullshit... (I don't agree with Magnus on this issue grin )

 

-----signature-----



Hazridi of WE, VT, HG, SC
Decal Core Dev - http://www.decaldev.com - Beta at http://www.decaldev.com/beta
Link to this post
Move_HG 
Title: Automatic
Posts: 17,497
Registered: Jan 30, '01
Extended Info (if available)
Real Post Cnt: 16,339
User ID: 65,626
Subject: My Decal Sample Plugin and the same plugin converted to VVS
Hazridi posted:
Or you can just code your logic right into the view handler classes like a real man, instead of needing 14 classes of bullshit... (I don't agree with Magnus on this issue grin )


amen - not commenting on VVS or Magnus code, just code in general.

 

-----signature-----
AC FF - Debit, Credit, Heuer, Talk is Cheap
Link to this post
Mag-nus 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: My Decal Sample Plugin and the same plugin converted to VVS
*sniff sniff*

but.. but.. but it's good to decouple your logic from your GUI...

 

-----signature-----
Link to this post

Valid XHTML 1.0 Transitional Powered by PHP