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.


Messages - Nexus

Pages: 1 2 3 [4] 5 6 7 8 9 ... 238
46
You will probably want to have two datablocks, one for each state of the vehicle, and then just switch between them.
In torque, 1 vs true vs "true" doesn't matter.
Your output event is going to look for a function that has classname::functionname as its identifier.  I am not sure exactly which vehicle class type is default for events, but you can look that up by looking at other vehicle events.
For functions such as GravityJeepVehicle::onadd(%this, %obj), I am pretty sure %this refers to the vehicle, and %obj refers to the object being added to the vehicle, such as  a person jumping into it, but %this might refer to the datablock instead, so I wouldn't trust me.

47
Modification Help / Re: Blockland Glass [Release]
« on: October 13, 2015, 09:54:09 PM »
Looks really cool!  I have been working a bit with html 5 boilerplate too, I would love to contribute.  I don't know how much help I will be since I am still getting up to date with php, but I'll definitely stay tuned.

48
Development / Re: 2015/10/13 - The Forgettable Dungeon - Kickstarter
« on: October 13, 2015, 09:17:39 PM »
Do you have mod support planned/implemented?

Also is your source code going to be locked down like it is with Blockland or will some source code be available for beta testers?

49
Modification Help / Re: How do I make addons?
« on: October 09, 2015, 07:23:52 PM »
Find some add-ons that look interesting or do something similar to you want to do, open them up, and take a look.  You can read any .cs or .gui file with just a text editor.

50
Modification Help / Re: Silly Torque, that's not an array!
« on: October 09, 2015, 07:17:17 PM »
if the first ever collision found for sha1 was in coordinates for blockland I'll eat my hat
'sides how are you gonna convert from sha1 to coordinates?

https://sites.google.com/site/itstheshappening/

51
Add-Ons / Re: Blockland Glass Mod Manager
« on: October 07, 2015, 01:00:15 AM »
Ok. I have addons I made that I want to upload to the mod manager but there are no sections for Decals or Sounds. Wtf?

Put decals under prints, sounds are questionable but Jincux has said that he doesn't want to deal with people violating copyright by uploading music so he left it out.

Also I think it would be a good idea to reduce the number of moderators needed to approve a mod from 5 to 3.

52
Modification Help / Re: What are some good optimization tips?
« on: October 01, 2015, 01:30:59 AM »
If you are looking for significant performance improvements, you want to try to do three things.
1. Improve the actual asymptotic runtime of your code.
2. Try to use built in functions instead of writing it in torque.
3. Cache stuff

To improve the asymptotic runtime of your code, you need to actually understand how algorithms work and how to determine if something can be done faster.  For example, if you want to sort an array, you can easily do it by finding the largest number in O(n) time, then finding the next largest, and so on until the array is sorted.  However, this results in O(n^2) runtime.  If you implement a real sorting algorithm such as quicksort, you can do this in O(nlogn) time, which is much faster.

You really don't want to actually sort a large list using torquescript.  TS is super slow.  You should not write your own substring method when you can just use the built in getsubstr() method.  Similarly, there is a built in sorting algorithm available to objects with the class GUITextListCtrl.  Making a function that puts your data into a GUITextListCtrl and calls .sort() on it is much faster than actually sorting it yourself.

The easiest way to improve the speed of your code is to cache results that you know you will use over and over again.  Torque global variables are hashed and don't really slow down even when when you are using millions of them.  Go ahead and store whatever data you think might be useful in a $globalvar.  However, using global objects is considerably slower.

You should absolutely NOT worry about the size of your source code.  Trying to minimize your code just makes it harder for yourself and others to understand and maintain it later down the road.

53
Add-Ons / Re: Escape Overlay Released [NARG]
« on: September 30, 2015, 02:05:27 PM »
I restarted the game, and the glitch is fixed. Just incase, here's the files and the list:
http://justfilehosting.space/download.php?f=afhde
http://pastebin.com/eqpF01Rz

You have quite a few things editing your main menu.  I would venture a guess and say that the zetro theme may have been part of the problem, but if the issue is fixed then I guess we will never know.

54
Add-Ons / Re: Escape Overlay Released [NARG]
« on: September 30, 2015, 12:52:29 PM »
the Credits button is now a flat red block


Can I have a list of the client add-ons you are currently using?

Also if you can put the following into console and send me the resulting file that would be super helpful:

Code: [Select]
MainMenuButtonsGui.save("config/mainmenubuttonsgui.txt");
This will dump your main menu buttons into a file located in your config folder.

55
Modification Help / Re: Rotating Vectors
« on: September 30, 2015, 01:06:26 AM »
You should look into transformation matricies: https://en.wikipedia.org/wiki/Transformation_matrix

If you don't want to use trig because you don't know it, then just remember that whatever you end up doing will be equivalent to using trig because math doesn't change just because you use a different process.  You might as well learn it.

56
Add-Ons / Re: Escape Overlay Released [NARG]
« on: September 30, 2015, 12:53:39 AM »
I have 3 updates for you guys.

