November 29, 2020, 04:03:14 PM

Author Topic: testing something new...  (Read 264 times)

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2001
testing something new...
« on: October 27, 2020, 07:38:58 AM »
I thought I would pop back to isometric and build a new engine - this time with nightshade/gunfright in mind...

the base res is 256x192 Spectrum - but it can do other res and hi-res graphics too

I should add that this is BlitzNG

Offline Xerra

  • Hero Member
  • *****
  • Posts: 1174
  • Wait, what? This isn't Porn Hub?
    • Retro Evolved
Re: testing something new...
« Reply #1 on: October 27, 2020, 04:45:05 PM »
I do miss Blitz. I had some good email conversations with Brucey when we tried out some NG/IOS game converting with some of my stuff a few years back. Not sure I'd want to go back to programming with it now I've got so used to GMS. If I was doing app development then I'd obviously consider it again.

I'd used Blitz Basic since its original variant on the Amiga back in the mid-90's, sigh.

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2860
  • elgol 2021
Re: testing something new...
« Reply #2 on: October 27, 2020, 06:49:18 PM »
Warming up for the arrival of your Spectrum Next Adam?  Marvellous.  You'll sell loads.   :D
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.

Offline 3DzForMe

  • Hero Member
  • *****
  • Posts: 1136
Re: testing something new...
« Reply #3 on: October 30, 2020, 07:17:57 AM »
@xerra, Ditto. Although.... I still use Blitz3D, got something that produces a height map that AGK in turn uses to render a 3D height map..... Which is nice.

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2001
Re: testing something new...
« Reply #4 on: October 30, 2020, 08:17:23 AM »
if anyone is interested I've just spent time shouting at the comp about isometric sorting. It turns out it's simple but not in an obvious way.

first
any object needs a base reference point at it's center
the object then needs a min and max bounds used for collision, etc

sorting
when you sort you do it in 2 steps
1. quick loop to give each object a distance from far away point 999,999 is a good one.
distance is sqrt(x*x+y*y)
2. do a simple sort on the distances, far away being at the first item

when drawing just use the sorted objects farthest first

Offline Matty

  • Hero Member
  • *****
  • Posts: 1254
    • MattiesGames
Re: testing something new...
« Reply #5 on: October 30, 2020, 09:05:43 AM »
Easier way....

Before rendering calculate all iso sprites 'feet' screen y pos. Then put into an array of length screen height at each index an array of sprites with their x.  Then loop from 0 to screenheight through array drawing each group of sprites at that y pos.  Any ypos without any sprites gets skipped.

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2001
Re: testing something new...
« Reply #6 on: October 30, 2020, 10:10:13 AM »
good call matty - a slightly different approach :)

Offline Derron

  • Hero Member
  • *****
  • Posts: 3265
Re: testing something new...
« Reply #7 on: October 30, 2020, 11:17:01 AM »
Matties approach requires 1080 arrays for "HD" - even if there are only 100 elements.
So if you only have a handful of elements - sort by "z" in a single array.

I used a kind of mix of your ideas :
a list (might be more - if layers are to "overdraw" each other) and a sort function.


Code: BlitzMax
  1.         Function _SortEntitiesByZ:int(o1:object, o2:object)
  2.                 local e1:TTileMapEntity = TTileMapEntity(o1)
  3.                 local e2:TTileMapEntity = TTileMapEntity(o2)
  4.                 if not e1 then return 1
  5.                 if not e2 then return -1
  6.  
  7.                 return e1.GetRenderDepth() - e2.GetRenderDepth()
  8.         End Function
  9.  
  10. and each tile/item:
  11.         Method GetRenderDepth:int()
  12.                 'when using 1.0 * height, then a very high item on 1,1 will get
  13.                 'drawn _after a low item on 1,2
  14.                 return area.GetX() + area.GetY() + 0.01 * area.GetH()
  15.         End Method
  16.  

Dunno why I added the height - must have had a reason for it.

GetX + GetY() because I had the position in a "2d top view grid" which then gets projected to isometric later.


bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2001
Re: testing something new...
« Reply #8 on: October 30, 2020, 11:42:05 AM »
Not sure if that helps Derron.

I know that Matty is using C#. and I never use TMaps or TTileMapEntity or whatever  :o

just working on a graphics style - still at spectrum resolution, but with more colors

Offline Matty

  • Hero Member
  • *****
  • Posts: 1254
    • MattiesGames
Re: testing something new...
« Reply #9 on: October 30, 2020, 02:06:11 PM »
Just a quick point: 1. You don't have to have an array exist at a ypos if there are no sprites there, it can be null.  And 2....1080 arrays of variable length takes up tiny memory on any pc from the last 15 years....and no sort function is required...

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2860
  • elgol 2021
Re: testing something new...
« Reply #10 on: October 30, 2020, 02:58:23 PM »
Looks great, maybe use some anti-aliasing with appropriate shades.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.

Offline Derron

  • Hero Member
  • *****
  • Posts: 3265
Re: testing something new...
« Reply #11 on: October 30, 2020, 04:05:44 PM »
Just a quick point: 1. You don't have to have an array exist at a ypos if there are no sprites there, it can be null.  And 2....1080 arrays of variable length takes up tiny memory on any pc from the last 15 years....and no sort function is required...

and what happens if the items move? you need to resize the array it leaves, you need to resize the one you send it to (or maybe create it there).
you also need to add / remove them when scrolling your map (so stuff comes "into display").

But do not get me wrong: your approach is fine - but in certain situations it might be doing "more" than other approaches (and vice versa). Always a kind of trade off.


bye
Ron

Offline Matty

  • Hero Member
  • *****
  • Posts: 1254
    • MattiesGames
Re: testing something new...
« Reply #12 on: October 30, 2020, 04:49:01 PM »
True Derron.  And it's not difficult to apply multiple approaches per frame drawn if the scene complexity and or the render time exceeds a threshold limit.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal