Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Port

Pages: 1 [2] 3 4 5 6 7 ... 12
16
If somebody could give me it, I'll make a feature-frozen version (without the auto updater) that works in v21 and just includes the colorset manager, IRC system (on a new channel) and server control until BAM is ready enough to be used instead.

17
Suggestions & Requests / Larger road bricks
« on: February 02, 2014, 04:33:27 AM »
Our current road bricks can't even fit a single Jeep in one lane.



What I'm asking for is a pack of road bricks equivalent to the default ones, however much bigger.
Instead of 32x, maybe 48x, or even 64x.

Optimally, to the point of a single Jeep filling this much on a lane:



18
Modification Help / Preferred documentation style
« on: February 02, 2014, 02:18:59 AM »
What style would you prefer to document TorqueScript code in? I've gathered a few examples, however feel free to post other ones.



Raw documentation

Functions are prefixed by successive comments containing arbitrary Markdown. This is simplest and easiest form.

// Search the Array for *item* and return it's index if found, -1 otherwise.
// This function is case-sensitive.
function Array::find(%this, %item)
{
   ...
}




Dokus documentation

Similar to raw documentation, Dokus documentation is a form I made for an existing TorqueScript documentation generator.
Comments before a function start with a function header, describing the return type, name and arguments.
After this, arbitrary Markdown can be written to document/describe the function.
Finally, you can optionally include special flags starting with @.

// DocumentStorage_Collection DocumentStorage::collection(string name, [bool noCreate])
//  Searches for the collection *name* and returns it if found.
//  If none exists and *noCreate* is not specified as true, it creates one with the name and returns it.
//  With *noCreate*, -1 is returned if requesting an unexistant collection.
//
//  @see DocumentStorage::isCollection
//  @see DocumentStorage::deleteCollection

function DocumentStorage::collection(%this, %name, %noCreate)
{
   ...
}




TomDoc documentation

This style is best explained at the official site, however here is an example regardless.

// Public: Test if a point is within a field of view.
// This uses the shape's worldbox center.
//
// point - A Point3F containing a world position to test.
// fov - The angle in degrees of the field of view (defaults to 90).
//
// Returns true if within FOV, false otherwise.
function ShapeBase::isPointWithinFOV(%this, %point, %fov)
{
   ...
}




TorqueDoc documentation

This is a documentation style created by Greek2me, seemingly inspired by JavaDoc. Look up JavaDoc for further details.

//Adds an objective for the bot to complete.
//@param   objective   An object, normally a brick, for the bot to move to.
//@param   priority   The importance of this objective, 0 being the lowest priority.
//@param   callbackID   The ID for the completion callback. The callback would be "Slayer_onBotObjectiveReached_ CALLBACKID(%mini,%bot,%objective)"
//@return   bool   Whether the objective was successfully added.
//@see   AiConnection::removeObjective
//@see   AiConnection::isObjective
//@see   AiConnection::assignMiniGameObjectives
function AiConnection::addObjective(%this,%obj,%priority,%callbackID)
{
   ...
}

19
Somewhere around v17-v19, I made an add-on which let you spawn a taxi that drove around, which players could call for, get in, say their destination and get driven there (following the road network). This used the WheeledVehicle::setWheelSteering and AIPlayer::setMoveX functions. The former for actually steering, and the latter to get the former working by subtly nudging the wheels every tick. This was hacky, but it worked.

Now, in v21, WheeledVehicle::setWheelSteering is completely broken (or, at least, cannot be made to work by nudging with an AIPlayer). The only seemingly obvious way to drive around vehicles is to use the newly "fixed" behavior of AIPlayers when controlling a vehicle. Except that it sucks. A ton. Bots usually end up driving several studs off the side, which means they reach their destination a bit off to the side and start to circle it like a planet around a sun.

Please, add WheeledVehicle::setVehicleSteering(float angle) (which actually works and controls all the wheels that would be affected by a player normally) and WheeledVehicle::setVehicleDriving(float speed) (where speed is from -1.0f to 1.0f, having similar effects as making a bot control the vehicle and using ::setMoveY).

