Page 1 of 2

Fun names and skins in FrikBotX

Posted: Sun Sep 27, 2015 2:40 pm
by wildstoo
Total programming neophyte here. Be gentle.

How would I go about giving the frikbots "fun names"?

I've tried just putting the high-ASCII values in the bot_misc.qc file but it looks like the compiler (FrikQCC or FTEQCC) is mangling them. I'm pretty much lost at this point.

Better yet, how might I read a list of "fun" names from an external text file and pick a random one for each bot?

Also, skins. Is it possible to make the bots choose a random skin (again, from an external text file, or even scanning the skins dir)? I feel like the FrikBots should be better dressed.

Thanks for reading my pathetic questions!

Re: Fun names and skins in FrikBotX

Posted: Sun Sep 27, 2015 3:35 pm
by Spike
fteqccgui internally utilises utf-8 text. the text editor stuff should all do unicode copy+paste stuff.
when saving, it is meant to utilise the same BOM that was originally used when opening the file, but there may be some char conversions if you had saved your file as utf-16, and these may fail if you have invalid encodings.
pasting fun chars from external tools that generate non-unicode 'quake-encoded' chars will be assumed to be whatever your current locale is and result in utf-8 codepoints when pasted into fteqccgui (and later compiled into qc strings). the file will then be saved as utf-8 without a bom (unless the file originally had one).

additionally, it is basically impossible to get microsoft's text editors (wordpad+notepad) to use the same utf-8 encoding that the file was originally saved with. they have a nasty tendancy to strip boms and convert encodings (at least when the extension is not .txt).

thus stick to ascii only. it is just not practical nor reliable to support other character encodings in windows.
you can directly encode specific quake char values in qc strings with \xXX, you can toggle between white/red chars with \s, and you can get 'golden numbers' with \0-9. Doing this will typically be more readable in the first place, and will not have any svn / git conversion issues, etc.


