r1ch.net forums
* Home Help Search Login Register
r1ch.net  |  General  |  General Discussion  |  Topic: Trying to fix the Siamese Twins problem...
Pages: 1 [2] 3  All
Print
Author Topic: Trying to fix the Siamese Twins problem...  (Read 37402 times)
R1CH
Administrator
Member

Posts: 2625



« Reply #15 on: June 05, 2007, 08:30:18 pm »

Do you use the Win32 or Linux binary?
Logged
hajas
Member

Posts: 44



« Reply #16 on: June 05, 2007, 09:31:45 pm »

omg! I sent you both! sorry... I use win32 m8!  cheesy
Logged
QwazyWabbit
Member

Posts: 402


« Reply #17 on: June 06, 2007, 04:13:57 am »

If you leave maxs at 16 16 50 won't that leave the bounding box large? The player figure won't be resized but the target bounding box will make it possible to shoot the player when aiming high. Reducing Z of the bounding box is done to make the player figure crouch. Setting back to 32 makes him stand. To test target box size, aim high above the figure with the rail, I think you will find he can be fragged.

I think you will have to reset the Z back to 32 once the player is properly spawned.
Logged
Snake
Member

Posts: 184


« Reply #18 on: June 06, 2007, 04:50:55 am »

I tested with this value until below very low ceilings, and works great... probally a less number like 15 or even 10 will be already enough to fix this problem....

Buried spawnpads are typically buried 7 units or thereabout. Too bad Q2 didn't come with the ability to hide the damn things, some mods provide that option tho.
Logged
hajas
Member

Posts: 44



« Reply #19 on: June 06, 2007, 01:33:38 pm »

in this meantime, I was thinking in another way to fix this problem...

well, I tryed to move up and spawn, and change the killbox... boths will work if I could change the RA2 source.

but in fact, this isn't a RA2 bug, is a mapping problem... that appears more in round based games.

so if we try to fix the maps via code? and not the spawns? could be a clean solution?

I was taking a look at cmodel.c at quake2... in CM_LoadMap

and also was thinking about your override stuff... so could be only server side, so no need to download again all maps.
(great to us! because we have more than 1500 maps in rotation!)

so we could do something like this pseudocode:

Quote
in every info_player_deathmatch do
  origin (Z) += num;
end;

where num is the number that we must to up a little all spawns, this number must be calculated and tested of course.

we could do a little better like:

Quote
(creat a file with a list of all known bug maps called mapbuglist)

if map in mapbuglist do in every info_player_deathmatch
  origin (Z) += num;
end;

then will only fix the buggy ones...

or a kind of exe like you did to get the info from the map merged with your another application to calculate the override file,
so will generate only spawn infos, changed, and genarete the override to each map in that folder.

what do you think r1ch? should be the right way to fix this... aside more difficult.  sad

Logged
hajas
Member

Posts: 44



« Reply #20 on: June 06, 2007, 03:25:04 pm »

or a even better way...  cheesy

Quote
if game == 'arena' then
   do in every info_player_deathmatch do
     origin (Z) += num;
   end do;
end if;
Logged
hajas
Member

Posts: 44



« Reply #21 on: June 09, 2007, 10:22:20 am »

Here are some images of siamese twins bug in RA2...



Attention: this map have 7 spawnpoints, and was tested only with 4 players!



if you entered the map via DM, you will see this:



after up the Z (+10) of the origin of the spawnpoint via hex and do the same, here is what we can see in DM



I tested many many times, but aside the problem not happen in 2 matches of 19 rounds, in the third happend with the info_player_start, not the info_player_deathmatch... so I add more 5 than tested again for 1 hours, around 6 matches without one single problem.

Demo with the original TLTF map : Siamese Twins Problems
Demo with the fixed TLTF map: Problem Solved!
(came with the maps! need RA2 installed to view)

so I know exactly how to fix this problem, is just add +15 to Z value in each info_player_deathmatch and info_player_start, and probally info_player_team1 and info_player_team2 too when game = arena.

I'm trying to find how to do that in the code, but I'm having some problems... any suggestions?

thanks!
Logged
QwazyWabbit
Member

Posts: 402


« Reply #22 on: June 09, 2007, 05:26:18 pm »

You will find code that hacks coop spots on the basis of map names in most game code: p_client.c
In the original 3.21 game code it starts at line 28.
There are other map hacks throughout the game where they corrected the basic maps.
You will also find they are called "ugly disgusting hacks", and rightfully so.
Search the word hack in the code for even more map hacks.

You should try to avoid fixing it in code as this is backwards. If the problem is in the maps, correct the entities in the maps. But editing the maps directly will create problems for people who already have the maps since identical file names for edited maps will cause map checksum errors and kill the client connection. A better solution is to use the r1q2 override feature or any override feature in the game that will allow entities to be corrected externally with ent files or override files. This solves the spawn problem without creating map conflicts and also allows the overrides to be shared so everyone can benefit from the information.
Logged
hajas
Member

Posts: 44



« Reply #23 on: June 09, 2007, 07:07:28 pm »

sure, I want to do something like the override... but I don't need files etc, is just do the same thing to every map when the game is arena...  grin

we user Q2E, and didn't work well with r1q2 unfortunately...  cry
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #24 on: June 09, 2007, 08:55:43 pm »