1. The Escape Overlay has been updated to version 1.0 Full.  This version includes some pre-sized icons that it chooses between instead of relying on torque's built in image resizing.  I have also revamped the options menu and made it so you can choose your transparency on the background.
Download: https://dl.dropboxusercontent.com/u/20459676/Client_NEO.zip

2. The File Manager has been updated to version 1.42 Full.  This version includes an extra warning message in the options menu about enabling the "Load Brickcounts" preference.  I have also updated the icon to make it look much nicer with the escape overlay.
Download: https://dl.dropboxusercontent.com/u/20459676/Client_NFM.zip

3. Server Command GUI has gotten a number of bug fixes.  It now uses greekbinds instead of the hacky keybind thing I put together years ago.  I also removed dependencies on the old rtb and added support for the escape overlay.
Download: https://dl.dropboxusercontent.com/u/20459676/Client_ServerCommandGui.zip

As always, let me know what you think and tell me if you find any issues.  Unfortunately, I am pretty busy with school so I don't think much else will be happening for quite some time.

57
Suggestions & Requests / Re: Coordinates for builds in the Bedroom?
« on: September 15, 2015, 06:07:32 PM »
I think the coordinates you are using are used to take a build made in the bedroom and load it on a flat map, not the other way around.  However, if that is your intention then those look like the right values.

58
Off Topic / Re: Taking a game programming class...
« on: September 10, 2015, 11:29:24 PM »
If you are making a 2d game then you really don't need to use weapons or any kind of violence.  Just make some kind of top down puzzle game or a sidescrolling platform game.

59
Modification Help / Re: GuiBitmapButtonCtrl::onMouseEnter
« on: September 07, 2015, 11:03:01 PM »
object.dump() will not reveal engine callbacks such as object::onMouseEnter() if they have not been defined already.  However, if you do define one of these particular callbacks, then the engine will call it for you appropriately.  The callback ::onMouseEnter() is not restricted to GuiMouseEventCtrl objects.

Here is a snippet from guiControl.h from the Torque2D engine

Code: [Select]
// Copyright (c) 2013 GarageGames, LLC
#ifndef _GUICONTROL_H_
#define _GUICONTROL_H_

/// @defgroup gui_group Gui System
/// The GUI system in Torque provides a powerful way of creating
/// WYSIWYG User Interfaces for your Game or Application written
/// in Torque. 
///
/// The GUI Provides a range of different controls that you may use
/// to arrange and layout your GUI's, including Buttons, Lists, Bitmaps
/// Windows, Containers, and HUD elements.
///
/// The Base Control Class GuiControl provides a basis upon which to
/// write GuiControl's that may be specific to your particular type
/// of game. 


/// @addtogroup gui_core_group Core
/// @section GuiControl_Intro Introduction
///
/// GuiControl is the base class for GUI controls in Torque. It provides these
/// basic areas of functionality:
///      - Inherits from SimGroup, so that controls can have children.
///      - Interfacing with a GuiControlProfile.
///      - An abstraction from the details of handling user input
///        and so forth, providing friendly hooks like onMouseEnter(), onMouseMove(),
///        and onMouseLeave(), onKeyDown(), and so forth.
///      - An abstraction from the details of rendering and resizing.
///      - Helper functions to manipulate the mouse (mouseLock and
///        mouseUnlock), and convert coordinates (localToGlobalCoord() and
///        globalToLocalCoord()).
///
/// @ref GUI has an overview of the GUI system.
///
///
/// @ingroup gui_group Gui System
/// @{
class GuiControl : public SimGroup
{
private:
   typedef SimGroup Parent;
   typedef GuiControl Children;

public:

    /// Called when a child control of the object is resized
    /// @param   child   Child object
    virtual void childResized(GuiControl *child);

    /// @name Rendering

    /// Called when this control is to render itself
    /// @param   offset   The location this control is to begin rendering
    /// @param   updateRect   The screen area this control has drawing access to
    virtual void onRender(Point2I offset, const RectI &updateRect);

    /// @name Events
    ///
    /// If you subclass these, make sure to call the Parent::'s versions.

    /// Called when this object is asked to wake up returns true if it's actually awake at the end
    virtual bool onWake();

    /// Called when this object is asked to sleep
    virtual void onSleep();

    /// Do special pre-render proecessing
    virtual void onPreRender();

    /// Called when this object is removed
    virtual void onRemove();

    /// Called when one of this objects children is removed
    virtual void onChildRemoved( GuiControl *child );

    /// Called when this object is added to the scene
    bool onAdd();

    /// Called when this object has a new child
    virtual void onChildAdded( GuiControl *child );


    /// General input handler.
    virtual bool onInputEvent(const InputEvent &event);

    /// @name Mouse Events
    /// These functions are called when the input event which is
    /// in the name of the function occurs.

    virtual void onMouseUp(const GuiEvent &event);
    virtual void onMouseDown(const GuiEvent &event);
    virtual void onMouseMove(const GuiEvent &event);
    virtual void onMouseDragged(const GuiEvent &event);
    virtual void onMouseEnter(const GuiEvent &event);
    virtual void onMouseLeave(const GuiEvent &event);