regarding skins, by the 'the skins dir', you mean you're doing this in quakeworld?
writebyte(MSG_ALL, svc_setinfo);
writebyte(MSG_ALL, self.colormap-1);
writestring(MSG_ALL, "skin");
writestring(MSG_ALL, "omgwtf");
where omgwtf is the string name to utilize.
you can use search_begin/search_end/search_getsize/search_getfilename to enumerate files inside a given path (if the server supports that - read: fte or dp, but dp doesn't do qw). or you can use frik_file's fopen etc functions to read allowed names from a file.

if you're focusing on NQ, skins are embedded into the mdl itself (and are selected by setting self.skin, like on armour pickups) and there is no way to tell how many skins are stored inside it, except with fte where there is the skintoname builtins which might be useful to you (null and empty results have distinct meanings, depending on model formats). some clients support replacement textures beyond the skins stored internally to the model and in this case you can use the file enumeration stuff I already mentioned for those, the exact names used depends on the client.
this won't work if you have dedicated servers or anything, of course, as the files need to be clientside and nq clients don't download. yay csqc? :s

Re: Fun names and skins in FrikBotX

Posted: Sun Sep 27, 2015 5:40 pm
by wildstoo
Hi Spike, thanks for the reply.

I tried to name a bot "Earthcrosser", styled like this:

Image

So, there seem to be three ways to encode this:
  1. œEárôhãrïsóeòœ
  2. \x85E\xe1r\xf4h\xe3r\xefs\xf3e\xf2\x85
  3. \x85E\sa\sr\st\sh\sc\sr\so\ss\ss\se\sr\x85
So, I converted bot_misc.qc from UTF-8 to "ANSI" (8-bit extended ASCII) in Notepad++ and simply pasted the extended ASCII in (œEárôhãrïsóeòœ) and hit compile.

It worked! :surprised: I think I'll probably use the third option in the end. It might be the longest but it's also the most legible (or the least illegible anyway!) and there's no issues with the char encoding so the qc can remain UTF-8.

I've modified the Online Quake Name Maker to output the \xXX encodings and make it slightly less painful to design names this way :P

And urrgh. I forgot NQ didn't support external skins. Guess I'll try packaging a few skins into the MDL and experimenting.

Cheers.

Re: Fun names and skins in FrikBotX

Posted: Sun Sep 27, 2015 8:32 pm
by wildstoo
Lol. I think I fundamentally misunderstood skingroups in QME and ended up with the bots cycling through the skins every 0.1 seconds. It was pretty funny.

Back to the drawing board.

Re: Fun names and skins in FrikBotX

Posted: Sun Sep 27, 2015 8:44 pm
by wildstoo
Wish you could edit posts here rather than a new post every time.

Anyway, it's working with the slight drawback that when bots die their corpses revert to the base skin and even the base colours. No idea why.

Still, it's progress.

Re: Fun names and skins in FrikBotX

Posted: Sun Sep 27, 2015 9:46 pm
by r00k
Lol. I think I fundamentally misunderstood skingroups in QME and ended up with the bots cycling through the skins every 0.1 seconds. It was pretty funny.
that would be kinda cool looking. Ive had the idea in the past to use the frikbot core but for monsters vs players on a CA/DM style map / mod

Re: Fun names and skins in FrikBotX

Posted: Mon Sep 28, 2015 4:23 am
by frag.machine
wildstoo wrote: Wish you could edit posts here rather than a new post every time.

Anyway, it's working with the slight drawback that when bots die their corpses revert to the base skin and even the base colours. No idea why.

Still, it's progress.
That's because when a player/bot dies it spawns another entity for the corpse, and the colormap and skin values are not being copied. Check the BodyQueue() function for more details.

Re: Fun names and skins in FrikBotX

Posted: Mon Sep 28, 2015 10:45 am
by wildstoo

Code: Select all

// make a body que entry for the given ent so the ent can be
// respawned elsewhere
void(entity ent) CopyToBodyQue =
{
	bodyque_head.angles = ent.angles;
	bodyque_head.model = ent.model;
	bodyque_head.modelindex = ent.modelindex;
	bodyque_head.frame = ent.frame;
	bodyque_head.colormap = ent.colormap;
	bodyque_head.movetype = ent.movetype;
	bodyque_head.velocity = ent.velocity;
	bodyque_head.flags = 0;
	setorigin (bodyque_head, ent.origin);
	setsize (bodyque_head, ent.mins, ent.maxs);
	bodyque_head = bodyque_head.owner;
};
Something tells me it's not as simple as adding a line like:

bodyque_head.skin = ent.skin;

...and clearly colormap is there, which doesn't explain why the colormap of the bots isn't being copied.

:confused:

Re: Fun names and skins in FrikBotX

Posted: Mon Sep 28, 2015 10:54 am
by wildstoo
Oh. That line did fix it. Sweet.

Re: Fun names and skins in FrikBotX

Posted: Mon Sep 28, 2015 9:16 pm
by wildstoo
So close; working almost perfectly. Some well-dressed bots in here. Just one little problem that I'll explain below.

Image
Image
Image
Image
Image
Image


Here's the problem: when the bots are gibbed, the head models seem to be unskinned. They show up light blue and black.

Image
Image
Image

Strangely, my OWN head gib is fine. If a bot gibs me the head looks normal. It only seems to affect the bots.

Image

Any ideas? :P

Re: Fun names and skins in FrikBotX

Posted: Tue Sep 29, 2015 2:21 am
by frag.machine
That's easy to fix: when a player/bot is gibbed (damage below -40 IIRC) the player.mdl is replaced by h_player.mdl, a completely different model, without the skins you added.
You have 2 options:
a) add new skins for the h_player.mdl model, matching the ones in the player.mdl; or
b) when the player is gibbed, you force the .skin to be 0 (the default one).

Re: Fun names and skins in FrikBotX

Posted: Tue Sep 29, 2015 11:58 am
by wildstoo
Thanks, frag.machine.

Option a) sounds easy enough. I could probably even script it with ImageMagick or something to autogenerate head gib skins from the player skins, depending on how different they are.

My next cunning plan is to add a small header to the FrikBotX waypoint files containing the recommended number of bots for each map. I.e. some maps will cope with 16 players without being insane, while some smaller maps are more suited to 4 players, etc.

Maybe even have a menu pop up with options at map start. Something like:
  • Duel (1 bot)
  • Relaxed (3 bots)
  • Normal (6 bots)
  • Frantic (10 bots)
  • Insane (16 bots)
Have the numbers/categories change to suit the map. Hit 4 and 10 bots appear.

Just an idea.

Re: Fun names and skins in FrikBotX

Posted: Tue Sep 29, 2015 11:59 am
by wildstoo
The one time I don't click Preview. :/

Re: Fun names and skins in FrikBotX

Posted: Wed Sep 30, 2015 1:51 pm
by frag.machine
Unfortunately the player.mdl and h_player.mdl skins are different enough to make the reuse impractical. I remember seeing a generic gibbed head skin (without any face or helmet, just a blood-splattered skull) many moons ago that could be useful in this case.

Re: Fun names and skins in FrikBotX

Posted: Thu Oct 01, 2015 1:38 pm
by wildstoo
Is there a command-line tool for modifying .mdl files?

All I want to do is take a standard player.mdl and h_player.mdl and dump 16 or so skins into each of them. If there isn't such a tool, how hard do you think it would be to create one?

Is the .mdl file format fairly simple? Like, is there a header that has an index of skin textures and offsets or something?