You will need to either port the override feature to Q2E or add a hack in the engine before the SpawnEntities call if you want to do this without requiring new map downloads.
Logged
QwazyWabbit
Member

Posts: 402


« Reply #25 on: June 09, 2007, 10:29:21 pm »

We implemented an ent file loader for LOX. If you have source for the arena mod you can add it.

g_ent.c:
Code:
#include "g_local.h"

static char *ReadEntFile(char *filename)
{

FILE      *fp;
char      *filestring = NULL;
long int   i = 0;
int         ch;

for (;;)
{
fp = fopen(filename, "r");
if (!fp) break;

for (i=0; (ch = fgetc(fp)) != EOF; i++);

filestring = gi.TagMalloc(i+1, TAG_LEVEL);
if (!filestring) break;

fseek(fp, 0, SEEK_SET);
for (i=0; (ch = fgetc(fp)) != EOF; i++)
filestring[i] = (char) ch;
filestring[i] = '\0';
break;
}

if (fp) fclose(fp);
return(filestring);
}

char *LoadEntFile(char *mapname, char *entities)
{
char   entfilename[MAX_QPATH] = "";
char   *newentities;
int      i;
   
sprintf(entfilename, "entfiles/%s.ent", mapname);
// convert string to all lowercase (for Linux)
for (i = 0; entfilename[i]; i++)
entfilename[i] = (char) tolower(entfilename[i]);

newentities = ReadEntFile(entfilename);

if (newentities)
{   //leave these dprints active they show up in the server init console section
gi.dprintf("Entity file %s.ent found\n", mapname);
return(newentities);   // reassign the ents
}
else
{
gi.dprintf("No .ent File for %s.bsp\n", mapname);
return(entities);
}
}

Prototype in g_local.h:
char *LoadEntFile(char *mapname, char *entities);

Call from inside SpawnEntities() just before entity parsing:
    entities = LoadEntFile(mapname, entities);  /*MrG{DRGN} 10/04/2004*/


The game looks for mapname.ent in the modname/entfiles/ folder, if it exists, it loads it in place of the entities defined in the map itself. To use it, use r1ch's entdump program to dump a maps entities, then modify the file as needed.
Logged
R1CH
Administrator
Member

Posts: 2625



« Reply #26 on: June 09, 2007, 11:05:03 pm »

RA2 is closed source unfortunately.
Logged
hajas
Member

Posts: 44



« Reply #27 on: June 10, 2007, 10:50:39 am »

yeah, I don't have the RA2 source, and I think was never released to the public...  undecided

I need to make the change when the map is loaded, like the r1ch override....

I found the part on Q2E code that load the entities of the map:

Quote
=================
CM_LoadEntityString
=================
*
static void CM_LoadEntityString (const byte *data, const lump_t *l) {

cm_numEntityChars = l->fileLen;
if (cm_numEntityChars < 1)
return;
if (cm_numEntityChars > MAX_MAP_ENTSTRING)
Com_Error (ERR_DROP, "CM_LoadMap: map '%s' has too large entity lump ", cm_map);

cm_entityString = Hunk_Alloc (cm_numEntityChars + 1);
memcpy (cm_entityString and data + l->fileOfs and cm_numEntityChars);
}

so I need to manipulate the string cm_entityString to find the info_player entities and change his origins in Z axis.

r1ch, where exact you do this change on your code? I didn't found anything similar... maybe you done in another way?

thanks again!
Logged
hajas
Member

Posts: 44



« Reply #28 on: June 10, 2007, 10:56:13 am »

hmmm.... you didn't replace just the altered entities, you just replace everything right?  huh

that's why I'm not finding anything about it!  rolleyes
Logged
hajas
Member

Posts: 44



« Reply #29 on: June 10, 2007, 11:54:16 am »

well, I got this:

Quote
/*
 =================
 CM_LoadEntityString
 =================
*/
static void CM_LoadEntityString (const byte *data, const lump_t *l){

   char   *game = Cvar_VariableString("fs_game"); // declara game - Hajas

   cm_numEntityChars = l->fileLen;
   if (cm_numEntityChars < 1)
      return;
   if (cm_numEntityChars > MAX_MAP_ENTSTRING)
      Com_Error(ERR_DROP, "CM_LoadMap: map '%s' has too large entity lump", cm_map);

   cm_entityString = Hunk_Alloc(cm_numEntityChars + 1);
   memcpy(cm_entityString, data + l->fileOfs, cm_numEntityChars);

   if (!Q_stricmp(game, "arena")){
      // do string manipulation over cm_entityString
   }
}

anyone can help with string manipulation functions in C? I don't work with that for more than 8 years...  undecided

I found another problem... WTH!!!

Quote
{
"origin" "-256 248 16"
"classname" "info_player_deathmatch"
}
{
"classname" "info_player_deathmatch"
"origin" "248 256 16"
}

seams that the origin info could be below or above classname, so will be impossible to find the exact origin to each class...  angry

by the other hand, this make me think one thing... RA2 remove ALL entities from the map aside the spawnpoints.

so, we just add 15 to all origins... will not make any difference since this will only happen in RA2.

so will be a easier code to do that...  evil
Logged
Pages: 1 [2] 3  All
Print
r1ch.net  |  General  |  General Discussion  |  Topic: Trying to fix the Siamese Twins problem...
Jump to:  

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines