• Advertisement
Sign in to follow this  

Unity Avatar Movement Approach

This topic is 3297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. This is probably one of my first posts here. I am currently working on the as3isolib (ActionScript 3 Isometric Library). You can read more about it here: http://code.google.com/p/as3isolib/ I am curious about how games like Dofus/Wakfu handle their avatar/NPC movements. Initially I had thought that the used something akin to the Filmation sorting algorithms (http://bannalia.blogspot.com/2008/02/filmation-math.html) but that seems rather inadequate for huge maps of many moving characters at many different elevation heights. So I put this question to the community to get some feedback: Do you think Dofus is using a) Fimlation sorting algorithms or do you think that it is using b) something more akin to how the Openspace Engine handles avatar/NPC movement*? *The OpenSpace Engine handles avatar movement based on tile sorting algorithms. At its heart it works something like so: - OpenSpace builds map iterating through 3D array to pre-position elements based on their 3D position in isometric space. - Avatars/NPCs are placed in the TILE sprites and then passed betw. the neighboring tiles sprites based on movement and direction. This means that an Avatar/NPC sprite is a child object of a tile/terrain object rather than a sibling. So basically you needn't have a scene render pass to resort the depths of objects because their intended depths are already set based on which tile OWNS them. In theory it sounds good but OpenSpace's execution of this is poor.* Now looking at the complexity of a Dofus/Wakfu map, I am starting to think they use the OpenSpace method simply because the variable elevations of the map might necessitate it. Looking forward to your input. Thanks, Justin

Share this post


Link to post
Share on other sites
Advertisement
Thought I might post some more links so as to clarify the variable terrain maps in Dofus/Wakfu:

http://staticns.ankama.com/ankama-games/www/img/screens/screenshot_big_game3_03.jpg
http://staticns.ankama.com/ankama-games/www/img/screens/screenshot_big_game3_06.jpg

Share this post


Link to post
Share on other sites
I don't really see the problem...
if you draw from back to front, you only have to worry about "objects" that colide by occupying both 2 squares or more and at the same time, overlappying each other.
The fastest way I can think of to solve this, is to have a ruleset on those objects:
- obj A, occupies a 3x3 square. So just define a function "drawFirst", that receives a square with coordinates local to the above object, and tells you what is the draw order.

so ObjA is at (x=10,y=10,z=2), size (x=3,y=2,z=2). You want to draw ObjB, that is at (x=11,y=11,z=1), size (x=1,y=2,z=1). You call ObjA->DrawFirst(ObjB) and that returns true or false.

Maybe I'm neglecting something, but it seems to cover everything :=)

Share this post


Link to post
Share on other sites
Unfortunately that is an over-simplification of the problem and I have been down that route before (I have tried so many approaches before I found the Filmation mathematics).

So it sounds like, based on your suggestion, that using a pre-sort of terrain tiles and still having the avatars/NPCs sprites as siblings to the terrain tiles is what you favor. So is that option a) that you choose?

Has anyone any experience with option b)? Anyone have any inside knowledge of how the Dofus/Wakfu engine works in this regards?

Share this post


Link to post
Share on other sites
Quote:
Original post by jwopitz
Unfortunately that is an over-simplification of the problem and I have been down that route before (I have tried so many approaches before I found the Filmation mathematics).

So it sounds like, based on your suggestion, that using a pre-sort of terrain tiles and still having the avatars/NPCs sprites as siblings to the terrain tiles is what you favor. So is that option a) that you choose?



I would split each avatar/npc/object into basic blocks (tiles).
You wont' need to pre-sort terrain, cause its a 2d grid. So starting from back to front, draw each tile and everything on top of it.

This solves the filmation algoritm problem too.
Can you pinpoint a example where this might fail? (I'm not saying that it doesn't, just that I haven't found anything that I can't fit in this algoritm).

Share this post


Link to post
Share on other sites
if you treat the Avatar/NPC sprites as siblings of the terrain sprites then you start running into the typical overlap issues especially considering the variable terrain height sprites are not only (in a 3D space sense) below, but also to the 4 sides of the avatar/NPC sprites. I meant to say the idea is sound, but the actual logic was over-simplified.

