• 0

    posted a message on FPS/TPS Shooting Method (not traceline)

    @AnOddRadish: Go

    flattering,

    you can test it on my map

    search SlayerCraft on bnet, kill zombies have fun

    Posted in: Triggers
  • 0

    posted a message on FPS/TPS Shooting Method (not traceline)

    I created a new method for calculating hit/miss shots for shooter type maps a while back. Simply, I compare the players camera angle with the angle between two points. The two points being the player controlled unit and the point of the potential target unit. If these angles are approximately the same, you are aiming in the direction of the target unit.

    I wrote my method as galaxy script code, but I will walk you through the concepts.

    First, I have a region which is always centered on my player ControlledUnitt. When units enter the region, they are added to a player group of Targets. When they leave or die, they are removed.

    Next, when the player shoots, my "AngleMatch" function cycles through all of the units in this region that have been added to the group Targets. It checks compares the CameraYaw with the value of the angle between two points (position of ControlledUnit, position of TargetUnit). If they match, just verify height.

    That is the jist of the concept.

    Advantages: Much faster execution than traceline.

    Disadvantages: Collision detection : if no other methods are added, you can simply shoot through walls.

    void AngleMatch (int p) {
        fixed scaledAngle;
        fixed cameraAngle=CameraGetYaw(p);
        fixed angleBetweenPoints;
        fixed traceHeight;
        fixed pitch = CameraGetPitch(p);
        point tracePoint=null;
        fixed unitWorldHeight;
        unit targetUnit;
        point unit1Position=UnitGetPosition(Player[p].controlledUnit);
        point unit2Position=null;
        fixed cameraHeight=WorldHeight( c_heightMapGround, unit1Position) + Player[p].cameraHeadHeight + UnitGetHeight(Player[p].controlledUnit);
        fixed distance=0;
        int k=0;
        
        while(k<Player[p].regionUnitsCount) {
    	unit2Position=UnitGetPosition(Player[p].regionUnits[k].theUnit);
    	distance=DistanceBetweenPoints(unit1Position,unit2Position);
            angleBetweenPoints = AngleBetweenPoints(unit1Position, unit2Position);
            scaledAngle=ATan2(0.5, distance);
            if(((cameraAngle <= (angleBetweenPoints + scaledAngle)) && (cameraAngle >= (angleBetweenPoints - scaledAngle)))) {
                targetUnit=Player[p].regionUnits[k].theUnit;
                if( pitch < 90 ) {
                    traceHeight = Tan(pitch) * distance*(-1);
                } else if(pitch > 270) {
                    traceHeight = Tan(360 - pitch) * distance;
                }
                tracePoint=unit2Position;
                unitWorldHeight = WorldHeight(c_heightMapGround, unit2Position);
                PointSetHeight( tracePoint, cameraHeight+traceHeight-unitWorldHeight);
                if( cameraHeight + traceHeight - unitWorldHeight >= UnitGetCustomValue(targetUnit, 1) && cameraHeight +traceHeight -unitWorldHeight <= UnitGetCustomValue(targetUnit, 2) ) {
                    Player[p].headshot = true;
                    Player[p].targetUnit = targetUnit;
                    Player[p].targetPoint=tracePoint;
                    return;
                } else 
                if( cameraHeight+traceHeight-unitWorldHeight >= 0.0 && cameraHeight + traceHeight - unitWorldHeight <= UnitGetCustomValue(targetUnit, 0) ) {
                    Player[p].headshot=false;
                    Player[p].targetUnit=targetUnit;
                    Player[p].targetPoint=tracePoint;
                    return;
                }   
            } 
            k+=1;
        } 
        Player[p].targetUnit=null;
        Player[p].targetPoint=null;
    }
    
    Posted in: Triggers
  • 0

    posted a message on Question about Regions and "Unit Leaves Region" event

    I'm wondering if the "unit leaves region" event will fire if I use triggers to move a region so that the unit no longer resides in this region. I'm asking because I have a region that peridocially moves to the location of a specified unit, and I use "unit enters" and "unit leaves" region to set an array of targets in that are currently in region. If I move the region, and the "unit leaves region" event does not fire, this would give false values of units currently in the region...

    Posted in: Triggers
  • 0

    posted a message on Project: StrikeCraft - First Person Shooter Recuiting

    Hey, I did my own comparison using the hot keyed unit abilities (skill buttons) to capture the movement inputs and as well as key pressed events twice now. I first tested this a few months ago after I posted this idea on the forums and didn't get any responses. I tested it out again today with 4 people toggling between the two systems in game (on my map). Honestly, there was no noticeable or measurable difference either time. If anything the hotkey method is more annoying because it keeps playing that damn noise, and it clutters the screen because you can't disable that part of the UI. I guess the only way to test it fully would be to do it with a full lobby and toggle between the two in game. I'm willing to help test this out with a full lobby just pm me with time you want to test and I'll be on if I'm not working.

    Besides that, your shooter is looking great, love the custom weapon models and new terrain :P, looking forward to fragging you.

    Posted in: Team Recruitment
  • 0

    posted a message on Red Engine (FPS Library) Now Public

    I'm releasing a library I have been developing in my free time. It basically takes care of setting up your map to function as a FPS following the desired unit. This is still a work in progress, but it is definitely far enough along to be of some use to people. I have done some documentation that you will find in the library to try and explain how to utilize it. I will be working on creating functions that will appear in the GUI, but you can reference them with code for now.

    I have uploaded the map file I have been using to test this and the library itself.

    http://www.sc2mapster.com/maps/red-engine-demo-fps-library/

    Refer to the link in my signature to view a video of an earlier version. You can test my map out on battle net by searching "Betrayal at New Gettysburg" to see online performance.

    Additionally, I am looking for people to help me develop this so PM if you feel your qualified. :) Enjoy, and thank you SC2Mapster community for giving me the resources and Rrowland specifically for his tutorials.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Getting custom script functions to appear in GUI?

    I have created code within a library and have functions within my custom script that I want to be able to use on any map through the GUI as well as referencing them with code. Currently I can only get these to work with a custom script action. I plan on releasing this library to the public soon, but I want it to be easy for people to use and configure through the GUI. I know I could make functions with the GUI in my library and insert the custom script that calls my functions there, but I'd rather just have more direct access to these functions than tunnel through redundant functions.

    Thanks!

    Posted in: Galaxy Scripting
  • 0

    posted a message on Looking for a Data Person to help with FPS game.

    Hello, I'm looking for a DATA EDITOR person to help me develop guns for my FPS map. I have created all the FPS system (camera, movement, shooting). I need help creating more weapons through the Data editor. I play on USEast, I am available most weekdays after 10pm US Central Time. I can communicate through skype or vent.

    The map I'm currently working on is themed after the Kerrigan Betrayal CGI video cut scene. You play as Sarah Kerrigan (Nova) and fend off an onslaught of Zerg. This is meant to be a single player game as Blizzard's keyboard and mouse inputs over Battle Net need to be synchronized which results in massive lag. If they ever address this issue, I intended to develop this into a multiplayer FPS survival game. I'm developing this in my spare time as a hobby, if you would like to help me make some weapons I would really appreciate it. Refer to my signature for a video demonstrating what I've accomplished so far.

    If you think you can help, please message me and show any previous work done :P.

    Posted in: Team Recruitment
  • 0

    posted a message on Help, total data noob here

    @DrSuperEvil: Go

    I will try that today, but shouldn't it still apply the regular damage when the effect is executed from unit to unit? The splash damage would be effective when executed from unit to point.

    Posted in: Data
  • 0

    posted a message on Help, total data noob here

    Thanks a lot for your advice/suggestions. I was able to get the snipe effect and the Marauder grenade missile effects to work. With the grenade effect, it will only apply the damage to the unit when the impact location is setup as target unit only. If i change it to target unit/point it will not apply the damage. Any ideas?

    Posted in: Data
  • 0

    posted a message on Help, total data noob here

    To be short, I want to use the data editor to create an effect that deals damage to a unit and creates a projectile like animation. I want to use this with my FPS shooting system. The effect(s) will need to be cast from a unit to a target unit or target point. I know that the Archon attack works like this, but when I try alternative effects they usually don't work, or they don't animate correctly. I intend to execute these effects through triggers.

    If someone could point me in the right direction, or give me a simple example on how to create even a prismatic beam attack that would be great.

    Thanks,

    Posted in: Data
  • 0

    posted a message on Could use some C++ programming homework help.

    Here is some example code from one of my projects a long time ago. I read and write to a file in the defined functions. Hope this helps

    /*
      CSCI 201
      Computer Science 1
      Spring, 2010
      Project 10
      March 31
      
      My Name
      Section 1
      
      This program opens a data file containing the item numbers, item names, item quanititys, and item unit prices.
      Next, it sorts the items by item number, then calculates the total value of each item, and the total value of all items. 
    */
    #include<cstdlib>
    #include<iostream>
    #include<iomanip>
    #include<fstream>
    
    using namespace std;
    
    /*
      Struct: item
      Description: Contains an items reference number, quantity in the warehouse, unit price, total value, and name.
    */
    struct item
    {
           int num, amount;
           float price, val;
           char name[15];
    };
    
    /*
      Function: open_file
      Description: Opens an item file containing unorganized warehouse item information.
      Input: item array, count variable of items in array
      Output: None
    */
    void open_file(item obj[], int &c);
    
    /*
      Function: arrange_items
      Description: Arranges the warehouse items by item number.
      Input: item array, count variable of items in array
      Output: None
    */
    void arrange_items(item obj[], int c);
    
    /*
      Function: calc_val
      Description: Calculates each individal item's total value, and returns the total value of all items.
      Input: item array, count variable of items in array
      Output: Total value of all items in warehouse
    */
    double calc_val(item obj[], int c);
    
    /*
      Function: write_file
      Description: Writes the warehouse item information to a file with organized by item number, and containing
                   the additional calculated value, and total value of all items.
      Input: item array, count variable of items in array, total value
      Output: None
    */
    void write_file(item obj[], int c, double total);
    
    
    int main()
    {
        item objects[100];   // Array of items
        int count=0;         // Number of items in array
        double total=0;      // Total value of all items in array
        
        open_file(objects, count);
    
        arrange_items(objects, count);
        total = calc_val(objects, count);
        write_file(objects, count, total);
        
        return 0;
        
    }
     
        
    void open_file(item obj[], int &c)
    {
            ifstream in_f;  // Input file stream
            in_f.open ("struct.txt");  // Target file to open
    
            // Reads in information to item array
            while (!in_f.eof())
            {
                    in_f >> obj[c].num >> obj[c].name >> obj[c].price >> obj[c].amount;
                    c++;
            }
            in_f.close();
    }
    
    void arrange_items(item obj[], int c)
    {
         item temp; // Temporary storage while ordering items
         for(int n=c-1; n>0; n--)
                    {
                         for(int k=0; k<n;++k)
                                         if(obj[k].num>obj[k+1].num)
                                                                    {
                                                                         temp=obj[k];
                                                                         obj[k]=obj[k+1];
                                                                         obj[k+1]=temp;
                                                                    }
                    }
    }
                                                                    
    double calc_val(item obj[], int c)
    {
         double total=0; // Initialize total to 0
         for(int n=0; n<c; ++n)
                 {
                      obj[n].val=obj[n].amount*obj[n].price; // Calculate total price*amount
                      total+=obj[n].val;  // Sum to total
                 }
         return total;
    }
    
    void write_file(item obj[], int c, double total)
    {
         ofstream out_f; // Output file stream
         out_f.open ("inventory.txt"); // Output file name
    
         out_f << "Number            Name   Unit Price   Quantity     Value" << endl << endl;
         
         // Write item information
         for(int n=0; n<c; ++n)
                 {
                      out_f << obj[n].num << setw(16) << obj[n].name << setw(11) << obj[n].price << setw(11) << obj[n].amount
                      << setw(12) << obj[n].val << endl;
                 }
         out_f << endl << "Total Value = $" << total;
         out_f.close();
    }
    
    Posted in: Off-Topic
  • 0

    posted a message on Hybrid FPS Movement System

    @JademusSreg: Go

    no, this would not use TriggerAddEventKeyPressed, but TriggerAddEventUnitOrder

    Posted in: Galaxy Scripting
  • 0

    posted a message on Custom Issue Order Buttons

    Is there a way to create a button that issues a custom order. (in my case the order would be null)

    I'm trying to create buttons that issue custom orders through hot keys, so i can catch them with triggers "unit has been issued ORDER" for wasd movement. Any help or direction would be appreciated.

    Posted in: Data
  • 0

    posted a message on Hybrid FPS Movement System

    Idea for less laggy b net FPS

    I'm kind of new to mapping, but I was able to make a pretty decent FPS WASD, shooting system. I was thinking about using a WASD data system like programmers (in tutorials) and triggers to create a hybrid WASD system. This would use hotkeys causing the selected unit to be issued an order, and then this would be caught by a trigger event similar to regular key pressed. For example, "Unit - My Unit is issued an order to Move Up" as event, the action would be to update my system like I would if they event were just a "key pressed". The actual Move Up order would do nothing but flag the trigger. Then I would just use "key released" event to change my variable back to value that flags key released. This should in theory make the WASD movement more responsive on the front end. This is assuming that the round about event is faster then the regular key pressed event.

    If you think this idea is feasible let me know since I'm not very experienced with this.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Effects from Unit to Point

    Thanks, that worked like a charm,

    now if i wanted to make the animation quicker, would i change the tracking time?

    Posted in: Data
  • To post a comment, please or register a new account.