Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Classes #87730
08/27/06 14:24
08/27/06 14:24
Joined: Oct 2003
Posts: 246
A
Alberto Offline OP
Member
Alberto  Offline OP
Member
A

Joined: Oct 2003
Posts: 246
Hello

Is it possible to expose a C++ class to 3dgs cscript?
I mean :

- To create a class in C++
- To create an instance of the class
- To call a method from cscript

Thanks in advance

Re: Classes [Re: Alberto] #87731
08/27/06 14:43
08/27/06 14:43
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
no, you can't directly expose classes. you will have to do non-object oriented wrapper functions.

Re: Classes [Re: ventilator] #87732
08/27/06 23:00
08/27/06 23:00
Joined: Oct 2003
Posts: 246
A
Alberto Offline OP
Member
Alberto  Offline OP
Member
A

Joined: Oct 2003
Posts: 246
Thanks

This is what I was concerned about

Can you still full exploit C++ power and \or flexibility ?

Or

Does your code get over complicated ?

It is just a question , actually I have never used a combination of C++ and scripting language till now

Re: Classes [Re: Alberto] #87733
08/28/06 11:26
08/28/06 11:26
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Quote:

Does your code get over complicated ? I have never used a combination of C++ and scripting language till now



C-Script is not a comnination of c++ and a script. It is just a script language, having a very similiar syntax to c, and therefore even to c++. The big big difference is, that C++ is object oriented. C-Script isn't. That means you won't ever have things like encapsulation or inheritence. Of course this makes programming a little more complicated. Wit oop you can have a cleaner design and write more secure code.

Though it does not influence flexibility. You can do almost everything with c-script, but in my opinion you need some experience in order to write clear, stable and complex scripts.


Always learn from history, to be sure you make the same mistakes again...
Re: Classes [Re: Alberto] #87734
08/28/06 13:37
08/28/06 13:37
Joined: Nov 2002
Posts: 825
from the 'Burgh to Denver
CBuilder2 Offline
Developer
CBuilder2  Offline
Developer

Joined: Nov 2002
Posts: 825
from the 'Burgh to Denver
Quote:

Thanks

This is what I was concerned about

Can you still full exploit C++ power and \or flexibility ?

Or

Does your code get over complicated ?

It is just a question , actually I have never used a combination of C++ and scripting language till now




Alberto,

I have attempted to do this. It just gets too messy and over complicated. The problem is the A6 architecture still only supports the "old school" Win32 API style dlls. If it actually supported COM, it would be much easier.

CBuilder


Total_Stupidity = (Ben_Roethlisberger + Motorcycle) - Helmet
Re: Classes [Re: CBuilder2] #87735
08/28/06 17:07
08/28/06 17:07
Joined: Oct 2003
Posts: 246
A
Alberto Offline OP
Member
Alberto  Offline OP
Member
A

Joined: Oct 2003
Posts: 246
CBuilder

Thanks
Do you mean in general or just for accesing Directx methods ?
I would like to use C++ just for some AI applications ( FSM, neural.. etc)
For rendering, gameplay,collision etc I keep usinc cscript
What do you think ?

Re: Classes [Re: Alberto] #87736
09/06/06 15:27
09/06/06 15:27
Joined: Nov 2002
Posts: 825
from the 'Burgh to Denver
CBuilder2 Offline
Developer
CBuilder2  Offline
Developer

Joined: Nov 2002
Posts: 825
from the 'Burgh to Denver
Quote:

CBuilder

Thanks
Do you mean in general or just for accesing Directx methods ?
I would like to use C++ just for some AI applications ( FSM, neural.. etc)
For rendering, gameplay,collision etc I keep usinc cscript
What do you think ?




Alberto,

I would create classes for all of the messy structures and API functions. So, one would not have to do the following:

myEnt.Pan+= INT2FIX(20);

Instead:

// In the class method, do the conversion under the hood.....
// To the outside world, it is an int.....
myEntClass.Pan+=20;

The big chunk of work is sitting down and figuring out a class structure; beyond that, most of the work is tedious wrapping of the structures and methods.

Finally, I would put it in a static LIB or DLL and just use it in your games. I just found it too messy. I really wish they had just used classes instead of functions and structures..... They did exist in C++ when the original A4 code was written.

Rich


Total_Stupidity = (Ben_Roethlisberger + Motorcycle) - Helmet
Re: Classes [Re: CBuilder2] #87737
09/12/06 10:55
09/12/06 10:55
Joined: Apr 2006
Posts: 36
Minneapolis, MN
guanohead Offline
Newbie
guanohead  Offline
Newbie

Joined: Apr 2006
Posts: 36
Minneapolis, MN
You can use the SDK to setup a link between C++ DLL's and 3DGS. You can write classes as you wish in C++ and just have a REFERENCE member WITHIN the class to the entity pointer in 3D Game Studio. Finally, you write wrappers for whatever you want to do in C++ such as tracing and moving.

In this way, you can use 3DGS as a simple environment for testing out different AI and whatnot in C++.

It's a bit of work to learn and stup, but once you have that you can use the same base code for lots of different things. Check out the SDK!

Re: Classes [Re: guanohead] #87738
09/15/06 19:04
09/15/06 19:04
Joined: Oct 2003
Posts: 246
A
Alberto Offline OP
Member
Alberto  Offline OP
Member
A

Joined: Oct 2003
Posts: 246
Quanohead

It seems very interesting but I am not sure to have fully understood
Any example, tutorial available ?

Re: Classes [Re: Alberto] #87739
09/15/06 21:02
09/15/06 21:02
Joined: Jan 2003
Posts: 160
Game Wizard Offline
Member
Game Wizard  Offline
Member

Joined: Jan 2003
Posts: 160
You can create an mfc dll with all of your game logic in it using c++. The minimum script you need is 3 functions of about 3 statements each: for the main startup call, event handler, and the entity added calls. If you want, you can also subclass the main window in the dll and do your own windows event handling. It's not that hard if you have enough c++ and program development experience.

Last edited by Game Wizard; 09/15/06 21:03.
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1