The only successful method I found for your approach was using the Filmation math. But again I feel that would be poorly suited to the whole Dofus-complexity issue. So let me rephrase this question specifically for you:

Assuming a different (non-Filmation) approach, what are your thoughts about treating the avatar/NPC sprites as child sprites of the terrain sprites that they are currently on? This would also assume that the child sprites would be nested above the terrain graphical assets to ensure that they indeed appear above. In order to move the avatar/NPC, movement would have to be handled by the terrain sprites "handing off" the avatar sprite to it the neighboring terrain (to be calculated based on direction of movement and other factors).

BTW this is targeting the Flash player so we must assume the techniques necessary for the Flash API's display list.

Share this post


Link to post
Share on other sites
Better yet and simpler to answer: How do YOU think the Dofus/Wakfu engine works with regards to those numerous variable heights in the terrain?

Share this post


Link to post
Share on other sites
Ok, I see a problema now :)

Avatar moving from tile A to Tile B.

if A.height>B.height
draw Avatar while rendering A until avatar is full on B
if A.height<B.eight
draw avatar in B.

any flaws?

Share this post


Link to post
Share on other sites
Quote:
Original post by jwopitz
Better yet and simpler to answer: How do YOU think the Dofus/Wakfu engine works with regards to those numerous variable heights in the terrain?


don't take it so serious :)
I haven't ever made a isometric game or though about it. And never player Dofus/Wakfu.

Was just trying to help, mate!!

edit: Looking through the screenshots I don't see a "problem" with "my" approach

Share this post


Link to post
Share on other sites
Maybe the text came across the wrong way. I apologize if you sensed any impatience or hostility. Not my intent. I was just saying, for the purposes of clarity, that that particular question might be easier to answer since I tend to be wordy sometimes.

