Page 1 of 3

CoopTranslocator

Posted: Thu Jul 09, 2020 12:10 pm
by Buggie
CoopTranslocator for Monster Hunt.

Allow you choose teammate and teleport to him.
Also it support bots, so you can use it, for example, play with bots in MonsterHunt - set all bots to cover you, and you good to go, regardless of bot support on the map itself.

You can preview all of your teammate before teleport.

Each player get CoopTranslocator at start.
scr_1594292463.png
scr_1594292467.png
Spoiler
If other CoopTranslocator found in Inventory then it is destroyed.

Difference from original:
1. You can preview players.
2. Green texture near teleporter for distinguish from usual teleporter.
3. Fixed a lot of bugs.
4. If player moves up in lift you can not tele. (For prevent kill him)
5. If string(PRI.bCoopTeleDisable) == "True" you can not tele. (For extends by some server via function "disable/enable tele to me")
6. If you can not tele - description provided.
7. Clean up code.
8. Set rotation to target.
9. The teleportation point is located above the target and slightly behind.
10. Press Fire + Alt fire for return back to prev weapon.
11. And a lot other small improvements.
CoopTranslocator.rar
(1.99 MiB) Downloaded 70 times
CoopTranslocator2: https://ut99.org/viewtopic.php?p=121122#p121122
CoopTranslocator3: https://ut99.org/viewtopic.php?p=121844#p121844
CoopTranslocator4: https://ut99.org/viewtopic.php?p=121901#p121901
CoopTranslocator5: https://ut99.org/viewtopic.php?p=121929#p121929
CoopTranslocator6: https://ut99.org/viewtopic.php?p=125454#p125454
CoopTranslocator7: https://ut99.org/viewtopic.php?p=125628#p125628
CoopTranslocator8: https://ut99.org/viewtopic.php?p=128873#p128873
CoopTranslocator9: https://ut99.org/viewtopic.php?p=129177#p129177
CoopTranslocator10: https://ut99.org/viewtopic.php?p=129341#p129341
CoopTranslocator11: https://ut99.org/viewtopic.php?p=130375#p130375
CoopTranslocator12: https://ut99.org/viewtopic.php?p=130842#p130842

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 2:00 pm
by Barbie
It would have been nice if you had given the source code also to the package.

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 2:10 pm
by OjitroC
How do you get the preview of teammates? I've tried the translocator out in a MH game with one bot but I can't get the preview (nor the thing itself) to work.

Perhaps a readme would be useful too - to describe the features and use of the translocator?

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 3:39 pm
by Buggie
Barbie wrote: Thu Jul 09, 2020 2:00 pm It would have been nice if you had given the source code also to the package.
Hmm. Generally you can view it inside .u package via any viewer. Or use UnrealEd for this.
But ok, I will include source later.
OjitroC wrote: Thu Jul 09, 2020 2:10 pm How do you get the preview of teammates?
It is work for humans only. Not for bots. But if you want test in practice mode, you can type in console

Code: Select all

set CoopTranslocator.CoopTranslocator TargetPawnClass class'Bot'
For Practice session and watch bots.

After select CoopTrans fire button activate choose mode. Each fire click switch to next teammate.
Click AltFire for tele to selected teammate. If you fail because him move up in lift, or not enough space above him, you can press again again, until tele will be possible.

Press Fire+AltFire for return back to previous weapon.

Usually you need press back on teleport for not get friendly fire from teammate.

Teams not respected, because no such thing as team in MH. You all together even if you Red and Blue "teams".

------ ADDED --------

Archive in first post updated. Added readme, screens, source.

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 4:26 pm
by OjitroC
Buggie wrote: Thu Jul 09, 2020 3:39 pm It is work for humans only. Not for bots. But if you want test in practice mode, you can type in console

Code: Select all

set CoopTranslocator.CoopTranslocator TargetPawnClass class'Bot'
For Practice session and watch bots.
Oh right - I'll do that - thanks :tu:

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 11:19 pm
by Barbie
Buggie wrote: Thu Jul 09, 2020 3:39 pmHmm. Generally you can view it inside .u package via any viewer. Or use UnrealEd for this.^
Yes, I also know UTPT, but it is much easier to access the source directly than extracting it through any program. And it takes more time to extract or view the code with a normal editor and hereby is the danger to overlook something. Also you can never be sure that the text code is identical to the compiled byte code. UTPT often fails in uncompiling loops.
Buggie wrote:I will include source later.
Thanks! :tu:

