madmax
-
Posts
165 -
Joined
-
Last visited
Posts posted by madmax
-
-
ok, I did a git reset :
abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification)
$ git reset
..
.....
abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification)
$ git pull zootzoot attack-notification
From https://github.com/zootzoot/0ad
* branch attack-notification -> FETCH_HEAD
Already up-to-date.
abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification)
$
So all seems good now. I ll check if I have zoot's latest changes.
-
Working on this one again today. Just updating my code from zoot's repo.
ok, right away I have messed up something. So for updating the code I switched to the attack-notification branch :
$ git checkout attack-notification
$ git pull zootzoot attack-notification
$ git pull k776-master master
abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification|MERGING)
$ git pull k776-master master
The I realized I probably don't need to update from master as it will erase all changes from zootzoot. I knew it the minute I saw that curious MERGING thing at the branch name.
Now if I do
$ git pull zootzoot attack-notification
I get an error :
...
.....
M source/third_party/mongoose/mongoose.cpp
M source/tools/dist/build.sh
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
How do I fix this now
I want to get back to the current state of the attack-notification branch which has pulled in all zoot's changes.
-
Looks good. I ll check and put up that diff.
-
Does anyone know about the various co-ordinates system in use. As far as I can see there are 2 :
world-coords : Used to locate entities on the 0ad map, has x,y & z
screen-coords: Only x & y, used to locate mouse pointer, minimap click point etc.
So everything is actually fine till :
function handleMinimapEvent(target)
{
..
...
case "set-rallypoint":
Engine.PostNetworkCommand({"type": "set-rallypoint", "entities": selection, "x": target.x, "z": target.z});
// Display rally point at the new coordinates, to avoid display lag
Engine.GuiInterfaceCall("DisplayRallyPoint", {
"entities": selection,
"x": target.x,
"z": target.z
});
return true;
...Also if I understand correctly, void CMiniMap::GetMouseWorldCoordinates(float& x, float& z) will convert the mouse screen-coordinates to the 0ad world coods so the rally point on the terrain can be located ?
void CMiniMap::GetMouseWorldCoordinates(float& x, float& z)
{
// Determine X and Z according to proportion of mouse position and minimap
CPos mousePos = GetMousePos();
float px = (mousePos.x - m_CachedActualSize.left) / m_CachedActualSize.GetWidth();
float py = (m_CachedActualSize.bottom - mousePos.y) / m_CachedActualSize.GetHeight();
float angle = GetAngle();
// Scale world coordinates for shrunken square map
x = TERRAIN_TILE_SIZE * m_MapSize * (m_MapScale * (cos(angle)*(px-0.5) - sin(angle)*(py-0.5)) + 0.5);
z = TERRAIN_TILE_SIZE * m_MapSize * (m_MapScale * (cos(angle)*(py-0.5) + sin(angle)*(px-0.5)) + 0.5);
} -
Hmm so in input.js the code is as follows :
function handleMinimapEvent(target)
{
// Partly duplicated from handleInputAfterGui(), but with the input being
// world coordinates instead of screen coordinates.
if (inputState == INPUT_NORMAL)
{
var fromMinimap = true;
var action = determineAction(undefined, undefined, fromMinimap);
if (!action)
return false;
....
..........I tried making it :
function handleMinimapEvent(target)
{
// Partly duplicated from handleInputAfterGui(), but with the input being
// world coordinates instead of screen coordinates.
if (inputState == INPUT_NORMAL)
{
var fromMinimap = true;
var action = determineAction(target.x, target.z, fromMinimap);
if (!action)
return false;Doesnt seem to work though. I think the call to targets = Engine.PickEntitiesAtPoint(x, y) in determineAction() is the key here. Unless Engine.PickEntitiesAtPoint() gets called and returns valid targets the rally point cant be set.
-
Hmm was looking at
function determineAction(x, y, fromMinimap)
It seems the mouse x, y that gets passed in is undefined.
If I right click on the world somewhere then the x, y is passed in correctly so the rally point is set. But if I right click on the minimap then the x,y is undefined. Seems like the code that sets the rally point is not the issue. But the interpretation of the mouse position when right clicked on the minimap is the problem.
-
Well it seems units run away from the projected discomfort region in the video. Maybe surround the formation with a ring of discomfort ? And move this ring forward along the main path.
Lol !
So is this algorithm or an implementation publicly available ?
-
So to carry on this discussion CMiniMap::FireWorldClickEvent() seems to be sending a ScriptEvent("worldclick", coords);
Where would this event be received in the JS ?
------
ok its received in gui/session/session.xml and sent to handleMinimapEvent
-
Code patch added for review for #1719
Really nice to see this real time collaborationYep and now on to the next beginner must have feature !!
-
ok, I ll make a diff with Tortoise SVN and attach it to the ticket then
-
So how about sending this code for review. If its in the main code then probably people can try it more easily.
-
Ah yeah, the weapon sounds you mean. Hmm. Well the position of the camera is gettable I guess. Somewhere in CGameView there would probably be a function. I am not sure in terms of what it will return it though. Probably 3D co-ordinates which will need to be converted to the co-ordinates being used by the sim JS code.
Well lets see what others say about attack notification suppression in camera view.
I mean there are cases where its useful, like if the attack is happening on an entity at the edge of the map by say an archer while there are your own archers also firing at something in the middle of the screen. The player may not notice as the attacking weapon sound and the player's weapons sounds are the same...arrows whooshing through the air.
-
Well AoE doesnt, though the sound does start after about 1 or 2 seconds. I think if the player is maneuvering close to the enemy he may want to notified by sound immediately if any unit it attacked. Especially if the number of units is large and the camera view is large. The minimap's little blinking dot may not immediately attract attention.
-
-
yep shore !
-
reduced max ping frames to 500
-
-
Probably the alpha setting. Let me check the code in this region again. Alpha blending is turned off though, so I wonder.
-
ok, well lets keep that then. I ll remove x & z from the C++ side.
So what next ? I have done the template modifications too.
-
ok. Whats the time parameter. Is it the number of turns ?
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:4800
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:5000
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:5000
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:5200
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:5400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:5400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:5400
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:5800
WARNING: User Player:1: Message received of Attack on entity 136 of player 1 at (5811604, 8604536), time:6800
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:7000
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:7200
WARNING: User Player:1: Message received of Attack on entity 33 of player 1 at (5765249, 8206359), time:7400
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:7400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:7400
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:7600
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:9000
WARNING: User Player:1: Message received of Attack on entity 89 of player 1 at (7070392, 7018728), time:9200
WARNING: User Player:1: Message received of Attack on entity 135 of player 1 at (5695624, 8374201), time:9400
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:9400
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798), time:11000
WARNING: User Player:1: Message received of Attack on entity 33 of player 1 at (5765249, 8206359), time:11400
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:11400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:11400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:11400
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:11400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:12600
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:13200
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:13400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:13400
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875), time:15400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:15400
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166), time:15400
Engine exited successfully on 2013-04-06 at 15:22:29 with 363 message(s), 0 error(s) and 32 warning(s). -
ok, yeah I 'll reduce MAX_PING_FRAMES.
-
ok committed the change: https://github.com/l...e56deb19968385d
We do not use the x & z values currently, but they seems to be rather high :
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798)
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798)
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798)
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166)
WARNING: User Player:1: Message received of Attack on entity 88 of player 1 at (7054144, 7241875)
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166)
WARNING: User Player:1: Message received of Attack on entity 87 of player 1 at (7027570, 7654166)
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798)
WARNING: User Player:1: Message received of Attack on entity 136 of player 1 at (5811604, 8604536)
WARNING: User Player:1: Message received of Attack on entity 35 of player 1 at (5777253, 7678798)Are they being passed as this high from JS or is it a conversion problem I wonder.
-
no problemo Enjoy your coffee
-
Yes I have the player id now. Hopefully in a multiplayer it will return the player id of the current user's player correctly
case MT_EntityAttacked:
{
const CMessageEntityAttacked& data = static_cast<const CMessageEntityAttacked&> (msg);
if (!g_Game)
break;
int player = g_Game->GetPlayerID();
m_Active = true;
m_X = data.x;
m_Z = data.z;
m_PingEntity = true;
m_PingCount = MAX_PING_FRAMES;
LOGWARNING(L"E:%d, Message received of Attack ! x:%d, z:%d", data.entity, data.x, data.z);
break;
}Now to verify if the attacked entity belongs to this player. Is it possible to pass the player who was attacked from JS ? Then all I would need to do is a simple comparison.
Attack notification
in Game Development & Technical Discussion
Posted · Edited by madmax
Hmm, that reset doesnt seem to have fixed it. The git diff is showing up a lot of changes that I never made. Maybe some other command is needed.
ok did a git checkout .
Phew, got to be more careful with this.