Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Pages: [1] 2  All

Author Topic: DLL functions  (Read 16122 times)

0 Members and 1 Guest are viewing this topic.

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
DLL functions
« on: February 19, 2003, 08:49:30 AM »

Hi,
I have another really simple wish ;):
Calling functions from standard C++ DLLs.
As a programmer I'd like to add my own support functions for calculations and maybe some AI.

Greetings

Banbury
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DLL functions
« Reply #1 on: February 19, 2003, 01:02:13 PM »

Yes, I'm seriously thinking about this potentiality. I believe a good plugin system can greatly increase the extensibility, for example I like the way extensibility works in Unreal engine.
Of course, the problem is to design a good interface between the engine and the plugins, but I already have some ideas... :)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
Re:DLL functions
« Reply #2 on: February 19, 2003, 03:09:06 PM »

I think the easiest way would be to allow external function definitions ala Visual Basic.
The declaration could look like this:

function MyFunction(Param1, Param2) external 'mycool.dll';

You'll probably need some form of type information for the parameters and return values.

Greetings

Banbury
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DLL functions
« Reply #3 on: February 19, 2003, 03:25:43 PM »

Yes, this is the simpliest way. Indeed the type information would be necessary; also, it would only work for primitive data types.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
Re:DLL functions
« Reply #4 on: February 21, 2003, 08:09:56 AM »

Maybe it's possible to treat all parameters and return values as typeless pointers (void *). In the DLL they would be handled as pointers to classes. This way you could use complex types.
All the DLL author would need is a header file with interfaces to your type classes.

Greetings

Banbury
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DLL functions
« Reply #5 on: February 21, 2003, 08:57:13 AM »

Right, but I wouldn't want to publish directly the WME's internal classes. I think it would be better to make some simplified "proxy" classes, to encapsulate the objects exposed by the engine.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DLL functions
« Reply #6 on: March 31, 2003, 06:07:11 PM »

OK, I'm working on a simple DLL interface right now. You'll be able to run a single function from a specified DLL library just the way described in one of the above posts.
More comprehensive plugin support will follow in the future...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
Re:DLL functions
« Reply #7 on: April 01, 2003, 10:07:48 AM »

Hooray! I'll promise to write a neat DLL as soon as this feature is available.  ;)
Oh, and it would be nice to have the window handle (HWND) or better the device context (HDC) of the backbuffer as a WME constant.  ;D

Greetings

Banbury
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:DLL functions
« Reply #8 on: April 02, 2003, 04:42:53 PM »

Whew, it seems to be working now 8) I'll release it sometime later this week, because while I was modfying the script compiler I decided to (finally!) add a switch command. I'm so tired of that "if else if else if else if ..." mess  ;)


Oh, and it would be nice to have the window handle (HWND) or better the device context (HDC) of the backbuffer as a WME constant.  ;D
Well, I could publish the HWND of the WME's main window, but I can't offer a HDC, because there is no HDC when the engine runs in an accelerated mode (Direct3D 8 doesn't provide device contexts anymore), so no direct drawing into the backbuffer, sorry. The planned advanced plugin support will (probably) allow you to use a WME sprite as a simplest drawing element, it should be enough (?). I'm afraid a direct acces to the back buffer will not possible because of the duality of WME's redering subsystem...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
Re:DLL functions
« Reply #9 on: April 03, 2003, 09:00:35 AM »

Hi,
this sounds good. And I missed the switch statement, too.  ;)

Maybe it's possible to provide functions to convert a sprite to a HBITMAP and back. This way one could modify the sprites with GDI before sending them back to the engine.

Greetings

Banbury
Logged

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re:DLL functions
« Reply #10 on: April 03, 2003, 05:18:09 PM »

Wow, "real" coders here! I wish, I understood all this stuff, although I read these terms several times when playing (fooling) around with VC++ and DirectX. (Actually I just didn't understand the code I ripped from anywhere...  :-X)

@Banbury: I'd be very interested, what's possible with that dll support. It would be GREAT to see a sample and maybe some explanation, what's possible, this could become a really good reason to return learning C++...

@Mnemonic: I'm sure the dll support is a great feature, but until I understand it - I'm also very thankful for the switch() command.  ;D  ;)
Logged
Mooh!

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
Re:DLL functions
« Reply #11 on: April 04, 2003, 07:47:13 AM »

Hi,
essentially the DLLs we are talking about are just a bunch of functions. These functions can contain any code you want. So there is no real limit to what you can achieve with this but your imagination. On the AGS pages you can find some pretty good examples of useful plugins for a game engine.
Now for the bad news. C++ is not an easy language to learn. And writing DLLs belongs to the advanced topics. So if you are really interested in learning how to program be prepared to invest some time (a few months at least). And get yourself some good beginners books.

If you have more questions about programming don't hesitate to ask. I'm always willing to help.

Greetings

Banbury
Logged

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re:DLL functions
« Reply #12 on: April 04, 2003, 08:09:41 AM »

essentially the DLLs we are talking about are just a bunch of functions. These functions can contain any code you want. So there is no real limit to what you can achieve with this but your imagination. On the AGS pages you can find some pretty good examples of useful plugins for a game engine.

That was the first place I started, but didn't find too much there. And then I downloaded some game and then I played and... oh well, I forgot why I was there. ;-)

Now for the bad news. C++ is not an easy language to learn. And writing DLLs belongs to the advanced topics. So if you are really interested in learning how to program be prepared to invest some time (a few months at least). And get yourself some good beginners books.

Thank you - actually C++ is not completely new to me, but I never had a good project or the time to start with. I'm in internet development, so next to PHP/ASP/etc. I'm used to some Java, and I suppose C++ won't be too difficult to learn... I hope ! ;) Thats why I would be happy to see some code examples for a simple DLL to use in WME when the next version is released, I just need some nice goal! :-)

Ok, I'll look for AGS plug-ins now. Again. Really.  ;D
Logged
Mooh!

Banbury

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 36
  • I'm a llama! Mooh!
    • View Profile
Re:DLL functions
« Reply #13 on: April 04, 2003, 08:48:13 AM »

The main differences to JAVA are pointers and the absence of a garbage collector. Getting used to pointers can be difficult (it was difficult for me at least).
All my releases come with full source code. So they should be useable as tutorials. The first thing I will try is to add new advanced datatypes like trees.

Greetings

Banbury
Logged

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re:DLL functions
« Reply #14 on: April 04, 2003, 09:04:08 AM »

The main differences to JAVA are pointers and the absence of a garbage collector. Getting used to pointers can be difficult (it was difficult for me at least).

Uh, I remember pointers from C (without ++) on my old AMIGA, you're right, I hated them. I understood them later at university - when I didn't need them anymore - but for sure I forgot that stuff.

All my releases come with full source code. So they should be useable as tutorials. The first thing I will try is to add new advanced datatypes like trees.

Great, I'm looking forward to it.
So finally to understand it the right way - is that dll support finally like a language extension for WME? Could it look like this somehow/someday ? -->

#includeDLL("weather.dll");

actor.Talk("Uh-oh... the weather seems to change...");
StartRain();
BigFlash();
actor.Talk("AAAAAAAAAH!!!!");

;)
Logged
Mooh!
Pages: [1] 2  All
 

Page created in 0.023 seconds with 21 queries.