20
Off Topic / Intense TV
« on: January 16, 2014, 09:17:38 AM »
https://www.youtube.com/watch?v=cSM7EmCSkNI

Because this deserved its own topic.

21
Gallery / Newtonian camera movement
« on: January 10, 2014, 08:11:17 AM »

22
Gallery / A little preview of something I've been working on
« on: January 06, 2014, 01:27:22 AM »

23
function add(%x, %y)
{
   %a = 1;

   while (%a)
   {
      %a = %x & %y;
      %b = %x ^ %y;
      %x = %a << 1;
      %y = %b;
   }

   return %b;
}


==>echo(add(5, -3));
2
==>echo(add(100, 50));
150
==>echo(add(-999999, -65000));
-1064999


Obligatory obvious fact: Numbers where abs(n) > 999999 work just fine.
Note: That other topic about addition has nothing to do with this.

24
Modification Help / Adding two numbers
« on: January 03, 2014, 02:11:22 AM »
I'm really stuck on this problem, here's my code so far. I think it works but I'm sure I can simplify it in a few places.

function sum(%a, %b)
{
   %aa = ((%a & ~877 - %b ^ 133 << 3 / %a) & ((%a - %b) - (%a - %b))) | %a;
   %bb = ((%b ^ (%a < 0 ? %b : %a)) & ((%b - %a) - (%b - %a))) | %b;

   for (%i = 6755 & 1436; %i < %aa; %i -= -1)
   {
      %cc = addWord(%cc, mSqrt(6755 & 1437 >> ((%b - %a) - (%b - %a))));
   }

   for (%i = 6755 & 1436; %i < %bb; %i -= -1)
   {
      %cc = addWord(%cc, mSqrt(6755 & 1437 >> ((%b - %a) - (%b - %a))));
   }

   return aggregate(%cc, importantCalculation, %a, %b);
}

function importantCalculation(%x, %y, %a, %b)
{
   return %y != 0 ? importantCalculation(%x ^ %y | (6755 & 1436) >> (mSqrt((%b - %a) - (%b - %a) - (-1)) - 1), (%x & %y) << (mLog(1) + 1), %a, %b) : %x;
}

function aggregate(%list, %call, %a, %b)
{
   %count = getWordCount(%list);

   if (%count < 2)
   {
      error("ERROR: Need at least two values to aggregate.");
      return 0;
   }

   for (%i = 1; %i < %count; %i++)
   {
      if (%i == 1)
      {
         %a = getWord(%list, 0);
      }

      %a = call(%call, %a, getWord(%list, %i), %a, %b);
   }

   return %a;
}

function addWord(%list, %word)
{
   if (%list $= "")
   {
      return %word;
   }

   return %list SPC %word;
}

25
Modification Help / Problems with phi in line transformation
« on: January 01, 2014, 10:00:44 AM »
I have a StaticShape object using a model sized 1 by 1 by 1 Torque units, which I'm trying to translate and scale to form a line between two points. I've done this successfully using position and rotation when the line is created, but that's a sub-optimal solution since I'd like to do it with setTransform to move an existing line. I have also succeeded doing this with the object scaled on the Z axis (width width lineDistance), albeit that's not viable since Torque Game Engine refuses to render the shape at certain angles when scaled as such.

function StaticShape::transformLine(%this, %a, %b, %size)
{
   if (%size $= "")
   {
      %size = 0.2;
   }

   %vector = vectorNormalize(vectorSub(%b, %a));
   %vector = vectorCross("0 0 1", %vector);

   %v1 = getWord(%vector, 0);
   %v2 = getWord(%vector, 1);
   %v3 = getWord(%vector, 2);

   %theta = mATan(%v3, mSqrt(%v1 * %v1 + %v2 * %v2));
   %phi = -mATan(%v1, %v2);

   %matrix = matrixCreateFromEuler(%theta SPC 0 SPC %phi);
   %position = vectorScale(vectorAdd(%a, %b), 0.5);

   %this.setTransform(%position SPC getWords(%matrix, 3, 6));
   %this.setScale(vectorDist(%a, %b) SPC %size SPC %size);
}


