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 - argoon

Pages: [1] 2
1
id Tech 4 Engine Coding / Getting var values from GUis?
« on: September 28, 2017, 04:07:16 PM »
Hello guys i know that i can set a variable value in a GUI from the engine code using for example somegui->SetStateInt("varName"); and it works fine, but i can't seem to do the inverse, get a value from a gui variable to the game code, i tried using the somegui->GetStateInt("varName"); but it returns zero every time, no matter to what value i set the GUI variable.

what i'm trying to do is create a grid based inventory system, and when i click in a "slot" i tell the c++ code what slot i interacted with.

2
id Tech 4 Engine Coding / working with idStrg class
« on: August 27, 2017, 04:32:26 PM »
Hello guys and gals :)

I need help from some idtech 4 coder that has experience working with the idStrg class, it has many functions ( or members )  to mess around with, but because i don't know what half of them do i'm really going blind here, what i'm trying to do is take a file path, like a icon path, get a particular string from it (like a file name) compared that to some other string and if true or false run some code. Anyone here know anything about this? 

3
id Tech 4 Discussion / why is this not news here!?
« on: August 11, 2017, 03:57:43 PM »
At lest i don't see any thread about it...  :P

Doom 3 BFG got a Vulkan render! written by a id Software coder, so in a sense a official render!

http://www.phoronix.com/scan.php?page=news_item&px=Vulkan-Doom3-Available


4
id Tech 4 Discussion / Fantastic BFG VR mod!
« on: July 30, 2017, 08:09:32 PM »
Can someone explain to me how were they able to modify the BFG flash GUI's so deeply without the source files?


5
Hello guys and gals,  i'm trying to call functions from the c++ code, like i used to do using DoomScript but obviously is different on the c++ side, studying the engine code i see id calls scripts like so:

Code: [Select]
const function_t *func;

func = Entity->scriptObject.GetFunction("somefuncname");
Thread->CallFunction(frobableEntity, func, true);

but this just crash's the engine for me and i'm totally clueless why.

Any help is welcome.


 Edit: before posting this i spend more than a hour trying to make this work, after making this thread and going away to try to solve again i did it: :P  :D

This is the necessary code to successfully call object script functions from withing the c++ code:

Code: [Select]
const function_t *func;
idThread *Thread;

func = Entity->scriptObject.GetFunction("signalOn");
Thread = new idThread();
Thread->CallFunction(Entity, func, true);
Thread->Start();

6
id Tech 4 Discussion / modwiki problems
« on: April 07, 2017, 06:16:36 PM »
Hello guys i'm getting a "your connection is not private - NET::ERR_CERT_AUTHORITY_INVALID" error when trying to read the idtech4 modwiki, i'm using Vivaldi (is based on chrome), i'm the only one with this error? 

7
id Tech 4 Engine Coding / Nice PBR opengl tutorial
« on: March 20, 2017, 09:07:16 PM »
If some day someone wants to implement PBR in idtech 4 here is a tutorial that could help.

https://learnopengl.com/#!PBR/Theory

8
id Tech 4 Scripting / LOD system
« on: November 23, 2016, 10:08:21 PM »
Hello guys i made a LOD system for my mod using script and it works, more or less, the lod change works the problem i'm getting is that when the model changes it shivers for a moment and is very obvious, do you guys have any idea on how to smooth that transition?

here is the script code

Code: [Select]
/***********************************************************************

lod_object_base.script

self script contains any LOD's specific code.

revision = 0.1

***********************************************************************/


#define LOD_LEVEL_0 1
#define LOD_LEVEL_1 2
#define LOD_LEVEL_2 3

object lod_object_base {
// bool to control the while loop
    boolean isON;

// lod0 position for the other lod's
vector currObjPos;

float currentLOD;

string lod0_model;
string lod1_model;
string lod2_model;


// player entity
entity lod_player;

// enable or disable the LOD check, no need to do it on objects with no lod's
float lod_enabled;

// show distances
float lod1_dis;
float lod2_dis;
// player distance from lod object
float pldistance;



void init();

void lodUpdate();
void checkLOD();

};