Buggie wrote:Teams not respected, because no such thing as team in MH. You all together even if you Red and Blue "teams".
Actually this is true, but not necessarily. In the early days of my server I gave players possibility to switch team, but this means that player of different teams are enemies: TeamCannons reacts different, the EightBall gun locks in and also full damage is applied instead of reduced team damage.
But I don't know any MH server that has implemented different teams so this argument is only hot air. 8)

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 11:26 pm
by Buggie
Barbie wrote: Thu Jul 09, 2020 11:19 pmAlso you can never be sure that the text code is identical to the compiled byte code. UTPT often fails in uncompiling loops.
.u just contain all source code in text (except default props). I highly doubt about any "decompilers". Most (if not all tools) show just this text, no any decompile.

Re: CoopTranslocator

Posted: Thu Jul 09, 2020 11:30 pm
by Barbie
The decompiled code of UTPT is often different to that what is stored as text code. That's the proof for me that UTPT translates the byte code to UScript.

Re: CoopTranslocator

Posted: Fri Jul 10, 2020 6:25 am
by sektor2111
Default properties can be seen in UC "decompilations" and/or examining assets in Editor.

Re: CoopTranslocator

Posted: Tue Jul 14, 2020 11:49 am
by Buggie
Second version.

- Now you can see self on players preview.
- Count tiles depends from your screen size. Tile can not be less 320*240 px.
- Bots now supported out of box.
- Small improvements.
CoopTranslocator2.rar
(360.94 KiB) Downloaded 36 times

Re: CoopTranslocator

Posted: Thu Aug 13, 2020 12:40 am
by Barbie
I've installed your version 2 of the CoopTanslocator and sadly have to report some issues:
1) When CoopTanslocator is activated, in the upper left corner I see the muzzle fire of mini guns, probably of other players (see pic). Also some Translocator lights are visible.
2) I think the selection frame follows the player names in alphabetical order, but the mini view windows are not in this order. So when using the selection, the red frame hops around from here to there. It should go from top to right and then to next row (or otherwise).
3) Another player reports that the red frame is not moving. If he switches from OpenGL to DirectX, it works.

Is it possible to reduce the amount of preview windows to one only? The cherry: the user could set size and position.

Re: CoopTranslocator

Posted: Thu Aug 13, 2020 7:11 am
by Buggie
1) UT bug. All of this draw without offset. So only if portal located at 0, 0 then look like supposed.
2) Frame order is follow original CoopTranslocator order. xD No order at all. Order which return AllActors. Maybe I later make some kind of sort.
Selection order is follow original CoopTranslocator order. Order by PawnList on server side. Maybe I later make some kind of sort.
Current approach is faster in any case.
3) Strange. I check it later. IDK what is that.

4) I can make this as some sort of setting. But idea is fast find where is all players, find nearest to close desired location, select him and tele.
Size and pos: Maybe in future.

Re: CoopTranslocator

Posted: Sat Aug 15, 2020 7:17 am
by Buggie
Bug from v469 closed betatester forum:

[win][08Aug2020][Regression]UT stop render CoopTranslocator tiles after some time

Reproduce:
1. Start UT.
2. Enter to BarbieWorld MH server (81.169.240.101:7777) when exists another players.
3. Respawn, switch to CoopTranslocator (press 1).
4. Activate it by fire button.
5. Now you must see other players tiles.
6. Watch and wait.

Expected result: Tiles visible all time. When you press fire, selection red border switch between players (if tiles > 2 of course).
Actual result: After some time (usually near minute) all tiles disappear. When you press fire, nothing changes expect selection sound. Only one fix - reconnect to server. All other not help. Reconnect help temporary.

v436: not bugged.
v469: bugged.

I use D3D9 Render. In both UT (v436 and v469).

No any log messages in game log window. Tiles just stop draw.

I try reproduce this without Barbie server with CoopTranslocator2 mutator, but fail.
IDK where is problem reason.

-------

Tiles disappear after announcer message with random reward message.

------

Code from BarbieWorld.u for render tiles:

Code: Select all

