MMO Plugin

Started by Yuri Patrick, Tue 24/08/2010 09:32:32

Previous topic - Next topic

Yuri Patrick

I'm trying to write a plugin in C# which will enable a custom networking system for a MMO idea I have. I can't even find a copy of the source code for the TCP/IP plugin anymore. So, as such, have little idea of where I need to go with this. I believe, though, that the TCP/IP plugin makes use of script plugins so that the connection can be initialized during game start and utilized throughout the rest of the game.

Is there a tutorial on script plugin modules? Adding menus and such to the editor is easy, but getting past that, I am having trouble. Please help?

Yuri Patrick

Ugh. If I am reading this correctly, then in the tutorials section it is stating that something such as the TCP/IP plugin would have been written in C++ so that it could be included with the game itself for runtime. Which means that I have to re-learn C++. Been a long time since I worked with that. And as such, C# can only be used for Editor plugins and not game plugins. That kinda stinks. Oh well. :)

Now to try and figure out how to influence the scripting language via C++ plugin. ;)

I wonder if it is possible to mix C++ and C# in the same dll...? Just thought of that and how much more convenient it would make the end product as it would appear as a single plugin still then. Hrm.

Wonkyth

C# can be used for in-game plugins, I think, it's just a little more complex...
"But with a ninja on your face, you live longer!"

Yuri Patrick

Thanks WOnkyth. Now I have a new train of thought... I have done some further research on the server base that I wish to use for my game. I was considering using SmartFox, but am getting severely deterred as all of their tutorials are for FLASH clients. Flash has taken over all of a sudden. It has taken me all day and all night to find RakNet. New question, though, since this is going to be a straight up tcp/ip connection between the client and the server, do I really need extra functionality or do you think the standard AGS TCP/IP plugin would be enough?

Wyz

#4
I read in an other topic that you're trying to incorporate SmartfoxServer. Well I've never heard of it but I've done some research for you. ;)

Apparently the original server was meant to connect with flash applications, but due to it's popularity (so they say) it has been ported to several other code-bases. Unfortunately not to C++. You can program it yourself but that would be a lot of work and you need to be an advanced C++ programmer.
You could use the TCP/IP plugin to port it directly to AGS, still a lot of work.
Now on the other hand there is a C# port available you can use, you don't need to do anything with sockets because that is what the client API takes care of. Well, C#? Yes, someone made a C# wrapper for AGS some time ago. You can use it to incorporate the C# SmartFox Client into AGS! You still need to be a moderate to advanced C# programmer to be able to do this I reckon.

For your convenience:
C# Wrapper for AGS
.Net Smartfox Client API
Life is like an adventure without the pixel hunts.

Yuri Patrick

Thank you so much, Wyz. I don't have to wait for Raknet to download no. ;)

However, looks like I still have much to learn, like how to properly google for stuff. LOL. Thanks again. :)

tzachs

You can also use my C# Runner Plugin which uses the c# wrapper and allows you to run simple methods without having to worry too much about the registrations and such...

Yuri Patrick

tzachs, I'm starting to think that AGS has a new AI subroutine that states it must stop me and only me at all costs. :( I can't find the stupid IAGSEngine call anywhere in the AGS wrapper for my own plugin so I figured I would try yours, and I got the following error:

Code: ags
Error: The type initializer for 'agspluginPINVOKE' threw an exception.
Version: AGS 3.1.2.82