void lod_object_base::checkLOD() {

pldistance = self.distanceTo(lod_player); // check lod obj pos distance to player1 pos

if( pldistance < lod1_dis && currentLOD != LOD_LEVEL_0 ){
currentLOD = LOD_LEVEL_0;
self.setModel(lod0_model);
}
else if ( pldistance >= lod1_dis && pldistance < lod2_dis && currentLOD != LOD_LEVEL_1 ){
currentLOD = LOD_LEVEL_1;
self.setModel(lod1_model);
}
else if ( pldistance >= lod2_dis && currentLOD != LOD_LEVEL_2 ){
currentLOD = LOD_LEVEL_2;
self.setModel(lod2_model);
//self.setKey("noShadows", "1"); doesn't work at runtime :(
}
}

/*
============
lod_object_base::lodUpdate
============
*/
void lod_object_base::lodUpdate() {

lod_enabled = self.getIntKey("lod"); // get the spawn lod value

// if spawnarg lod is 0 disable the while loop
if(lod_enabled == 0){
isON = false;
}

// gets the lod0 world position
currObjPos = self.getWorldOrigin();

// not run this on the loop or it will not work.
currentLOD = LOD_LEVEL_2;

// get the models can be set on the editor if using the def key "editor_model"
lod0_model = self.getKey("model");
lod1_model = self.getKey("model_lod1");
lod2_model = self.getKey("model_lod2");
// then get lod distance values
lod1_dis = self.getIntKey("lod1_distance");
lod2_dis = self.getIntKey("lod2_distance");

// this gets the player entity
    lod_player = sys.getEntity("player1");


// runtime loop to check for the player position and set the lod objs
while ( isON ){ // while isON == true
if( lod_enabled ){ // if lod0 has the spawnarg lod_enabled with value 1 then run if not stop
checkLOD();
}
waitFrame();
}
}

/*
===============
initialisation
================
*/

void lod_object_base::init()
    {
waitFrame();
isON = true;
thread lodUpdate();
    }

9
id Tech 4 Scripting / Unity enum equivalent on doom 3 script?
« on: November 23, 2016, 04:08:03 PM »
Hey guys does idtech 4 script has something like unity enum?

In unity you use - enum NAME { VALUE, VALUE_1, VALUE_2} almost like an array then you access that with - private var name : NAME= NAME.VALUE_2;

This in Unity script looks very similar to the idtech 4 script #define NAME VALUE  directive, i'm i right? If yes how could i implement that using #define?


edit - Was able to do the same using 3 different #defines but would still like to know if something like enum was possible. 

10
Content for Games/etc. / Node editor
« on: November 22, 2016, 01:59:50 PM »
For someone wanting to make a node editor for idtech 4 (i can dream) here is a nice one with open source and all.

http://gratin.gforge.inria.fr/#presentation

11
id Tech 4 Scripting / idtech 4 Vectors?
« on: November 16, 2016, 12:51:54 PM »
Cheers people can anyone explain how to use vectors on idtech 4? As always before asking i tried doing it my self and even reading other people code to learn but i'm just not getting anywhere, math was never my strong point,  i'm trying to make a grass system (using script not c++ code) where every grass model shoots a trace downwards and detects the surface below at init() so it gets on the ground and follows the terrain bumps, without the need for me to manually do that, problem i'm totally failing, because i can't seam to shoot a trace straight down for all models using only code, i tried to learn vector math, it seams easy but when i try to implement it in code i fail, all models just shoot the trace in random directions, can anyone with sufficient knowledge about idtech 4 vectors give me some hints?

here is the code that i have for that, is ugly and just me messing around trying everything so have petty.

