FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Pages: [1] 2

Author Topic: Variable height terrain  (Read 9159 times)

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Variable height terrain
« on: March 19, 2012, 11:20:15 pm »

I'm toying with the idea of making a Tactics Ogre-style game and I'm wondering if FIFE would be suitable for this.
One feature I'm concerned with is variable height terrain (like in the screenshot). Would it be possible to implement in FIFE relatively painlessly?

Logged

prock

  • Developer
  • Full Member
  • *
  • Posts: 236
    • View Profile
Re: Variable height terrain
« Reply #1 on: March 20, 2012, 09:34:25 pm »

I'm pretty sure FIFE could handle something like that but I'm not sure how easy it would be.  I'm not aware of anyone who has tried something like this before.  The biggest challenge might be content creation (the tiles themselves), map creation, and pathfinding.  I'm not sure how gameplay works and how the characters move from tile to tile.  Only thing I could suggest is to try to throw a proof of concept together and see what the roadblocks might be.
Logged

chewie

  • Developer
  • Full Member
  • *
  • Posts: 123
    • View Profile
    • zero-projekt.net
Re: Variable height terrain
« Reply #2 on: March 21, 2012, 04:41:17 am »

I'm pretty sure FIFE could handle something like that but I'm not sure how easy it would be.  I'm not aware of anyone who has tried something like this before.  The biggest challenge might be content creation (the tiles themselves), map creation, and pathfinding.  I'm not sure how gameplay works and how the characters move from tile to tile.  Only thing I could suggest is to try to throw a proof of concept together and see what the roadblocks might be.

Helios is working on mulitlayer pathfinding in the cell_pathfinder-branch - a prototype for this kind of game might be a good test for the new features. :)

mvBarracuda

  • Administrator
  • Sr. Member
  • *
  • Posts: 411
    • View Profile
Re: Variable height terrain
« Reply #3 on: March 21, 2012, 01:20:46 pm »

AFAIR this kind of different height is mostly a visual illusion in quite a lot of 2.5d engines.
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Variable height terrain
« Reply #4 on: April 19, 2012, 01:47:19 pm »

Thanks for the replies. I played around with FIFE a bit. The first problem is drawing order. I'm pretty sure I can't take advantage of layers here. So, with everything on one layer, the order needs to be determined by map coordinates. I think I have an algorithm that can sort everything correctly, but I don't know how to modify/override the default one. Could you give me some pointers? Is it even a good idea?

Also, could you tell me more about the new pathfinder?

My playground (rio_de_hola with my map):
http://www.mediafire.com/?pqei15p4ubdleiw
Logged

prock

  • Developer
  • Full Member
  • *
  • Posts: 236
    • View Profile
Re: Variable height terrain
« Reply #5 on: April 19, 2012, 04:02:08 pm »

Hi Niektory,

I was able to download and run your demo without any problems.  I see your problem.  Unfortunately I cannot think of an easy way to fix it.  There are a lot of special cases in your map.  I'm not aware of an easy way to override the default sorting algorithm for instances.  This could however be a good improvement to the engine and it hasn't been the first time someone has asked about it.  Perhaps we could add an interface for clients that would allow them to override the sorting algorithm.  I'll have to dig into this a bit more and get back to you again.