This works correctly for setting the theta rotation, but fails on orienting by phi at all (it stays horizontal at all times). An example can be seen below.



A line is being created between the player object and the top brick on the stack. Notice how it's phi angle is perfectly level, instead of being properly rotated.

26
93.160.176.186:28000

You will be assigned a BLID sequentially, reserved for your name.

27
Gallery / Sudden extremely pretty effect
« on: December 30, 2013, 02:11:30 PM »


Basically, I just needed to visualize my trajectory for a jump pad and decided to just use the debug code from my raycast weapon lag compensation script without the scheduled deletion. Didn't expect it to be this pretty.

28
Help / Fixing a server having "---" ping
« on: December 30, 2013, 12:28:23 PM »
Before the UPnP update, all servers had a ping and a connection message like this:

Connecting to 1.2.3.4:28000
Sending challenge request...


And that it's. Now about half of running servers have "---" ping and get stuck on an arranged challenge request (why in the world was this added, by the way?) while connecting.

Recently this has been happening to my server and I have no clue why.

  • ✓ Port 28000 forwarded to the correct local IP on UDP.
  • ✓ UPnP disabled in Blockland and in the router itself (I've also tried with it enabled in the router).
  • ✓ Blockland executable and port 28000 on UDP explicitly allowed in firewall settings.
  • ✓ No kind of third-party antivirus or firewall software.
  • ✓ No kind of "Hamachi" tunneling software or similar.

(no, this is not related to the authentication issues going on at the time of this post)

29
Repository: https://github.com/portify/jettison
Download: https://github.com/portify/jettison/archive/master.zip
Clone: https://github.com/portify/jettison.git

Jettison (v3.0.1)

Jettison is a simple JSON parser in TorqueScript, which should be standards-compliant in terms of JSON syntax and data types (supports null, bool, number, string, hash, array).
It can parse (into TS strings and objects), manipulate (editing parsed objects) and serialize (dump to JSON) arbitrary JSON data.

How simple?

%json = parseJSON("...");
if (%json $= "") return error("parsing failed");
// ...
if (isJSONObject(%json)) %json.delete();


Null, booleans, numbers and strings are represented as you might expect.
Hashes and arrays are custom objects with simple access to the data they contain.

For the given JSON:

[
  {
    "id": 6693533,
    "name": "jettison",
    "full_name": "portify/jettison",
    "owner": {
      "login": "portify",
      "id": 1732901,
      ...
    },
    "private": false,
    "html_url": "https://github.com/portify/jettison",
    "description": "A JSON parser written in TorqueScript.",
    "fork": false,
    "url": "https://api.github.com/repos/portify/jettison",
    ...
    "size": 284,
    "stargazers_count": 1,
    "watchers_count": 1,
    "language": "C#",
    "has_issues": true,
    "has_downloads": true,
    "has_wiki": true,
    "forks_count": 0,
    "mirror_url": null,
    "open_issues_count": 1,
    "forks": 0,
    "open_issues": 1,
    "watchers": 1,
    "default_branch": "master",
    "master_branch": "master"
  },
  ...
]


It can be manipulated in the following way:

==>$j = parseJSON("...");
==>echo($j.item[0].description);
A JSON parser written in TorqueScript.
==>echo($j.item[0].owner.login);
portify
==>echo("GitHub" SPC ($j.item[0].has_wiki ? "is" : "is not") SPC "lying!");
GitHub is lying!


Autogenerated documentation

30
Modification Help / Torque Markup Language Reference
« on: December 23, 2013, 02:27:12 PM »
Since I had nothing better to do, here you go.

http://gist.io/8103673

I'm pretty sure I missed like one or two tags.
I still haven't figured out what the TML equivalent of 0x11 is.

Pages: 1 [2] 3 4 5 6 7 ... 12