News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu
Menu

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.

Show posts Menu

Topics - BielBdeLuna

#1
I'm working as the coder for I guess it's an unannounced mod, and I was tasked on adding a feature from the fragging free mod, the dodge activated by double tapping the left or the right keys on the keyboard. in FF they did it within doom3 script (which is always a fall-back option) I thouth on implementing it via c++, and so I have it implemented in c++:

void idPhysics_Player::PerformDodge( bool dodge_right ) {
const float DODGE_POWER = 550.0f;
const float DODGE_HEIGHT = 300.0f;

idPlayer* player = static_cast<idPlayer*>(self);

idVec3 current_vel = GetLinearVelocity();
idVec3 push;
idAngles viewangles = idAngles( player->viewAngles[0], player->viewAngles[1], player->viewAngles[2] );
viewangles[2] = 0.0f;

idVec3 viewangles_to_right;
viewangles.ToVectors( NULL, &viewangles_to_right ); // viewangles to right...
idVec3 dodgedir = viewangles_to_right;
if ( !dodge_right ) {
dodgedir = -dodgedir;
}
//idVec3 normaldir = viewangles.ToForward();

push = dodgedir * DODGE_POWER;
push[2] = DODGE_HEIGHT;

player->StartSound("snd_jump_small", SND_CHANNEL_VOICE, 0, false, NULL);

current_vel += push;

SetLinearVelocity( current_vel );

command.flags ^= UCF_DOUBLE_TAP; //revert the flag so the player can go back to double tap again

}


the way to perform the dodge is the added code in idPhysics_Player::WalkMove:

               if ( ( command.flags & UCF_DOUBLE_TAP ) && ( waterLevel <= WATERLEVEL_FEET ) ) {
if ( command.rightmove > 0 ) {
PerformDodge( true );
} else if ( command.rightmove < 0 ) {
PerformDodge( false );
}
}


so it all moves around that flag: UCF_DOUBLE_TAP
if we have a direction (left or right) and we have the flag on, then on that tick we're double tapping (in the end of PerformDodge I lower the flag)

I did it this way, because I thought that recreating every button and key just for the double tapping would create more problems that become any solution. the flag system has flaws, it can only handle a single double tap at the time, so it fails to recognize more than one double tap (that is double tapping two or three keys at the time). but for testing should be fine.

my problem comes on how to activate this flag, my system doesn't seem to work:

void idUsercmdGenLocal::DoubleTap( void ) {
// the double tap feature for left / right keys, TODO generalize with a method that serves all keys and buttons
// only serves a single dobule tap motion

//if ( ( idUsercmdGenLocal::in_doubleTap.getBool() ) && ( cmd.flags && !UCF_DOUBLE_TAP ) ) {
if ( cmd.flags & !UCF_DOUBLE_TAP ) {
int cur_time = Sys_Milliseconds()

if ( !ButtonState( UB_RIGHT ) && !ButtonState( UB_LEFT ) ) {
last_key = selected_key;
selected_key = -2;
double_tap_time = cur_time + 750; // let not last more than that time before making the next tap
} else {
//pressing the two keys always waste the chance!
last_key = -1;
selected_key = -2;
double_tap_time = 0;
next_double_tap_chance_time = 0;
common->Printf( "pressed both" );
}

if ( ButtonState( UB_RIGHT ) && !ButtonState( UB_LEFT ) ) {
if ( selected_key == UB_LEFT ) {
last_key = -1;
}
selected_key = UB_RIGHT;+
common->Printf( "pressed right" );
} else if ( ButtonState( UB_LEFT ) && !ButtonState( UB_RIGHT ) ) {
if ( selected_key == UB_RIGHT ) {
last_key = -1;
}
selected_key = UB_LEFT;
common->Printf( "pressed left" );
}

if ( ( selected_key == last_key ) && ( cur_time < double_tap_time ) && ( cur_time >= next_double_tap_chance_time ) ) {
cmd.flags ^= UCF_DOUBLE_TAP;
common->Printf( "double Tap" );
next_double_tap_chance_time = cur_time + 1500;
}
}
}


this code is called from idUsercmdGenLocal::MakeCurrent when creating the command of the frame.

it seems that ButtonState( UB_LEFT ) and ButtonState( UB_RIGHT ) doesn't react as those buttons are pressed, can someone help me solve this, is there any way to make it even more general purpose?

double tapping is a three part situation, you first tap, then you stop tapping ,and then you tap again, I'm using two int variables to keep the key that was tap in the beginning, and a timer to know if we are legit when it comes to double tapping, it's I think a very heavy handed way to keep track of it all but it's just testing code. any idea why it doesn't work?
#2
I'm on Linux and I'm attempting to cross-compile dhewm3 to a Windows executable with Mingw, has anyone succeeded in cross-compiling dhewm3? in the readme there are instructions but I get a showstopper that's is quite strange:

I've created a folder named scripts( where I saved a *.sh script with the compile options)

cross_compile.sh:
cd ..
rm -rf build
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../scripts/mingw_toolchain.cmake -DDHEWM3LIBS=../scripts/dhewm3-libs/i686-w64-mingw32 ../neo


I've cloned the binaries needed for cross-compilation to /scripts/dhewm3-libs/

and created the requiered cmake toolchain file also placing it in the /scripts/ folder:
mingw_toolchain.cmake:
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)

set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)

set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


now for the stranger part, I have OpenAL installed in my system, and if I compile for Linux with:
cmake ../neo/

I get a correct build that compiles well:
Quote(...)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so 
-- Found OGG: optimized;/usr/lib/x86_64-linux-gnu/libogg.so;debug;/usr/lib/x86_64-linux-gnu/libogg.so 
-- Found VORBIS: optimized;/usr/lib/x86_64-linux-gnu/libvorbis.so;debug;/usr/lib/x86_64-linux-gnu/libvorbis.so 
-- Found VORBISFILE: optimized;/usr/lib/x86_64-linux-gnu/libvorbisfile.so;debug;/usr/lib/x86_64-linux-gnu/libvorbisfile.so 
-- Found OpenAL: /usr/lib/x86_64-linux-gnu/libopenal.so 
(...)

but when attempting to cross-compile it can't find OpenAL (which apparently should search in the cloned binaries already prepared for the cross compiling process):
Quote$ ./cross_compile.sh
-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: ../scripts/dhewm3-libs/i686-w64-mingw32/lib/libz.dll.a (found version "1.2.7")
-- Found JPEG: ../scripts/dhewm3-libs/i686-w64-mingw32/lib/libjpeg.dll.a 
-- Found OGG: optimized;../scripts/dhewm3-libs/i686-w64-mingw32/lib/libogg.dll.a;debug;../scripts/dhewm3-libs/i686-w64-mingw32/lib/libogg.dll.a 
-- Found VORBIS: optimized;../scripts/dhewm3-libs/i686-w64-mingw32/lib/libvorbis.dll.a;debug;../scripts/dhewm3-libs/i686-w64-mingw32/lib/libvorbis.dll.a 
-- Found VORBISFILE: optimized;../scripts/dhewm3-libs/i686-w64-mingw32/lib/libvorbisfile.dll.a;debug;../scripts/dhewm3-libs/i686-w64-mingw32/lib/libvorbisfile.dll.a 
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find OpenAL (missing: OPENAL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.5/Modules/FindOpenAL.cmake:108 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:108 (find_package)


-- Configuring incomplete, errors occurred!
See also "/usr/local/share/d3bfg/src/dhewm3/build/CMakeFiles/CMakeOutput.log".

now this is strange because OpenAL is there in either compiled windows form (a dll) and on library form (a lib) as well as in code from (in the /included/AL folder)

has anybody else attempted this, and if so had any success?

does anyone know where "OPENAL_INCLUDE_DIR" is set?
#3


a solution to avoid creating several copies of the same code could be:


void whateverhappensinthread( code variables ) {
        while ( true ) {
            code
        }
}

void t_threadcontrol1( code variables ){
        float remember;

        whateverhappensinthread( code variables );

        remember = threadId;
        threadId = 0;


}
#4
I've never done shader stuff on monsters, I'm looking forward to implement some material changes on the materials of the monsters at spawn time

the idea would be something like:

make a lava monster come out of the lava as a hot bright lava element and as time goes it cools down until it becomes a rocky textured monster

I'm looking forward to implement this thing in the GPL ai script,
how might I influence the material in the most generalist way so it can be reused for other stuff different than the one example I exposed above?


currently I have this amongst the init() function code:


//this code is GPLv3
spawn_time = sys.getTime();

no_shader_effect = true;
spawn_shader_time = getFloatKey( "spawn_shader_time" ); // saves a reference of a the end time shader effect
if ( spawn_shader_time > 0.0 ) {
    no_shader_effect = false;
    spawn_shader_time = spawn_time + spawn_shader_time;
}


so I have a start time reference and an end time reference

I guess I could divide that time by the HZ the games ticks (60 fps)

and then normalize this value so I get a percentage between 0.0 and 1.0 with this:


//this code is GPLv3
float minNormalizeMax(float number, float max, float min ) {

    float interval;
    float incorporated;
    float value;

    interval = max - min;
    incorporated = number - min;

    if ( incorporated <= 0 ) {
        value = 0;
    } else {       
        value = ( 1/interval ) * incorporated;
    }
    //sys.print( "value is: " + value + "\n" );
    return value;

}


so I could get what percentage it should variate per tick

and multiply it with the material value so it end ups influencing it somewhat

you guys know a way to implement something like this in the materials?

maybe I would need it's own thread so it doesn't disturb the character inner-working? and once it reached 1.0 (the end of the effect) auto kill that thread?

#5
Haunting of Deck 12 / Re: identify threads
June 11, 2015, 02:00:54 PM
knowledge doesn't occupy space
#6
id Tech 4 Scripting / identify threads
June 10, 2015, 01:04:07 PM
you can name a thread with a string name (what is the point?)

but can you save the thredId number?

you can kill a thread, but for that you need the threadId number, a float

is there a way to get the threadId number so I can kill that thread at will?
#7
in order to facilitate my work with the map exporter and in order to further the cooperation in-between blender and idTechX assets I'm developing a idTechX Python API so I can access the tokenized data in d3 an other games using idTech4-X, I've just started pushing my first code but as always you can find my code in Github: https://github.com/BielBdeLuna/idTechX_Python_API

my first immediate goal is to finish at least *.def reading and understanding it's entityDef definition so I can get a list of entities and at least keep going on with the exporter

hope you guys like it
#8
I'm wondering if we could create MAP files within Blender via python scripting.

I've started coding the initial code of the scripts, I'm using this as a reference for the map format: https://modwiki.xnet.fi/MAP_%28file_format%29

how could then the UV coords for the materials be applied? it woudl be great to have the UV pre-established as in any radiant
how would entities be set? maybe create a box and have it a "custom property" announcing it's "spawnclass"?

on the bezier surfaces (patches) blender has a bezier very similar to idtech3/4

well guys what do you think?
#9
id Tech 4 Discussion / Unreal vs id Mapping
October 30, 2014, 09:44:51 AM
ironically, technology-wise idtech 4 after compiling creates the void all around and makes the map walls function as in Unreal isn't it?
#10
id Tech 4 Scripting / GPL AI
October 17, 2014, 05:19:39 AM
I'm working in the OpenTech group, which is a group of developers that work on the gpl idtech4-BFG version of the engine, and we need to recreate the assets of d3 (all/some) but remake them gpl wise. so people can use the "openTech" engine to make games

In the future I'm looking forward to implement a planner more akin to what F.E.A.R. and S.T.A.L.K.E.R. had. but for the moment I will keep the Finite State Machine ( FSM ) model for I still need my c++ knowledge to grow before I can implement the planner.

right now I've made the distinction of:

ai_base -> npc_base -> npc_enemy_base -> npc_enemy_bipped_base

ai_base is for both the player and the npcs
npc_base is for npc_characters and npc_enemies
npc_enemy_base is for all kind of enemies, fliying, swiming,... any kind of enemy
npc_enemy_bipped_base is for human enemies

I've included a traits system where, several enemies that share the same script-object should react differently due to several distinct personality traits

I'm looking forward to implement a different scheme for the bipped motion, I want them to be able to take into account the direction they are facing (legs, torso, head, eyes) in order to move, this is meant to help add to the player the capacity to disjoint the direction of looking form the direction of the player is facing (a la Assassin's Creed ) and at the same time allow the enemies and characters to move in a more fluid way.

