Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / many platforms slowing game down

Author
Message
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 29th Nov 2004 03:47
Well, I'm creating a nice platform game, but it goes too slow. I think there are too many objects.

Here is the code for the plattforms

That means we have 1152 plattforms (not all visible on the screen at one time. I attached the platform, that way you can realise it is really low-poly right now.

I also tried this :
, thinking I could get the platforms on screen, only when the player is near them. I can not go lower than "FOR x = 1 to 8" because if it would be lower, then some platforms wouldn't be visible on the screen.

So here are my questions :
- Is the polycount responsible ? (I suppose yes)
- How could I manage to make it work ?

- Mind the gap -

Attachments

Login to view attachments
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 29th Nov 2004 05:12 Edited at: 29th Nov 2004 05:15
you only need to,load the platform once for one thing, for another your platform numbers do not need to be floats, just use integers (they are faster) do the following.....



that way you only have to load the platform off the HD once, then you make the rest in memory which is MUCH faster, I wouldn`t try to use that many to be honest, why not keep a 2D array with the positions of the platforms in it and then just alter the indexes to get the numbers of the platforms visible on screen, that way you would only need a few dozen at most and just keep re-using them, rather than thousands you only use the once.

Mentor.

PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 29th Nov 2004 05:48 Edited at: 29th Nov 2004 06:10
Thanks for the help, Mentor.

Well, I thought about the 2D array, but it was in my second attempt. As you can see, it's only 8*24 plateforms. It's the minimum I could get. So I was planning that when some get out of sight, the are simply moved to the next visible section.

But now there is a new problem
Well now it looks lik this :

It tells that the object does not exist on line 74 (which refers to "LOOP")

(It makes no sense to me)
I must admit that I threw a bit part of my code away to get it simple on the forums.
But with this snippet, the same error occurs.

- Mind the gap -
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 29th Nov 2004 06:19
Oops, I found what it was.

Well, I show you a screenshot to make it more clear : I need many plattforms visible on the screen. They will appear and disappear depending on what you will do or what the ennemi does.

I still need to make it faster. I have no idea how to do it. I shall not go under 8 * 24 plattforms / screen

- Mind the gap -

Attachments

Login to view attachments
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 29th Nov 2004 22:57
If your platforms are so low poly, maybe it's the sheer amount of them that's the concearn. Personally - I'd just plonk them altogether in a memblock mesh, your backdrop platforms at least - then moving platforms can be seperate. I'm guessing a single mesh made from all the platforms in a single screen would be fairly quick. Like, if you have each 8x8 grid of platforms as a mesh, you probably would'nt have to do anything like optimise it.


Van-B


It's c**p being the only coder in the village.

Login to post a reply

Server time is: 2025-05-24 23:47:59
Your offset time is: 2025-05-24 23:47:59