Jump to content

Ghost

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Ghost

  1. What you will need for this tutorial

    • Q3Map2 (This will be used for compiling your bsp)
    • the bsp you wish to modify (duh!)
    • notepad++ (You will need some sort of text editing program for doing the actual modding. You could use notepad but it sucks)
    • Jedi academy

    In order to get q3map2 the easiest way is to install gtkradiant then go to the install folder and copy the q3map2 exe file and all the dll's to the folder where you will be working.

    You can get notepad++ from here.

    If you dont know how to get jedi academy, i cant help you. Switch off your computer and go think about your life for a while.

    How entity modding works

    Ok so basically maps in jedi academy are stored as bsp files. A map is made up of what are basically building blocks (called brushes) and entities. Entities are associated with a brush meaning that if, for instance, you make a door you have a brush in the shape of a door and you will then have a door entity which will point to that brush and basically the brush will give the shape and texture and the entity will control where it is, how it behaves e.t.c.

    It is possible for for multiple entities to use the same brush. Think of brushes as like a selection of different shapes bricks. You have your selection of different shaped bricks then you have your list of entities which shows which brick to use where and how it should behave.

    Entities are always read from the bsp on the server side. Brushes on the other hand are read from the client side. This means that once a map is compiled in radiant, you cannot add any more brushes, any more "shapes" as it where without re-compiling the whole map. You can however re-compile the entities using the brushes already in the bsp. If you do this and put it on a server when a client joins the brushes will be read from their machine but the entities will be read from the server. This allows you to modify a map without a client having to install it.

    Coming up in the next post

    • Setting up your system for modding the bsp.

    -----------------------------

    Setting up your system for modding the bsp

    To set up your system for entity modding, first create a folder somewhere that you will work in. Next place the q3map2 files in the folder.

    Next we are going to make a batch file which when ran will re-compile a list of entities into an existing bsp file. To make this batch file we should first make a batch file called "compile.bat" or something so you know what it is, then open it in notepad++ and paste the following code into it:
     

    @[member='Echo'] off
    echo.
    echo ============================================
    echo ==== Ghosts q3map2 batch file compiler ====
    echo ==== That realistically is just a batch ====
    echo ==== file that runs a command so really ====
    echo ==== dosent warrant so much padding ====
    echo ==== And anyone with any computer ====
    echo ==== skills whatsoever will probably ====
    echo ==== remove this notice ====
    echo ============================================
    echo.
    echo This script requires windows 2000 or newer
    echo If you dont meet these requirement then
    echo get the hell out, we dont NEED your kind here
    echo.
    pause
    cls
    echo.
    echo ============================================
    echo ==== Ghosts q3map2 batch file compiler ====
    echo ==== That realistically is just a batch ====
    echo ==== file that runs a command so really ====
    echo ==== dosent warrant so much padding ====
    echo ==== And anyone with any computer ====
    echo ==== skills whatsoever will probably ====
    echo ==== remove this notice ====
    echo ============================================
    echo.
    echo Type in the name of your maps ent file
    echo without any file extensions then
    echo press enter
    echo.
    SET /P map=ent file name:
    cls
    echo.
    echo ============================================
    echo ==== Ghosts q3map2 batch file compiler ====
    echo ==== That realistically is just a batch ====
    echo ==== file that runs a command so really ====
    echo ==== dosent warrant so much padding ====
    echo ==== And anyone with any computer ====
    echo ==== skills whatsoever will probably ====
    echo ==== remove this notice ====
    echo ============================================
    echo.
    echo compiling map: %map%.bsp
    echo with ent file: %map%.ent
    echo -------------------------------------------------
    echo.
    q3map2.exe -v -game ja -fs_game base -onlyents %map%.ent
    echo.
    echo -------------------------------------------------
    echo please review the above text for errors to ensure
    echo your entities have compiled correctly.
    echo.
    pause
    cls
    echo.
    echo ============================================
    echo ==== Ghosts q3map2 batch file compiler ====
    echo ==== That realistically is just a batch ====
    echo ==== file that runs a command so really ====
    echo ==== dosent warrant so much padding ====
    echo ==== And anyone with any computer ====
    echo ==== skills whatsoever will probably ====
    echo ==== remove this notice ====
    echo ============================================
    echo.
    echo Thank you for using Ghosts q3map2 batch file
    echo compiler. For support visit: kas-clan.tk
    echo.
    pause

    save this file and you are now ready to edit the entities of a bsp file! To check you have this setup correctly, run your compile batch file, press enter on the welcome screen then enter "test" as the ent file name and press enter. You should then get a screen up like this:

    compilercheck.png

    If you have Q3map2 come up complaining that your bsp file dosent exist that means it is working correctly and you have it installed ok.

    Coming up in the next post

    • Editing existing entities in a map.

    -------------------------------------------
    Ok so now we have our environment set up we are going to try editing the properties of an entity already in a bsp file. The first step is to get our bsp file and extract the entity information from it.

    Lets start with an easy one, ffa3. Take the ffa3.bsp file and put it in your modding folder. Now open the bsp file with notepad++ and have a look at it. You should see it is mostly gobbldeygook. Press CTRL+f to open the find window and type "worldspawn" then press enter. You should find this take you to something like this:

    entfilestart.png

    This is the start of your list of entities. entities are stored in the following format:
     

     

    {
    "key" "value"
    }


    You want to select everything from the first curly bracket of the first entity to the last curly bracket of the last entity. Now make a new file in notepad++ and paste the text in. Have a look over it to make sure there arent any errors and save this file as "ffa3.ent".

    IMPORTANT! it is very important that your .ent file is named exactly the same as your .bsp file.

    We now have an entity file which contains all the entities from ffa3. What we do now is compile the entities in this file into ffa3.bsp. This will overwrite all entities that where previously in the ffa3.bsp so if you delete an entity from your entity file then compile it into the bsp the entity will be removed from the bsp.

    to check you have made your entity file correctly, lets try compiling the ffa3.bsp with your new entity file. In theory this should remove all entities from the bsp then insert all the ones in your ent file. Since we havent modified anything yet this should appear to have no effect in game.

    So with your ffa3.bsp and ffa3.ent files in your modding folder, run your compile.bat file. When asked to enter the name of your .ent file, type in "ffa3" and press enter. If you have done everything right you should then see a screen like this:

    compilesuccess.png

    But if you screwed something up, you will probably see something like this:

    compilefail.png

    Take a note of what line number the error occurred on and open your ent file and see whats up.

    To doubly make sure everything worked ok, put your new ffa3.bsp into a pk3 so it is in the same location as the ffa3 in the assets files. Make sure it loads after the assets files by calling your pk3 something like "Z_newffa3.pk3" and obviously you want it located at: "maps/mp/ffa3.bsp".

    IMPORTANT When i say to "put your new ffa3.bsp into a pk3 so it is in the same location as the ffa3 in the assets files" I do not mean to put your modified bsp file into the assets.pk3 file and overwrite the original, i mean put it into its own pk3 file in the same folder structure as the original bsp. DO NOT PUT ANYTHING IN OR IN ANY WAY MODIFY THE FILES IN YOUR ASSETS PK3's

    Assuming everything worked fine you now have a clean ent file which you know works ok. You can now try editing the entities. To start with lets do something simple, find this line in your ent file:
     

    {
    "soundSet" "city_outdoor"
    "music" "music/t1_sour/dealsour_action.mp3"
    "classname" "worldspawn"
    "message" "Tatooine FFA"
    }

    This is the worldspawn entity of the map. change the "message" keys value to some thing like this:
     

    {
    "soundSet" "city_outdoor"
    "music" "music/t1_sour/dealsour_action.mp3"
    "classname" "worldspawn"
    "message" "I AR MODDER OMGWTFHAXOR"
    }

    You can also put in a comment by starting a line with //, i find this is usefull for keeping trrck of what i have changed in a ent file, so you can do something like this:
     

    {
    "soundSet" "city_outdoor"
    "music" "music/t1_sour/dealsour_action.mp3"
    "classname" "worldspawn"
    // message changed by ghost because i am awesome.
    "message" "I AR MODDER OMGWTFHAXOR"
    }

    Now follow the steps tyou used before to compile the entities back into the bsp. When you start up ffa3 now you should see your message instead of "Tatooine FFA"!

    This is the basics of modding entities. You may be thinking hey there are so many entities how do i know what i can do with them? well if you open up gtkradiant and press "N" to get up the entity window and you can see all the information on the keys and values for all the entities in JKA, neat huh? So for example if we look at the entry for "worldspawn" we get this:
     

    Every map should have exactly one worldspawn.
    "music" music wav file
    "gravity" 800 is default gravity
    "message" Text to print during connection process
    
    BSP Options
    "gridsize" size of lighting grid to "X Y Z". default="64 64 128"
    "ambient" scale of global light (from _color)
    "fog" shader name of the global fog texture - must include the full path, such as "textures/rj/fog1"
    "distancecull" value for vis for the maximum viewing distance
    "chopsize" value for bsp on the maximum polygon / portal size
    "ls_Xr" override lightstyle X with this pattern for Red.
    "ls_Xg" green (valid patterns are "a-z")
    "ls_Xb" blue (a is OFF, z is ON)
    
    "fogstart" override fog start distance and force linear
    "radarrange" for Siege/Vehicle radar - default range is 2500

    So if we wanted to mod ffa3 so that the map has half gravity, we would just add this into the worldspawn entity in our ent file:
     

    "gravity" "400"

    Look around, experiment with stuff and learn what entities correspond to what part of the map and you will soon be creating weird and wonderfull maps!

    mairontai and Nardja like this
  2. Are you looking for a fun, friendly clan who manage a careful balance of fun and competitive play? Do you want somewhere to hang while you try to find such a clan? Then join the Knights of the Azure Sky today!

     

     

    kasadm.png

    Join our clan today for such great features as:

     

    Two divisions to choose from, now YOU have the power to choose what admins use their power to slap you up!

    A community that will treat you like family! A family we who loathes and despises each other!

    A proud 4 year history!

    A captain Commander who insists on making sarcastic and often wildly inaccurate recruiting posters!

    Members who don't take themselves to seriously! Except when they do in which case we actually do quite well in TFFA's

     

    Still not sure if you want to join? Why not come hang on one of our servers!

     

    b_560x95.png

     

    b_560x95.png

     

    Or visit our website!

     

    Or visit us under groups >> hybrid in the JKHub bar!

  3. Haha im glad you like :D If anyone is interested here is the source code for the various bits :D

     

    Micro controller code (Written in C++):

    #include <LiquidCrystal.h>
    // select the pins used on the LCD panel
    LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
    int lcd_key	 = 0;
    int adc_key_in = 0;
    #define btnRIGHT 0
    #define btnUP	 1
    #define btnDOWN 2
    #define btnLEFT 3
    #define btnSELECT 4
    #define btnNONE 5
    String data; // shove the raw input into here
    String themap; // stick the parsed map data into here
    String players; //stick the parsed player data into here
    boolean foundsplit; //record if we have found the split in the data
    char splitter='|'; //the char used to split the data
    char inData[20]; // Allocate some space for the string being read in from the serial interface
    char inChar; // Where to store the character read from the serial
    byte index = 0; // Index into array; where to store the character
    
    void setup()
    {
    // start serial port at 9600 bps:
    Serial.begin(9600);
    
    //set the time
    lcd.begin(16, 2);			 // start the LCD display
    lcd.setCursor(0,0); //set the cursor on the lcd display
    delay(1000); //wait a bit
    
    }
    
    
    void loop()
    {
    getdata();
    }
    
    void getdata()
    {
    Serial.println("#S|GETMESSAGE|[]#"); //request gobetweno downloads the latest server info to the local pc.
    delay(1000);//wait a second just to give it time to chill.
    Serial.read(); //read in the status code deturned from getmessage so we dont have to bother with it later.
    Serial.println("#S|READMESSAG|[1]#"); //request gobetweno sends server info down the serial line
    delay(10000);//wait a bit again
    
    while(Serial.available() > 0) // Don't read unless there is data
    {
    if(index < 19) // One less than the size of the array
    {
     inChar = Serial.read(); // Read a character
     inData[index] = inChar; // Store it
     index++; // Increment where to write next
     inData[index] = '\0'; // Null terminate the string
    }
    }
    //Feed the chars into a string, becuase working with Char's is kinda a pain
    data = String(inData);
    //explode the data into its relevant parts, this bit is kinda rough and needs reworked
    for(int i=1; i<int(data.length());i++)
    {
    if(data[i] == splitter)
    {
     foundsplit=true;
    }
    if(foundsplit)
    {
     players= players+data[i+1];
    }
    else
    {
     themap = themap + data[i];
    }
    }
    
    //output the map and players for debugging purposes
    Serial.println(themap);
    Serial.println(players);
    //now to draw the info onthe display
    lcd.setCursor(0,0);
    lcd.print(themap); //the map data comes with "map: " at the start of it so we can just display it raw
    lcd.setCursor(0,1);//move to the bottom line
    lcd.print("Players: "+players); //show the current number of players on the server
    //go through and clear all the data from everything, ready for the next read
    themap="";
    players="";
    data="";
    index = 0;
    foundsplit=false;
    for(int i=0;i<20;i++)
    {
    inData[i]=' ';
    }
    
    }
    

     

    Server code (Written in php):

    <?php
    /*
    This script incorporates a file from: http://www.gamefront.com/files/13442800/Ruckman_RCON___Quake_3
    In order to provide the raw rcon functionality.
    */
    $server="";
    $port=0;
    $password="";
    $q = new mohaa_rcon();
    $result = $q -> rcon($server,$port,$password,'status');
    $result = str_replace("\n","",$result );
    $result = explode("ÿÿÿÿprint",$result);
    $output=$result[1]."|".(count($result)-6);
    
    print $output;
    # MEDAL OF HONOR AND QUAKE ENGINE RCON CLASS
    # BY WILLIAM RUCKMAN (HTTP://RUCKMAN.NET)
    
    class mohaa_rcon
    {
    
    function rcon ($IP, $PORT, $PASSWORD, $COMMAND) {
    
    if (!validateIpAddress($IP)) {
    $data = "IP Address malformed!";
    return $data;
    }
    
    if ($PORT < 1 || $PORT > 65535 || $PORT == "") {
    $data = "Port range must be between 1-65535!";
    return $data;
    }
    
    $data = '';
    $fp = fsockopen('udp://'.$IP, $PORT, $errno, $errstr, 2);
    socket_set_timeout($fp,2);
    
    if (!$fp){
    $data = "Unable to Connect! Socket Error!";
    return $data;
    } else {
    $query = "\xFF\xFF\xFF\xFF\x02 rcon \"" . $PASSWORD . "\" " . $COMMAND;
    fwrite($fp,$query);
    }
    $data = '';
    while ($d = fread ($fp, 10000)) {
     $data .= $d;
     }
     fclose ($fp);	
     if ($data == "") {
     $data = "Connection failed, No responds from server, or changing maps.";
     return $data;
     }
     $data = preg_replace ("/.....print\n/", "", $data);
     if ($data == "") {
     $data = "Command sent successfully but returned no output. Possible bad command.";
     }
    
     return $data;
     }
    
    }
    function validateIpAddress($IP)
    {
    if(preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$IP))
    {
    $parts=explode(".",$IP);
    foreach($parts as $ip_parts)
    {
    if(intval($ip_parts)>255 || intval($ip_parts)<0)
    return false;
    }
    return true;
    }
    else
    return false;
    }
    ?>
    

     

    At the moment im trying to get the code on the Arduino that processes the incoming data to be a little more robust since it still falls down alot at the moment :D

    Caelum likes this
  4. Since work was quiet today I ended up making THIS!

     

     

    wp000203.jpg

     

    I stuck a little LCD display onto an Arduino micro controller so that I could be obsessive compulsive about checking the server is still running and how popular it is without having to constantly be switching windows :D

     

    Its still quite rough but it works as a proof of concept, currently there is a PHP script that Rcon's into my jka server and runs a status command then takes in what it gets back and processes it to make it more compact then this is picked up by gobetwino which is used to send the data on down the serial line where it is then displayed by the Arduino. Given the number of buttons I have on the controller the next logical step it seems to me would be to be able to browse through a list of players on the server and use admin commands on them from it as well MWAHAHA

    MUG, Caelum, therfiles and 1 other like this
  5. I checked out your forums earlier, Sir, and I am appalled at the average signature size of the members and forum users.

    Most atrocious. -Storms off-

    Its all part of my dastardly plan, the truth is everyone in KAS has been complaining about me for years, its just nobody can see their messages because they are swamped by their massive signatures.

     

    "CAN YOU DO THINGS?"

    Yes, yes I can :D Im this guy on jk3files: http://jediknight3.filefront.com/developer/cloudflint;29855 Ive done quite alot of other bits and bobs since then but with jk3files being all screwed up haven't been able to properly release most of it. I should say that looking at those files im appalled at how unskilled I was back then but I suppose we all have to start somewhere :D I also run a web development/programming/engineering company and make a mean tortia.

     

     

    Hey Ghost, I don't think we've met before although I have seen KAS members hang around sometimes on JAWA.

     

    Nice to meet you :)

     

    Nice to meet you too, we have spoken briefly I think via email about you guys bringing over my files from filefront, Im looking forward to having a website that actually functions to host mods on :D

     

    To everyone else, hello!

    MUG likes this
  6. Well mil posting his new comic reminded me that this website existed after him showing it to me ages ago :D

     

    For those who don't know me im the current leader of the Knights of the Azure Sky (Thats the KAS listed in the hybrid section of this website.)

×
×
  • Create New...