Topic: minimap and stuff...

turan on March 09, 2012, 02:22:14 AM

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
Hi there,

i just wanted to ask something about the minimap and some other stuff regarding side effects.

Do you already have ideas/concepts/someone working on a new version of it?

At the moment I'm trying to learn the Ogre/CEGUI stuff and get the big picture of OGRE projects in general and this one in particular. I've managed to setup and successfully compile the latest sumwars sources with eclipse CDT and CMake under ubuntu ( I could provide a simple howto if you wish ... its actually very easy to do this ;) )

However, first of all I wanted to ask if it wouldn't make more sense to create the mini map window from a XML source file, instead of hard coding it into the core? Because to my understanding it isn't more than a scaled down "TaharezLook/Frame" Window with some frame features disabled and little alpha tweaking at the moment? Isn't it more flexible to have this done via XML? Please correct me if I'm wrong. As i stated before I've justed started to look into the OGRE/CEGUI stuff, so please forgive me if I don't see some of the possibilities/features/advantages of coding it into the core.

The other thing I'd like to ask about the mini map is more kind of a mockup approach.
Is it possible to obtain  the exact position of the world objects providing the borders ( fences, stone and cave walls ) to draw (white?) lines on a scaled down, transparent frame representing them?(without too much overhead and/or breaking the projects layout<->Scene Manager?)? (see attached screen shot)

If this approach is a practicable one, isn't it then possible to obtain the walking direction data from a pair of two (time different) positions of the character relative to the scene, compared to each other? to draw a heading indicator for the mini map?

It would be really nice if someone could point me into the right direction how to obtain the above mentioned positioning data in a project compatible way. If not to be used by you directly, then at least for my learning curve ;)
 
These are  the questions about the mini map that I have at the moment.
I have another question regarding (unlikely) possible side effects from the use of
Code: [Select]
chdir(passed_path.c_str()); without passing the return value to a variable(during the determination of the working directory path in main_gui.cpp at lines 58 and 73). To just silencing the compiler I've replaced  the mentioned lines with
Code: [Select]
int result = chdir(passed_path.c_str());That leaves this 'result' var unused too, but I've asked me, if the whole path determining process couldn't be redeigned to use this return val. I wouldn't like to take the "compile with -Wno-unused-function" approach to avoid GCC warnings under linux.

Would be nice if you guys could think of a fix, because I want to write  a little installer like shell script for personal use, to auto apt-get dependencies/compile and install sumwars witch will have zenity(http://wiki.ubuntuusers.de/Zenity) dialogs in it... And cmake output, without warnings is far easier to parse( for the use in a zenity progressbar)  ;)


That's it. I hope you guys answer me  :)

Greetz
 Turan

« Last Edit: March 09, 2012, 03:54:23 AM by turan »
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged
  • Read 8538 times
  • Category Programming
Comments: 30

turan on March 10, 2012, 06:36:38 AM
Reply #1

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
EDIT:
playing arround with the minimap.cpp file, i've delayed the pursuit of (re)drawing the outer lines of the world objects for the moment, as i realized that the current map is actually a scaled down frame where you continuously positioning a label according to the players position in the world.
I must admit that i laughed a little bit at that approach :D But respect! i guess it's work with what you have at hand isn't it ?  ;)

But anyway, i stumbled across the label->setRotation() routine, witch takes a 3DIM vector as argument. As the Z-Axis argument of that Vector, could always be 0 (because of the 2D nature of the minimap scene), i thought if there isn't a way to obtain the player's world orientation and use that vector together with the Z-Axis Argument  = 0 to construct the 3DIM vector, witch the setRotation function expects as argument to proper yaw the label on the minimap? together with an arrow like image for the label (label->setProperty("Image", "set:TaharezLook image:MouseNoSoCursor") for example, do you think that could work as a heading indicator?

In general i didn't figured out yet:
How do i reference the player node to get the Orientation? How is this done for the normal mouse click movement at all ? I mean the player always faces the the mouse click direction - how can i obtain these orientation informations?

I'm a java man so the hole pointer madness isn't that simple to me. a little help is appreciated  ::)

greetz
 turan

EDIT:
OK, given that the Z-Axis is towards you before the monitor  - it's the x and y arguments of the 3 DIM Pointer who can be 0. Where's the right place to implement a function to return the orientation angle? in player(base).cpp ?
« Last Edit: March 11, 2012, 07:43:19 AM by turan »
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

Lastmerlin on March 11, 2012, 02:08:29 PM
Reply #2

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
EDIT:
playing arround with the minimap.cpp file, i've delayed the pursuit of (re)drawing the outer lines of the world objects for the moment, as i realized that the current map is actually a scaled down frame where you continuously positioning a label according to the players position in the world.
I must admit that i laughed a little bit at that approach :D But respect! i guess it's work with what you have at hand isn't it ?  ;)
Yes, the minimap _is_ a horrible hack x( . I never had the time and Ogre programming skills to do something better...

But anyway, i stumbled across the label->setRotation() routine, witch takes a 3DIM vector as argument. As the Z-Axis argument of that Vector, could always be 0 (because of the 2D nature of the minimap scene), i thought if there isn't a way to obtain the player's world orientation and use that vector together with the Z-Axis Argument  = 0 to construct the 3DIM vector, witch the setRotation function expects as argument to proper yaw the label on the minimap? together with an arrow like image for the label (label->setProperty("Image", "set:TaharezLook image:MouseNoSoCursor") for example, do you think that could work as a heading indicator?
In 2D, we have only one angle (the rotation along Y, which is the height direction). It can be obtained by:
Code: [Select]
m_document->getLocalPlayer()->getShape()->m_angle;
Depending on position in code, the result of the first fucntion should be tested to be not NULL. Most probably, an already checked Player* pointer is already available.
Logged

turan on March 11, 2012, 11:24:43 PM
Reply #3

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
hi LastMerlin,

very much thank you for the "m_angle"hint :)
After messing around with CEGUI::MouseCursor Vectors and arc2 mathematics,  that finally pointed me in the right direction i think ...  ;D
and yes, there's an existing pointer. I've used that one  ;)

I nearly archived what i wanted to do. Though if you say, that you aren't pleased with the mini map as it is at the moment, I don't know if you want to use it. But have a look at yourself:

what i did, was adding the following to minimapwindow.cpp:
I added
Code: [Select]
label->setRotation(CEGUI::Vector3(0,0,(player->getShape()->m_angle*180/PI)));between
Code: [Select]
label->setPosition(CEGUI::UVector2(cegui_reldim(relx), cegui_reldim(rely)));and
Code: [Select]
label->setVisible(true);
I also changed the label image by replacing
Code: [Select]
label->setProperty("Image", "set:TaharezLook image:CloseButtonNormal"); with
Code: [Select]
label->setProperty("Image", "set:TaharezLook image:MouseEsWeCursor");and adjusted its size(scale) by replacing
Code: [Select]
label->setSize(CEGUI::UVector2(cegui_reldim(0.03f), cegui_reldim( 0.03f)));with
Code: [Select]
label->setSize(CEGUI::UVector2(cegui_reldim(0.04f), cegui_reldim( 0.04f))); though its a little bit off center now.

I don't like that cursor image much, but i don't know how to set a custom image to a ThaarezLook Component yet :'(

greetz
 turan
« Last Edit: March 11, 2012, 11:32:17 PM by turan »
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

turan on March 12, 2012, 12:25:22 PM
Reply #4

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
EDIT:
ok...
adjusting /extending the ogre render to get just an outlined copy of the world objects, is something i'm not capable at the moment ( still learning ;) ). So i came up with this ( still the frame window hack, BUT extended :P ).

please tell, me if you like it.
greetz
 turan
 
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

turan on March 12, 2012, 09:23:52 PM
Reply #5

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
EDIT:

playing around with the minimap values again, i came to this (screen shot).

However, not being satisfied with the square look at the moment ( i want to have the minimap in a circled shape ) i stumbeld across this
http://www.cegui.org.uk/phpBB2/viewtopic.php?f=9&t=6006
during my search for usefull documentation on how to -tweak/adjust the L&F.xml / create layouts- task  :)

I think it looks pretty nice. Though it wouldn't solve my heading indicator image problem, nor draw me a circled mini map   ;)

What do you think about that?

It comes with the MIT license. is this project compatible?

greetz
 turan
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

turan on March 13, 2012, 11:00:40 AM
Reply #6

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
EDIT:

ähhhm  :o ... i just downloaded  the Glossy Serpent theme pack -- and in its license terms it says:
"Copyright (c) 2012 Augustin Preda" -- is that "DezGusty" ??? ? is this theme coming into summoning wars?
That would be awesome!!! :D

I'll replace the Taharez LAF in my local sumwars copy and see how its look like  :)

turan

« Last Edit: March 13, 2012, 11:04:56 AM by turan »
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

Lastmerlin on March 13, 2012, 02:00:46 PM
Reply #7

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
Nice work on the minimap :)
The cursor is still suboptimal indeed, but its already a great improvement. Nevertheless, a minimap with proper object drawing strategy and also shroud (imo very important) still remains to do. Circle-shaped minimap is nice to have, but really not essential.
Another think I am wondering about is: How will  this work with larger regions ? My current code just takes a snapshot of the region and stores is in a texture. Of course, resolution is horrible if the region is large. By scaling the image down this might get even worse...

Yes, Augustin Preda is DezGusty - but I dont know about plans to replace the theme. In fact, the current GUI made by hiponboy works very well imo. Although, as far as I know, its not a complete L&F yet (messing with L&F is _really_ messy).
Logged

dezGusty on March 13, 2012, 04:46:55 PM
Reply #8

dezGusty

  • Artists
  • Full Member
  • *
  • Posts: 245
  • Karma: +8/-0
    • View Profile
Offtopic : yes, the skin is made by me, but it's not designed to replace the skin done by hiponboy for Summoning Wars :) . (It's mainly designed for a rework of my older snake-like game. Some snakes should appear as small embellishments to various widgets as new versions appear). But I have nothing anything adapting items from it to Summoning Wars (or using it altogether). It's MIT licensed, so basically anyone can do whatever they want with it.
Logged

turan on March 14, 2012, 01:39:55 AM
Reply #9

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
ah, my guess was  right  :P

I must say very nice work dezGusty , even if the theme pack might not make it into sumwars i like it very much, especially
the beautifully designed corners for the buttons and the progress bar! :) -- for that fantasy/medival type of game sumwars is, I think they would fit great for the label witch presents the enemy life bar in combat. But thats only my Opinion. I do find the actual theme,though functional, a little boring. But thats only my opinion ::)

Regarding the minimap and a shroud strategy:
I played a little bit with the camera->setFOVy() parameter in Scene.cpp and with setProjectionType(Ogre::PT_ORTHOGRAPHIC) disabled respectively set to default (perspective), it gives you much of a zoom effect, not showing the whole map at once. However this leads to the problem that the minimap has to be updated in the case the player leaves the projected FoV, while still in the same region. I think an altered update function has to be written, witch can handle that. Though I have no clue how this could be triggered. May bee with flags resulting from a compare operation of a second texture render with the mentioned FoV settings applied,in relation to the full mini map render as it is now?

IF this could be implemented( not necessarily by me  :D ), then a circle shaped minimap would be of great value, because the player indicator could then be centered and the whole minimap view  turned around accordingly to the player orientation -- connected mouse wheel events for zooming out/in while the minimap is active could then also be possible (of course to a limited ratio to never unveil the full map - keeping the "exploring" factor alive, while giving the needed orientation help). The minimap update function has then to be altered too to correctly reflect the player position(and indicator label size), depending on the actual zooming ratio.

This has also the benefit of resembling very closely what i had in mind, when I came up with the "diablo style" minimap approach, at least I think so  :D 

reagarding the indicator label image( aka cursor):

should i get him centered (TaharezLook MouseEsWeCursor) by creating a scheme file , eliminating the offset? ( if this is the right way to modify existing theme components; don't know yet).. or can/could someone of the graphic designers "inject" a suitable image into the TaharezLook.tga?

discussion, discussion ...  ;D

greetz
 turan

 



"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

turan on March 15, 2012, 06:37:51 AM
Reply #10

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
hi LastMerlin, hi dezGusty,

I'm now up with trying to modify the scene.h/scene.cpp:
by splitting the minimap rendering part from the createScene() function and putting it into
a separate handleMinimapScene(bool init) function, witch can be called for the initial render process during game startup  as well as during scene/region changes.
I also planed to overload this function with the param(s) from the local player camera to adjust the minimap cameras position, distance (setFovY aka zoom) and LookAt params accordingly to the players camera before the minmap texture gets rendered. I'm trying to achieve a synchronization between the players view of the region map and the minimap rendering.

I got only 2 problems with this attempt:
 1.) from where should i call the (to be created handleMinimapScene function -- other name(s) would be also ok, if it/they fit better into the projects naming policy) ? -- from within the minimapUpdate loop (minimapwindow.cpp) ? not sure about that yet  :-\...

AND much more important  :'(:
2.) one of my RAM Banks/and or modules died and my PC freezes periodically - so im left with just 1 GB of RAM and therefore an unstable and slow  dev platform. I decided to order a new PC, because this one is now 7 years old and has done it's duty. I'm going to strip/backup what is left of my box, after finishing this post. My new PC should be delivered at Friday/Saturday. So I won't be able to code till then.

In the meantime, I would like to ask you, if my idea is practical at all and/or if there are better ways/project compatible attempts to synchronize the players world view and the minimap rendering to achieve the minimap behavior i described in my last post.


greetz
 turan
« Last Edit: March 15, 2012, 06:39:49 AM by turan »
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

Lastmerlin on March 15, 2012, 10:23:58 AM
Reply #11

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
A few thoughts on minimap, what problems to expect etc:

The central issue with minimap or everything that is _not_ rendering directly to the output window is, that the technique I use (render to texture / RTT) takes _a_lot_ of time. For some reason, rendering to a 512x512 texture takes more than ten times the computation time than rendering to a 1024x768 window. I never got a clear explanation why that happens, but it has some really annoying implications: We must _not_ render the minimap each frame. Or more specifically: Rendering the minimap during normal gameplay is problematic in general, because even a computation time of 100ms causes a noticable lag.

Second problem:  Several objects (like fences) are important for gameplay, but really hard to see on the minimap. On the other hand, other objects, especially monsters, should _not_ be visible on the minimap. Honestly, the game will be way to easy, if mages or archers can see large cluster of enemies too early (not to mention the possibility to shoot area of effect spells or guided arrows in there).

The general idea I had a longer time ago for all this was using an own scene for the minimap. This allows a lot of really nice things:
- use vastly simplified meshes (also getting rid of the rendering cost problem)
- add arbitrary markers
- filter objects (like monsters)
- display shroud easily

If the update time can be reduced to lets say 1ms, we can easily update the content each 100ms (for instance) without noticably costs.

Drawback: Its a lot of work and it requires Ogre knowledge. Well thats the reason, I have not done it so far....


Logged

turan on March 19, 2012, 12:50:10 PM
Reply #12

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
Hi LastMerlin,

I'm back with a shiny new Quad-Core Processor ;D
Haven't been able to pull out a build yet, because I'm always running into
Code: [Select]
OGRE EXCEPTION(6:FileNotFoundException):
Cannot locate resource TaharezLook.scheme in resource group GUI or any other group. in
ResourceGroupManager::openResource at /build/buildd/ogre-1.7.3-ogredev/OgreMain/src/OgreResourceGroupManager.cpp (line 753)
on my new 64-Bit Ubuntu :( (used 32 Bit  on my older PC).

Anyway regarding the "2nd scene" approach: Have you thought about a RenderTargetListener to strip/manipulate Objects from the scene, before the minimap gets rendered? I'm curious to try out this approach, because even though I was able to sync the minimap with the players cam, i get a "little" version of the player rendered into the minimap window ;D...wich is, together with the performance problem you already mentioned, totally unacceptable.

Please let me know what do you think about that attempt as a Interim solution...at least till the game has reached a 1.xx state  ;)

greetz
 turan


EDIT: I'm ashamed  :-[ ... if you copy over the .sumwars dir from another user, you shouldn't forget to adjust the paths in the resources.cfg file... game runs now
« Last Edit: March 19, 2012, 01:01:03 PM by turan »
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged

Lastmerlin on March 19, 2012, 11:59:06 PM
Reply #13

Lastmerlin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 463
  • Karma: +5/-0
    • View Profile
In general: Everything, that works better than what we have now is a good idea. Of course it should take a lot less effort if its a temporary solution - which seems to be the case.
Just one tip: Even with filtering - never try to update each frame. It will just result in abysmal performance. Unless you find the reason why rendering to a texture takes so much more time than rendering to window. For me, it makes absolutely no sense, I never got a good explanation, but I never got a fix either.
Logged

turan on March 26, 2012, 12:34:29 PM
Reply #14

turan

  • Newbie
  • *
  • Posts: 36
  • Karma: +2/-0
    • View Profile
hi,

just a little progress update:

http://dl.dropbox.com/u/69238784/minimapMod.ogv

* i hope you can play .ogv files, because i use recordMyDesktop for screen casts and manually converting the '.ogv files into any other format ( f.g avi ) produces only garbage.

As I still stick to the Attempt of manipulating/hiding Objects before and after the texture Render ( pre and post update target listener ), I'm currently in the process to sort out the static graphic objects witch serve as level borders ( subtype: wall, fence etc.) to blend anything else out of the scene and maybee enlarge them or make them more visible.

I've extended the scene class with a 2nd graphic objects map and adjusted the insertObjects function accordingly. I therefore  renamed m_graphic_objects to m_graphic_objects_mov and created m_graphic_objects_stat accordingly. Moreover i renamed
getGraphicObject to getMovableGraphicObject and created getStaticGraphicObject(std::string typeName) to retrieve the named border objects. This attempt works quite smooth and well, as long as you don't use any recursive search attempts etc. during pre/post render operations  :D


CEGUI label has still attached that ugly mouse pointer. As stated before, this might be a job for one of the graphic artists, if my work might fit into the project... hopefully  ;)


i keep posting. please tell me what you think.

thanks in advance

greetz
 turan
"Es entspricht dem menschlichen Wesen, den zu hassen, den man verletzt hat." - Agricola 42, 4.
Logged