I will look into your approach further to see if I can address this issue. For strictly tile-based elements where both terrain, bldgs, characters and such are restrained to single tile dimensions that might work fine (though I haven't been able to implement) but for elements that extend beyond a single tile's dimension (e.g. obj.w = 2 * obj.l) that might fail. Referring back to the Filmation math, that is where it solved issues, but then again not truly designed to address huge maps of variable terrain.

Thanks for your thoughts and ideas. Discussion produces the best solutions.

Share this post


Link to post
Share on other sites
if the element is fixed, just split it into smaller blocks.
If it's moving... it will always have a bad look when crossing between to adjacent titles with diferent heights. unless you have a "climbing" sprite for that object.

And sorry for all the bad english in my posts. Also you don't need to appologize. I'm sure that it was not your intention. Did I said my english sucks? :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By 3dmodelerguy
      So I am building a turn based rogue-like (think CDDA). The game is going to have a very large map (up to 1000's x 1000's) however to alleviate most of that I obviously can't render everything so there will just be render a certain radius around the player and just load in and out data as the player moves.
      The next major system I am prototyping is making interactive tiles destructible and pretty much everything will be destructible besides basic landscape (cars, doors, windows, structures, etc. will be destructible)
      While I am only rendering a certain amount of tiles around the player, I want to keep the amount of colliders active at one time to be as small as possible for performance and currently the tilemap tool I use automatically merges colliders together.
      So instead of creating a separate colliders for each of these tiles and having the destructible behavior tied to that object (which my tilemap tool would allow me to do) I was thinking that I would store an array of all the X and Y locations for the interactive tilemap layer and let the tilemap manage the colliders. 
      Then when I hit a collider on the interactive tilemap layer, instead of of getting the behavior for how to deal with the destruction for that tile from that game object, I would pull it from the array I mentioned earlier based on the tile I attempt to interact with which I already have.
      Does this sound like a good approach? Any other recommendations would be welcomed.
    • By NDraskovic
      Hey guys,
      I have a really weird problem. I'm trying to get some data from a REST service. I'm using the following code:
       
      private void GetTheScores() { UnityWebRequest GetCommand = UnityWebRequest.Get(url); UnityWebRequestAsyncOperation operation = GetCommand.SendWebRequest(); if (!operation.webRequest.isNetworkError) { ResultsContainer rez = JsonUtility.FromJson<ResultsContainer>(operation.webRequest.downloadHandler.text); Debug.Log("Text: " + operation.webRequest.downloadHandler.text); } } The problem is that when I'm in Unity's editor, the request doesn't return anything (operation.webRequest.downloadHandler.text is empty, the Debug.Log command just prints "Text: "), but when I enter the debug mode and insert a breakpoint on that line, then it returns the text properly. Does anyone have an idea why is this happening?
      The real problem I'm trying to solve is that when I receive the text, I can't get the data from the JSON. The markup is really simple:
      [{"id":1,"name":"Player1"},{"id":2,"name":"Player2"}] and I have an object that should accept that data:
      [System.Serializable] public class ResultScript { public int id; public string name; } There is also a class that should accept the array of these objects (which the JSON is returning):
      [System.Serializable] public class ResultsContainer { public ResultScript[] results; } But when I run the code (in the debug mode, to get any result) I get an error: ArgumentException: JSON must represent an object type. I've googled it but none of the proposed solutions work for me.
      Also (regardless if I'm in the debug mode or not) when I try to do some string operations like removing or adding characters to the GET result, the functions return an empty string as a result
      Can you help me with any of these problems?
      Thank you
    • By nihitori
      The Emotional Music Vol. I pack focuses on beautiful and esoteric orchestral music, capable of creating truly emotive and intimate moods. It features detailed chamber strings, cello and piano as the main instruments, resulting in a subtle and elegant sound never before heard in video game royalty-free music assets.

      The pack includes 5 original tracks, as well as a total of 47 loops based on these tracks (long loops for simple use and short loops for custom / complex music layering).

      Unity Asset Store link: https://www.assetstore.unity3d.com/en/#!/content/107032
      Unreal Engine Marketplace link: https://www.unrealengine.com/marketplace/emotional-music-vol-i

      A 15 seconds preview of each main track is available on Soundcloud:
       
    • By RoKabium Games
      Another one of our new UI for #screenshotsaturday. This is the inventory screen for showing what animal fossils you have collected so far. #gamedev #indiedev #sama
    • By eldwin11929
      We're looking for programmers for our project.
      Our project is being made in Unity
      Requirements:
      -Skills in Unity
      -C#
      -Javascript
      -Node.js
      We're looking for programmers who can perform a variety of functions on our project.
      Project is a top-down hack-and-slash pvp dungeon-crawler like game. Game is entirely multiplayer based, using randomized dungeons, and a unique combat system with emphasis on gameplay.
      We have a GDD to work off of, and a Lead Programmer you would work under.
      Assignments may include:
      -Creating new scripts of varying degrees specific to the project (mostly server-side, but sometimes client-side)
      -Assembling already created monsters/characters with existing or non-existing code.
      -Creating VFX
      -Assembling already created environment models
      If interested, please contact: eldwin11929@yahoo.com
      This project is unpaid, but with royalties.
       
      ---
      Additional Project Info:
      Summary:
      Bassetune Reapers is a Player-verus-Player, competitive dungeon crawler. This basically takes on aspects of dungeon crawling, but with a more aggressive setting. Players will have the option to play as the "dungeon-crawlers" (called the 'Knights', or "Knight Class", in-game) or as the "dungeon" itself (literally called the 'Bosses', or "Boss Class", in-game). What this means is that players can choose to play as the people invading the dungeon, or as the dungeon-holders themselves.
      Key Features:
      -Intense, fast-paced combat
      -Multiple skills, weapons, and ways to play the game
      -Tons of different Bosses, Minibosses, creatures and traps to utilize throughout the dungeon
      -Multiple unique environments
      -Interesting, detailed lore behind both the game and world
      -Intricate RPG system
      -Ladder and ranking system
      -Lots of customization for both classes s of customization for both classes
  • Advertisement