simulated function PostRender(Canvas C) {
	local Actor actor;
	local Pawn tp;
	local Pawn player[32];
	local int i, j, cnt, tiles, tileX, tileY, x, y, size;
	local string label;
	
	if (!bTTargetOut) {		
		if (true) { // draw texture for distinguish CoopTranslocator from usual translocator
			y = c.ClipY/8;
			C.Style = ERenderStyle.STY_Translucent;
			C.SetPos(c.ClipX/16, c.ClipY - y);
			C.DrawRect(Texture'UnrealShare.MenuBarrier', C.ClipX*3/8, y);
		}
		return;
	}
	
	if (FirstFont == None) FirstFont = class'FontInfo'.Static.GetStaticSmallFont(C.ClipX);
	if (FirstFont != C.Font) C.Font = FirstFont;
	C.Style = ERenderStyle.STY_Normal;
	
	cnt = 0;
	ForEach AllActors(TargetPawnClass, actor) {
		if (!canBeTarget(Pawn(actor))) continue;
		player[cnt++] = Pawn(actor);
	}

	tiles = 2;
	if (cnt > 3) tiles = 3;
	if (cnt > 8) tiles = 4;
	tileX = c.ClipX/tiles;
	tileY = c.ClipY/tiles;

	for (i = 0; i < cnt; i++) {
		if (player[i].PlayerReplicationInfo == TargetPRI) {
			if (i > 15) {
				tp = player[15];
				player[15] = player[i];
				player[i] = tp;
				i = 15;
			}
			j = i;
			break;
		}
	}

	for (i = 0; i < cnt; i++) {
		if (i <= 15) {
			x = ((i + 1) % tiles)*tileX;
			y = ((i + 1)/tiles)*tileY;
			C.DrawPortal(x, y, tileX, tileY, player[i], player[i].Location - 100*(vect(1,0,0) >> player[i].Rotation), player[i].Rotation);
			if (j == i) { // selection
				size = 5;
				C.DrawColor.R = 255; C.DrawColor.G = 0; C.DrawColor.B = 0;
				C.SetPos(x, y + 20);
				C.DrawRect(Texture'Botpack.AmmoCountJunk', TileX, size);
				C.SetPos(x, y + TileY - size);
				C.DrawRect(Texture'Botpack.AmmoCountJunk', TileX, size);
				C.SetPos(x, y + 20);
				C.DrawRect(Texture'Botpack.AmmoCountJunk', size, TileY - 20 - size);
				C.SetPos(x + TileX - size, y + 20);
				C.DrawRect(Texture'Botpack.AmmoCountJunk', size, TileY - 20 - size);
			}
			C.SetPos(x, y);
			C.DrawColor.R = 0; C.DrawColor.G = 0; C.DrawColor.B = 0;
			C.DrawRect(Texture'Botpack.AmmoCountJunk', TileX, 20);
			C.SetPos(x, y);
			C.DrawColor.R = 255; C.DrawColor.G = 255; C.DrawColor.B = 0;
			label = " " $ player[i].PlayerReplicationInfo.PlayerName $ " (" $ 
				int(player[i].PlayerReplicationInfo.Score) $ ") " $ player[i].Health $ "hp";
			if (player[i].Weapon != None) label = label @ player[i].Weapon.class.name;
			C.DrawText(label);
		}
	}
}
------
Also even if tiles disappear I can select cooptrans and see green texture around it.
So code in
if (!bTTargetOut) {
run properly.
----
Anth found cause. And fix it for next build of v469.

Re: CoopTranslocator

Posted: Sat Aug 15, 2020 4:58 pm
by Buggie
3 version.

- Tiles and selection order now in alphabetical order by player name.
- Better network code.
- Text message about selection as fallback if tiles failed.
- Fix issue with v469.
- Add gaps for HUD chat area (nexgen) and weapons at bottom.
CoopTranslocator3.zip
(362.88 KiB) Downloaded 20 times
QuickSort
Also here is Quick Sort implementation if anyone need.
Taken from http://www.unreal.ut-files.com/3DEditin ... ksort.html
And optimized:

Code: Select all

// http://www.unreal.ut-files.com/3DEditing/Tutorials/unrealwiki-offline/quicksort.html
static Function SortPlayers(CoopTranslocator trans, Int Low, Int High) { //Sortage
//  low is the lower index, high is the upper index
//  of the region of array a that is to be sorted
	local Int i,j;
	local String x;
	Local Pawn tmp;

	i = Low;
	j = High;
	x = trans.player[(Low+High)/2].PlayerReplicationInfo.PlayerName;

	do { //  partition
		while (trans.player[i].PlayerReplicationInfo.PlayerName < x) i += 1; 
		while (trans.player[j].PlayerReplicationInfo.PlayerName > x) j -= 1;
		if (i <= j) {
			tmp = trans.player[j];
			trans.player[j] = trans.player[i];
			trans.player[i] = tmp;
			
			i += 1; 
			j -= 1;
		}
	} until (i > j);

	//  recursion
	if (low < j) SortPlayers(trans, low, j);
	if (i < high) SortPlayers(trans, i, high);
}

Re: CoopTranslocator

Posted: Wed Aug 19, 2020 2:06 am
by Buggie
4 version.

- Fix accessed None if player only one on map.
- Place CoopTranslocator after usual Translocaltor in inventory, so when you press "1" first appear Translocator, second - CoopTranslocator.
CoopTranslocator4.zip
(363.16 KiB) Downloaded 22 times