    virtual bool onMouseWheelUp(const GuiEvent &event);
    virtual bool onMouseWheelDown(const GuiEvent &event);

    virtual void onRightMouseDown(const GuiEvent &event);
    virtual void onRightMouseUp(const GuiEvent &event);
    virtual void onRightMouseDragged(const GuiEvent &event);

    virtual void onMiddleMouseDown(const GuiEvent &event);
    virtual void onMiddleMouseUp(const GuiEvent &event);
    virtual void onMiddleMouseDragged(const GuiEvent &event);

    /// @name Editor Mouse Events
    ///
    /// These functions are called when the input event which is
    /// in the name of the function occurs.  Conversly from normal
    /// mouse events, these have a boolean return value that, if
    /// they return true, the editor will NOT act on them or be able
    /// to respond to this particular event.
    ///
    /// This is particularly useful for when writing controls so that
    /// they may become aware of the editor and allow customization
    /// of their data or appearance as if they were actually in use.
    /// For example, the GuiTabBookCtrl catches on mouse down to select
    /// a tab and NOT let the editor do any instant group manipulation.

    /// Called when a mouseDown event occurs on a control and the GUI editor is active
    /// @param   event   the GuiEvent which caused the call to this function
    /// @param   offset   the offset which is representative of the units x and y that the editor takes up on screen
    virtual bool onMouseDownEditor(const GuiEvent &event, Point2I offset) { return false; };

    /// Called when a mouseUp event occurs on a control and the GUI editor is active
    /// @param   event   the GuiEvent which caused the call to this function
    /// @param   offset   the offset which is representative of the units x and y that the editor takes up on screen
    virtual bool onMouseUpEditor(const GuiEvent &event, Point2I offset) { return false; };

    /// Called when a rightMouseDown event occurs on a control and the GUI editor is active
    /// @param   event   the GuiEvent which caused the call to this function
    /// @param   offset   the offset which is representative of the units x and y that the editor takes up on screen
    virtual bool onRightMouseDownEditor(const GuiEvent &event, Point2I offset) { return false; };

    /// Called when a mouseDragged event occurs on a control and the GUI editor is active
    /// @param   event   the GuiEvent which caused the call to this function
    /// @param   offset   the offset which is representative of the units x and y that the editor takes up on screen
    virtual bool onMouseDraggedEditor(const GuiEvent &event, Point2I offset) { return false; };

    /// Occurs when the first responder for this chain is lost
    virtual void onLoseFirstResponder();

    /// @name Keyboard Events

    /// Happens when a key is depressed
    /// @param   event   Event descriptor (which contains the key)
    virtual bool onKeyDown(const GuiEvent &event);

    /// Happens when a key is released
    /// @param   event   Event descriptor (which contains the key)
    virtual bool onKeyUp(const GuiEvent &event);

    /// Happens when a key is held down, resulting in repeated keystrokes.
    /// @param   event   Event descriptor (which contains the key)
    virtual bool onKeyRepeat(const GuiEvent &event);

    /// Occurs when this control performs its "action"
    virtual void onAction();

    /// @name Peer Messaging
    virtual void onMessage(GuiControl *sender, S32 msg);    ///< Receive a message from another control

    /// Called if this object is a dialog, when it is added to the visible layers
    virtual void onDialogPush();

    /// Called if this object is a dialog, when it is removed from the visible layers
    virtual void onDialogPop();
};
/// @}

#endif

60
Here is a function I wrote a while back that will make your player look at a point.
Hopefully this helps.

Code: [Select]
function lookat(%posb)
{
%posa = serverconnection.getcontrolobject().getposition();
%xa = getword(%posb, 0) - getword(%posa, 0);
%ya = getword(%posb, 1) - getword(%posa, 1);
%za = getword(%posb, 2) - getword(%posa, 2) - getword(serverconnection.getcontrolobject().getdatablock().boundingbox, 2)/5 + $iamcrouching*1.5;
%la = msqrt(mpow(%xa, 2) + mpow(%ya, 2) + mpow(%za, 2));
%pitcha = macos(%za/%la);
%yawa = matan(%xa, %ya);

%v = serverconnection.getcontrolobject().getmuzzlevector(0);
%xb = getword(%v, 0);
%yb = getword(%v, 1);
%zb = getword(%v, 2);
%pitchb = macos(%zb);
%yawb = matan(%xb, %yb);

%pitch = %pitcha - %pitchb;
%yaw = %yawa - %yawb;

$mvpitch = %pitch;
$mvyaw = %yaw;
}

This might also be useful:

Code: [Select]
//0 - East
//1 - South
//2 - West
//3 - North
function getplayerdirection()
{
if(isObject(%p = serverconnection.getcontrolobject()))
{
%va = getword(%p.getforwardvector(),0);
%vb = getword(%p.getforwardvector(),1);

if(mabs(%va) > mabs(%vb))
{
if(%va > 0)
return 0;
else
return 2;
}
else
{
if(%vb > 0)
return 1;
else
return 3;
}
}
else
return 4;
}

Pages: 1 2 3 [4] 5 6 7 8 9 ... 238