• Welcome to Battlezone Universe.
 

News:

Welcome to the BZU Archive dated December 24, 2009. Topics and posts are in read-only mode. Those with accounts will be able to login and browse anything the account had access granted to at the time. No changes to permissions will be made to be given access to particular content. If you have any questions, please reach out to squirrelof09/Rapazzini.

Main Menu

Spinoff: Uncle Avatar's Scriptor, C++ and Python Time...

Started by General BlackDragon, April 23, 2008, 06:03:45 PM

Previous topic - Next topic

OvermindDL1

#30
Very different.
C is a newer B (Yes there was such a language, was made for system management, C was made for making systems :P)
C++ is C with classes and templates (and a few more things now, but it started as just C with Classes).
C# is Microsoft's version of Java, quite literally that is what it was designed as.  It is far far far more like Java then it is C++.

Just remember this about C/C++, there is no 'higher-level' (yes, technically C/C++ are higher level languages) language that maps as close to assembly, because of that it is fast, because of that you can make it do just about everything, things no other language could really ever hope to do, but because of that it can be very ugly at times.  It is one of those languages that you may not be able to do something in it as fast as you could in Java or Python or what-not, but once you learn it, learn how it works, and *especially* get a good library built of of things you commonly use, then you can program circles around most other languages, probably the only language that could beat it in customizability would be Lisp.  Quite literally though, because of the libraries I use I can generally program near anything in less code then Python (and especially Java, I think anyone who thinks coding in Java is shorter then C++ is an utter retard, I have yet to see any real code made in Java that is shorter then it's C++ counterpart), takes about the same time to actually program, and runs orders of magnitude faster.  It is one of those languages that once you learn/master you look at near every other language in disgust, only using them for a singular feature or two that may make a certain quick script or app quicker to make... and yet I still learn near every language I can, learning is too addictive. :P

Quick example of its customizability.  One of the main things about other languages like Java, Python, C#, etc... is memory management, most people say that C++ has none; that is true, to an extent, it is more proper to say that it is not 'built-in (and even that is false, the next version of the C++ standard supports a pluggable memory management model, at least I think it was accepted... proposed anyway), but if you want a simple memory management model, shared_ptr<SomeClass> fixes that, or if you want something a little bigger then plug in the Hans Boehm Collector to do most of it for you.  So on and so forth...


Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


Nielk1

Quote from: OvermindDL1 on May 12, 2008, 06:56:35 PM
Very different.
C is a newer B (Yes there was such a language, was made for system management, C was made for making systems :P)
C++ is C with classes and templates (and a few more things now, but it started as just C with Classes).
C# is Microsoft's version of Java, quite literally that is what it was designed as.  It is far far far more like Java then it is C++.

What is J#? I noticed J# seemed to be Microsoft's Java.

Two things I am still getting used too: pointers and working old code. Java had neither.

Click on the image...

OvermindDL1

J# Is more of a scripting language which I thought they killed off long ago.

And Java is nothing *but* pointers, you work with them all the time, you just cannot get direct access to the pointer value itself, one of the ways it is restrictive.  C++'s 'pointer magic' may be one of the harder things to read in C++, but it makes for *very* fast code, and as such is generally only used for tight loops where that tight optimization can give huge benefits.

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


bigbadbogie

one thing i want to know - is c++ anything like the dll scriptor?? not the same commands obviously but is it written in the same context??
Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

OvermindDL1

The command names are similar, but the style is not, BS-er's scriptor is more like Assembler, my Python BZ2 scriptor is more like C++ (but with curly-brackets?).

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


bigbadbogie

damn - oh well - i am good at the scriptor and i thought there might be 1 chance in a million that c++ might be anything like it

there goes my future as a programmer  :cry:
Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

Nielk1

I think in loops, so, this works best for me. The scriptor (BS-er's) seems so linear.

I'm learning, and I'm having fun.

Click on the image...

Russian Roulette

Quote from: bigbadbogie on May 13, 2008, 04:05:47 AM
there goes my future as a programmer  :cry:

http://www.cprogramming.com

This may help you understand c/c++, but you have to be willing to read(a lot) :D
you first need a c/c++ compiler (visual basic, dev-C++ etc.)

Have fun :P
RR

bigbadbogie

Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

OvermindDL1


bigbadbogie

Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

Nielk1

I was trying to make something rather dynamic that would set the hover height of each craft to a value randomly between the max and min set in the ODF. I found that to pull this off I would need to dynamically generate a new odf for each new unit.

I have decided to instead make the ODF list a series of alternate ODF names that the DLL will load randomly. This way I can cause variation in more than just hover height, but in simulated pilot skill by changing other physics properties on the ships. The cause for the original idea was for an easy to use (ODF maker end) system for populating a space map with ships in 3 dimensions rather than 2.

I will be sure to post the new code when I am done since it may be useful to many.

Click on the image...

BS-er

Quote from: Sonic on April 24, 2008, 09:22:54 AM
I like the scriptor's linear fashion for SP missions.

That was an absolute necessity given that it had to be simple enough for a nonprogrammer to use and use well.  It was quite satisfying to see the first gang of newbies tinker with it for awhile and came up with some nice missions in a small amount of time.

Even though I am a programmer I liked that approach for single player as well, and would much rather use the Scriptor than make a C++ DLL for SP.  Its limitations never really stopped me from making the mission I wanted to make.

While on the subject, I don't quite know how things are with the latest BZ2.  Has the Scriptor lost compatability?  Are there new features that the Scriptor doesn't support?  If so I'll try to find some time to do an update, but I'll need help from the regulars to guide me.

OvermindDL1

#43
Yes, just check the bottom of scriptutils.h for all the new functions and implement them and that should be good for everyone. :)
All functions that were previously in the scriptutils.h file are all still binary compatable, and I made a header that lets you dynamically link in all things, old and new, in the style that yours was, so if you do not want to add things manually, I can just give you my updated file, save you a lot of time.

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


Nielk1

OK here is some code for you all:

For the Header:
#include <vector>
public:
void queueLoopAnim(Handle h);
void startLoopAnim();
std::vector<Handle> waitingToLoopObjects;
std::vector<char*> waitingToLoopNames;
std::vector<float> waitingToLoopTime;


For CPP:
void instantMission::queueLoopAnim(Handle h)
{
char ODFName[64];
if(GetObjInfo(h, Get_CFG, ODFName)) //is a game object check (double duty to ODFName)
{
GetObjInfo(h, Get_ODF, ODFName);
char *loopAnimationName = new char[64];
float loopAnimationDelay;
OpenODF(ODFName);
GetODFString(ODFName, "GameObjectClass", "loopAnimationName", 64/*0*/, loopAnimationName);
GetODFFloat(ODFName, "GameObjectClass", "loopAnimationDelay", &loopAnimationDelay);
CloseODF(ODFName);
loopAnimationDelay *= m_GameTPS;
if((loopAnimationName != 0) & (loopAnimationDelay > 0))// not null
{
waitingToLoopObjects.push_back(h);
waitingToLoopNames.push_back(loopAnimationName);
waitingToLoopTime.push_back(loopAnimationDelay);
}
}
}
void instantMission::startLoopAnim()
{
for(int x = 0; x < waitingToLoopObjects.size(); x++)
{
--waitingToLoopTime[x];
if(waitingToLoopTime[x] < 0)
{
SetAnimation(waitingToLoopObjects[x],waitingToLoopNames[x], 0);
StartAnimation(waitingToLoopObjects[x]);
for(int y = x; y < (waitingToLoopObjects.size() - 1); y++)
{
waitingToLoopObjects[y] = waitingToLoopObjects[y + 1];
waitingToLoopNames[y]   = waitingToLoopNames[y   + 1];
waitingToLoopTime[y]    = waitingToLoopTime[y    + 1];
}
x--;
waitingToLoopObjects.resize(waitingToLoopObjects.size()- 1);
waitingToLoopNames.resize(  waitingToLoopNames.size()  - 1);
waitingToLoopTime.resize(   waitingToLoopTime.size()   - 1);
}
}
}
void instantMission::AddObject(Handle h)
{
...
queueLoopAnim(h);
}
void instantMission::Execute(void)
{
...
startLoopAnim();
}


This code is for pb4, so you know. It reads the custom lines
loopAnimationName = "" //name of animation for loop play
loopAnimationDelay = 0 //home long to wait to activate animation (good to prevent interference with deploy animation)

Click on the image...