System.TypeInitializationException: The type initializer for 'agspluginPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'PluginAPIWrapper.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at agspluginPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_agsplugin(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
   at agspluginPINVOKE.SWIGExceptionHelper..cctor()
   --- End of inner exception stack trace ---
   at agspluginPINVOKE.SWIGExceptionHelper..ctor()
   at agspluginPINVOKE..cctor()
   --- End of inner exception stack trace ---
   at agspluginPINVOKE.IAGSEditor_RegisterScriptHeader(HandleRef jarg1, StringBuilder jarg2)
   at IAGSEditor.RegisterScriptHeader(String header)
   at AGSPluginSharp.AGSPlugin.EditorStartup(IAGSEditor editor)
   at AGSPluginSharp.AGSExports.AGS_EditorStartup(IntPtr lpEditor)
   at AGS.Editor.NativePlugin.AGS_EditorStartup.Invoke(IAGSEditorForNativePlugins editor)
   at AGS.Editor.NativePlugin.StartPlugin()
   at AGS.Editor.NativePlugin.set_Enabled(Boolean value)
   at AGS.Editor.Components.PluginsComponent.CommandClick(String controlID)
   at AGS.Editor.GUIController._mainForm_OnMenuClick(String menuItemID)
   at AGS.Editor.ProjectTree.ContextMenuEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


The problem with that error message is that the PluginAPWrapper.dll file is in my AGS directory along with the AGSRunCSharpPlugin.dll file. :(

I don't get this.

Yuri Patrick

Alright. What version of AGSEditor is your plugin for, Tzachs? I just tried opening demo for the C# runner and it gives me the exactg same error from the demo. Perhpas my copy is either corrupt or the wrong version? Lemme try running it off of AGS 3.1.

Calin Leafshade

have you copied the wrapper to your games debug and compiled folders?

AGS only copies the main plugin and not any dependencies it may have (like the wrapper)

Yuri Patrick

*sigh* Calin, it's meant as a compliment, really, but you keep making me feel dumber and dumber. I never would have thought of that. It's not even written anywhere that I have searched that any dependencies need to go further down the filestructures. ;)

Thanks. :)

Yuri Patrick

#11
*ROWR* It's still giving my a nutty time. New error and it won't let me cut and paste the error code. So, I'll just try to give the important bits, and I did copy the wrapper to the game directory, the _debug and compiled directories and now it is telling me:

Code: ags
The type initializer for 'agspluginPINVOKE' threw an exception.


It also turns around and says it still can't find the stupid dll:
Code: ags
System.DllNotFoundException: Unable to load DLL 'PLuginAPIWrapper.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E)


Seriously, I'm getting ready to cry over this. I need a Priest to Exorcise my computer. It's been doing wierd things like this all week. ;)

Anyway, here's some more info:
Code: ags
C:\Documents and Settings\Fr. Esau.PATRICK\Desktop\AGSRunCSharpPlugin\AGSRunCSharpPlugin\Demo\Source\RunCSharpPluginDemo\PluginAPIWrapper.dll
for the first location of the wrapper...

Code: ags
C:\Documents and Settings\Fr. Esau.PATRICK\Desktop\AGSRunCSharpPlugin\AGSRunCSharpPlugin\Demo\Source\RunCSharpPluginDemo\_Debug\PluginAPIWrapper.dll
for the second location and the third is:

Code: ags
C:\Documents and Settings\Fr. Esau.PATRICK\Desktop\AGSRunCSharpPlugin\AGSRunCSharpPlugin\Demo\Source\RunCSharpPluginDemo\Compiled\PluginAPIWrapper.dll
so that you can see for yourself that this silly dll is in all the right places. :(

Is it possible that the plugin could have corrupted somewhere along the line? I tried running the demo game and it still gives me more errors. :(

Code: ags
An exception 0xE0434F4D occured in ACWIN.EXE at EIP = 0x7C812AFB; program pointer is -23, ACI version 3.12.1074, gtags (0,0)

AGS cannot continue, thsi exception was fatal. Please note down the numbers above, remember what you were doing at the time and post the details on the AGS Technical Forum.

tzachs

Sorry for not answering sooner, only seen this now...

If I understand correctly, there are two problems here, one with running the demo binaries and one with the sources...

As for running the demo from the Binaries folder, all the dlls are already there, so that shouldn't be the problem. Is it possible that you didn't install the VC++ 2010 redist?

As for running the source, at what point did you receive the error?
Make sure that you placed the plugin dll and the wrapper dll in the AGS folder itself too (I.E c:\program files\AGS...) and then load the plugin in the editor before running it.
I indeed made it in 3.1 but it doesn't sound like the problem from your errors.

Yuri Patrick

*ROWR*! Stupid Microsloth. ;) I had no clue about that VC++ 2010 Redistro, now it works all around. Thanks. :)

SMF spam blocked by CleanTalk