Come to think of it the new pathfinder should be able to handle this so you could perhaps fix this by modifying some of your assets.  You might need to split some assets into multiple images.  The top of some of the taller tiles could be split off and put on a higher layer so the player is always behind it when they walk around it.  The new pathfinder will allow an instance to switch layers so when the player moves to a higher layer he/she will always be on top of the taller tile (hope I'm making sense here).  You should check out the cell_pathfinding branch and play around.  You should stop by IRC sometime and talk to Helios about it.   He is the one doing most/all of the work on the pathfinding branch. 

Hope this helps,

prock
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Variable height terrain
« Reply #6 on: May 18, 2012, 05:44:19 pm »

The good: I made some progress. The agents jump up and down when moving around and they are properly obstructed by terrain. I didn't use layers, they would fix some problems but introduce others, I think I'm better off without them.

The bad: I used some ugly hacks. I don't even fully understand some of the code I modified. Well, hopefully I can learn and improve it later. ;)

Here's the updated demo. You'll need to use the cell_pathfinder branch and apply the included patch. Click 'About' to check the keys.
EDIT: Updated again. The previous patch was incomplete for some reason.
http://www.mediafire.com/?saw8whns6gzmmsu
« Last Edit: May 20, 2012, 02:32:14 pm by Niektory »
Logged

prock

  • Developer
  • Full Member
  • *
  • Posts: 236
    • View Profile
Re: Variable height terrain
« Reply #7 on: May 21, 2012, 10:17:39 am »

Hey Niektory,

I checked your demo out.  Looks great.  Still some z sorting issues but still looking pretty good.  Looks like it might be possible to do what you want to do with FIFE with some work.

Prock
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Variable height terrain
« Reply #8 on: August 06, 2012, 04:15:03 pm »

Be running up that road,
Be running up that hill,
Be running up that building. ♫

http://www.youtube.com/watch?v=KwGDrBlBjE8
Logged

prock

  • Developer
  • Full Member
  • *
  • Posts: 236
    • View Profile
Re: Variable height terrain
« Reply #9 on: August 07, 2012, 10:15:26 am »

That was one of the coolest fife videos I have ever seen.. nice work!
Logged

vtchill

  • Developer
  • Full Member
  • *
  • Posts: 206
    • View Profile
Re: Variable height terrain
« Reply #10 on: August 12, 2012, 03:24:23 pm »

Congrats Niektory!!!

Awesome little demo with multi height pathing. I second prock, this is definitely one of the coolest videos of fife i have seen.

I'm not sure if it was your intention but I could see the raising and lowering of terrain leading to some really interesting game designs. I hope to see this incorporated into the final game design for sure!

Keep up the awesome work and please keep us posted with all the awesome teasers!
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Variable height terrain
« Reply #11 on: August 19, 2012, 05:47:02 pm »

Update time! Thanks to vacation I was able to do a good chunk of work. Now that it's over I'll go back to my usual snail pace...

So, stuff I managed to cram in:
- complete pathfinder rewrite
- line of sight calculation and display
- basic turn-based combat
- some shadows
- a nice-ish brick tile

http://www.youtube.com/watch?v=kT7tcCm2xs0
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Variable height terrain
« Reply #12 on: August 24, 2012, 01:30:46 pm »

The current version is here:
http://niektory.republika.pl/fife_tactics_hex1-10.7z
I don't want to decide on a license yet. But I'm fine with sharing some parts if you want them.

The engine patch is here:
http://niektory.republika.pl/fife_tactics_hex1-10.patch
Of course you're free to grab whatever you like, but most parts still need a lot of work. I don't have a working earlier version because TortoiseSVN is stupid. But I salvaged some of the old pather code:
http://niektory.republika.pl/oldpather.patch

Some notes:
Quote
math.i, iobjectloader.i
Exposed some stuff I wanted to use to Python.

route.h
Fixed an error in the comments.

cellrenderer.cpp
Changed the route rendering to display routes as lines instead of polygons.

hexgrid.cpp
I found the coordinate zigzagging annoying to work with, so I removed it. You may want to include this version as an alternative to the current grid.
Also commented some log messages that were causing me slowdowns.

instancerenderer.h, instancerenderer.i, instancerenderer.cpp
Added a way to exclude parts of an image from outline generation. Need to find a better way to do this.

maploader.cpp, mapsaver.cpp, camera.h, camera.i, camera.cpp
Added a way to control the Z axis transformation. Need to find a better way to do this.
Commenting cacheUpdate(&layer); gave me a nice speed boost and I didn't notice anything breaking... yet.

layercache.cpp
Replaced instance sorting with my version.

map editor
Added a way to move instances up and down along the Z axis, but broke undo because it was slow when moving many instances.
Changed rotation to rotate by 60 degrees instead of 90. It should check the grid type instead and choose the angle based on that.
Logged

helios

  • Developer
  • Jr. Member
  • *
  • Posts: 61
    • View Profile
Re: Variable height terrain
« Reply #13 on: August 25, 2012, 10:15:50 am »

Thank you for the patches :)
I'll take a deeper look at it and create Tickets for all that stuff. I can see that it is still a lot of work but I think it's worth it.
Logged

Niektory

  • Newbie
  • Posts: 29
    • View Profile
Re: Variable height terrain
« Reply #14 on: September 18, 2012, 08:01:55 am »

Targeting, projectiles and area effects:

http://www.youtube.com/watch?v=hvvtCSTOpQI
Logged
Pages: [1] 2