in order to implement this I'm adding a "motionState" that reside in-between "states" and "animStates" that is independent of both, reads the AI inputs from the game code (as well as player's) and acts upon the "animStates" so the "states" are left to a more cerebral level, I'm abstracting then the motion more closer to a planer, the "motionStates" are less defined (I'm planing just two)

Still ( the ai_base is not willing to move) he could be falling (so in motion but not willing) or just could be looking around
inMotion (the ai_base is willing to move ) the motion should use a "will direction" that would not always be the same direction he is facing, so he could be walking forward, or going backwards, or need to turn around and walk forward, or dodging, or simply step left in order to peep to the enemy and shoot at him

so to sum up "motionStates" should be freed up from the "animChannel" while still be able to control them separately, yet still be able to receive orders from the "states" in form of bool flags and "will direction" angles

in order to implement the "motionStates" I'm adding them to "actor.cpp/.h" so, players, characters, and enemies can use them.

so do you guys know anything to implement with the gpl AI? any idea or suggestion?


#11
Hi! I'm Biel Bestué de Luna, I was a casual in d3w, I went by the name 7318 back then.

I created the hl2 like portalsky and ported to dhewm3 and to BFG
I added a pain wheel as well as a compass to dhewm3
ported the cubemap and reflection map from dhewm3 to BFG
ported the "skip cinematic" to BFG
https://github.com/BielBdeLuna

I'm glad to see the old buddies from d3w in this new community and I'm looking forward to help grow the community back and even more from whatever it was back then. so... hi