Code: [Select]
void grass_sys::alignToFloor(){
vector traceStart;
vector tracEnd;
vector  downVec;
vector  normVec;
vector  traceNormal;
vector traceStartAng;

traceStart = self.getWorldOrigin();

//traceStart = traceStart - getWorldOrigin();

sys.println("tracStart is: " + traceStart);

/*
traceStartAng = sys.VecToAngles(traceStart);
sys.println("tracStartAng is: " + traceStartAng);

normVec = sys.vecNormalize(traceStart);
sys.println("normVec is: " + normVec);
*/

downVec = sys.angToForward(traceStart);
sys.println("downVec is: " + downVec);

tracEnd = traceStart + downVec * 50;
sys.println("tracEnd is: " + tracEnd);

sys.debugArrow('0 1 0', traceStart, tracEnd, 4, 100 );

Also vectors from where i read http://www.wildbunny.co.uk/blog/vector-maths-a-primer-for-games-programmers/vector/ seam to be
Quote
A Vector is a quantity which has both magnitude (size) and direction, but no position
so how does in idtech 4 they do seam to have a position in space? By using getWorldOrigin() or getOrigin() i get a position this tell me they are points in space but that quote implies otherwise, I'm just not comprehending this well or they are different vectors?

How can you visualize a single vector in idtech 4 script? By using debugLine or debugArrow you need two vectors, a start and a end vector, but isn't a single vector already a "arrow"?

Sorry if this are really dumb questions but i'm just ignorant on this stuff and i'm stuck and would like to learn this. 

Thanks.

12
id Tech 4 Scripting / help with func_animate
« on: September 24, 2016, 06:34:29 PM »
Hello again guys like i referred in the "help with script thread" the func_animate object hides it self after playing the "anim1" "anim2" animations how can i disable that? Is it even possible without messing with the engine or game source code?

here is the entity definition.

Code: [Select]
model env_smwoodTable {
mesh models/md5/furniture/smwoodTable.md5mesh
anim idle models/md5/furniture/smwoodTable_idle.md5anim
anim open models/md5/furniture/smwoodTable.md5anim {
frame 1 sound storagecabinet_open
}
anim close                      models/md5/furniture/smwoodTable_close.md5anim {
frame 1 sound storagecabinet_close
}
}

entityDef env_smwoodTable {
"editor_color" "1 .5 0"
"editor_mins" "-16 -16 0"
"editor_maxs" "16 16 64"

"inhrit"             "func_animate"
"spawnclass" "idAnimated"
"model" "env_smwoodTable"
"frob"                  "1"
"start_anim"            "idle"
"num_anims"             "2"
"wait"                   "-1" //how long to wait before auto activating.  -1 means only activate when triggered.
"anim1" "open"
"anim2" "close"

"combatModel" "1" // collision based on the md5 mesh (bad for performace use AF's when possible)
//"bleed" "0"
//"mtr_wound_metal" "textures/decals/bullethurt"
//"snd_metal" "bullet_impact_flesh"
"sound_bone" "origin"

13
id Tech 4 Scripting / help with a script
« on: September 24, 2016, 05:15:28 PM »
Hello guys can anyone that knows coding and specially doom 3 scripting see why this script of mine is not working? Is a experience of mine about making a mouse over functionality without the need to mess with the source c++ (that i don't really know at all).

First a disclamer i'm not a coder i'm just a noob at c++ coding and at Doom 3 scripting, what you see below is what i came up with, by trial&error, by reading and copypasting from various sources.
 
Now the important part, the code that doesn't work as i want it, is the entity.setShaderParm() bit, it highlights the object like i want it too, when i mouse over the "frob" object (inspiration from TDM ;p), but when i stop "mouse overing" the object it stays highlighted still, i tried everything some of my tries made me turn on and off the highlight but only when i mouse overed the object again, what i'm i  missing here?

The funny thing is that the code that turns off the test light (that i put for debugging) and the code to activate the func_animate works just fine. Only problem the func_animate hides it self after playing all the animations.

Sorry for the messy code...

Code: [Select]
////////////////////
//
//    global vars

#define FROB_NONE  0
#define FROB_OVER  1

entity frobEntity; // detected entity with frob enabled
float isOver_obj = false; // Is the player looking to frob object ?
float   command     = FROB_NONE;
vector traceStart, tracEnd;
float useBtn, btn0; // use button for frob, same as attack
//float highlight_on = false;
float parm11_state;
float isPressed = false;
float isFrobable; // check for the frob spwn arg value
///////////////////

/*
============
trace_objs
============
*/
void trace_objs() {



// bind objs to player head position
$ml_start.bindToJoint( $player1, "headcontrol", 1 );
$ml_end.bind($ml_start);



}

/*
void draw_ent_text_type(){
if(isOver_obj == true){
vector bbox_size = frobEntity.getSize();
vector frob_ent_origin = frobEntity.getWorldOrigin();
vector text_origin = frob_ent_origin;
text_origin_z = text_origin_z + bbox_size_z + 30.0f;
string ent_type = frobEntity.getKey("type");
frobObjText = sys.drawText(ent_type, text_origin,0.5,'0 1 0', 1, 1);
}
}*/

/*
void obj_higlight(){

parm11_state = frobEntity.getShaderParm(SHADERPARM_FROB);
sys.println("\n\nInit parm11 value is: " + parm11_state);

if( parm11_state == 0 ){
//highlight_on = false;
frobEntity.setShaderParm(SHADERPARM_FROB, 1);
sys.println("\n\nOff parm11 value is: " + parm11_state);
}
if( parm11_state == 1 ){
//highlight_on = true;
frobEntity.setShaderParm(SHADERPARM_FROB, 0);
sys.println("\n\nON parm11 value is: " + parm11_state);
}

}*/


void mouseOver()
{
traceStart = $ml_start.getWorldOrigin();
//sys.println("\n\ntraceStart value is: " + traceStart);

tracEnd = $ml_end.getWorldOrigin();
//sys.println("\n\ntraceEnd value is: " + tracEnd);

//sys.drawText("end",tracEnd,1,'0 1 0', 1, 1);

useBtn = $player1.getButtons();
btn0 = 1 & useBtn;

sys.trace( traceStart, tracEnd, '0 0 0','0 0 0', MASK_SOLID|CONTENTS_RENDERMODEL, $player1 );

sys.debugLine('0 1 0', traceStart, tracEnd, 1 );

frobEntity = sys.getTraceEntity();
isFrobable = frobEntity.getIntKey("frob");

parm11_state = frobEntity.getShaderParm(SHADERPARM_FROB);
sys.println("\n\nInit parm11 value is: " + parm11_state);

if( !(!frobEntity) && (frobEntity != $world ) ){
if(isFrobable && isOver_obj == false){
isOver_obj = true;
if(parm11_state == 0){
frobEntity.setShaderParm(SHADERPARM_FROB, 1);
}
$test_light.On();
}
if(!btn0){
isPressed = false;
return;
}
if ( btn0 && isPressed == false ){
sys.println("use was pressed.");
isPressed = true;
frobEntity.activate($player1);
}
} else {
$test_light.Off();
if(parm11_state == 1){
frobEntity.setShaderParm(SHADERPARM_FROB, 0);
}
isOver_obj = false;
}

}


void MO_loop_control(){
while( true ){
command = FROB_NONE;
while( command == FROB_NONE){
mouseOver();
sys.waitFrame();

}
}
}

/*
===============
initialisation
================
*/

void main ()
    {
sys.waitFrame(); // wait for init() routines to finish
$player1.disableWeapon();
/*sys.setCamera($cam1);
sys.wait(20);
sys.firstPerson();*/
trace_objs();
//mouseOver();
thread MO_loop_control();
    }


The "SHADERPARM_FROB" is a custom #define in the doom_defs.script not one that exist in vanilla Doom 3.

here is the material of the "frob" object

Code: [Select]
textures/boat/boat_woodtable
{

wood

qer_editorimage textures/boat/boat_woodtable.tga

diffusemap textures/boat/boat_woodtable.tga
bumpmap textures/boat/boat_woodtable_bump.tga
Specularmap textures/boat/boat_woodtable_s.tga

// This is the code required for frob highlighting this texture
    {
        if ( parm11 > 0 )
        blend       blend
        map         _white
        color       0.99, 0.95, 0.62, 0.25
    }
}



BTW is there a way to attach a object to the player camera (is it even a entity?) and have it follow all the movements of the player camera? looking up and down, sides to sides, etc.

In my script i attach the trace origin to the $player 1 joint (headcontrol) but it is the head of the invisible character (for shadows and mirrors) so it lags behind the cursor and doesn't follow it precisely, but it more or less works . Help on this would also be appreciated. 

14
welcome, you are from the TDM community aren't you? Btw before this happens, please don't care about the karma points, we add two new users go away because of the negative karma points they are useless, the comments is what matters.    :)

15
id Tech 6 General Talk / Are the tables Turning?
« on: March 01, 2016, 09:46:55 AM »
Where is the world coming to, AMD beats Nvidia on a early Doom 4 benchmark ON OPENGL!!?

http://www.tweaktown.com/news/50737/amd-beats-nvidia-early-doom-benchmarks-dominating-4k/index.html


Now that John is out of the picture and Tiago Sousa from Crytek is working on idtech 6, we see this, makes me think, perhaps we are seeing that John was tweaking things in favor of Nvidia?

What do you guys think?

Pages: [1] 2