Over 11.200 objects. Help me please :(

Talk about making games.

Over 11.200 objects. Help me please :(

Postby xenidius93 » Fri Oct 10, 2014 3:28 pm

Hi. I want to make game like Motherload, but this is soo hard, because I have lower fps, when map's generated :cry: . I'm trying to make objects out of vision invisible, but still there's this same problem with fps... Maybe someone can help me, I have soo many ideas for this game :( .

Video: https://www.youtube.com/watch?v=B7W9SzG ... e=youtu.be

Download: https://www.mediafire.com/?c4jh99o3j2qa7hu
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby tvz » Fri Oct 10, 2014 4:48 pm

Hello

11214 is a very big amount. This amount of tiles can surely drop fps. You should make a debug(an actor named 'debug') actor to print real_fps.

Make it a full screen game as 'full screen' games always run better than 'window' game.
Create less tiles for a level(less than 2000). For another level create more tiles again or edit previously created if needed.
Use regions for levels in same exe or make separate file for each level.

btw tile sprite looks good
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby lcl » Fri Oct 10, 2014 5:37 pm

I'd advice loading the tiles dynamically, e.g. only having visible tiles loaded. This requires some coding, but will make your game a lot lighter. It also makes more sense that way.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby bat78 » Sat Oct 11, 2014 6:26 am

Pft. Isn't it obvious? He is creating the tiles in draw actor hard coded.
What i mean is that if he loaded these tiles in a for loop.. then gE would behave on a completely different way when loading.
gE shouldn't load each of them with speed limited by fps. gE should load all of them at once with speed limited by processor, compiler (and other stuff dependent)
So do that in a do/while loop. Should look like:

Draw Actor->
Code: Select all
static int checksum = 1;

if(checksum)
{
    checksum = 0;
    do
    {
        CreateActor("Tile", "Animation", "(none)", "(none)", x, y, false); // set that on the way you have it set
    } while(ActorCount("Tile") != 11214);
}

Make sure this code is not written by the Tile actor (that will result in multi-threating - each Tile clone will parse the code - extreme fps downfall)

One more thing. What "making them invisible" means? The correct way to make them invisible (with benefits) is with VisibilityState function.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby xenidius93 » Mon Oct 13, 2014 9:58 am

bat78. In example block_dirt -> Create Actor:
SCRIPT: visible = 0;

In block_dirt -> Collision (Any Site of visible_area):
SCRIPT: visible = 1;

In block_dirt -> Collision Finish (visible_area):
SCRIPT: visible = 0;

In block_dirt -> Draw Actor:
SCRIPT: if(visible == 1)
SCRIPT: VisibilityState("Event Actor", ENABLE);
SCRIPT:
SCRIPT: else if(visible == 0)
SCRIPT: VisibilityState("Event Actor", DONT_DRAW_ONLY);

Actor visible_area is filled region actor moving with view.
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby lcl » Mon Oct 13, 2014 10:18 am

It would help if you'd upload the .ged + data instead of an exe. That way we could actually have a look at what you're doing and suggest a better solution.

However, I see what you're doing with your idea of controlling VisibilityState, but there is one thing you may have not considered. Your system of showing and hiding the tiles uses a lot of resources, because every frame all these events are processed for every single block:

- Collision check with visible_area
- Collision Finish check with visible_area
- Draw Actor event

Now, when you think what this means, it's that every frame the game needs to do all this for each of your 11214 blocks. And that simply takes a lot time.

How are you generating the level? The best solution would be to instead of creating 11214 clones, to just make an array of the level in which you'd store the contents of the level. Then you could use an algorithm to find the tiles that need to be shown on the screen, and show just those tiles.

In general you should always try to avoid putting code into a Draw Actor event of an actor you know you'll be cloning that many times.

If you need help with realizing my suggestion, I'm willing to help you. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby xenidius93 » Mon Oct 13, 2014 11:23 am

Okay. So here's project: https://www.mediafire.com/?510g0cazf5wbh7q
I'm from Poland, so there are some typos in my project x), like "vissible" or "deep" etc. project also is very primitive -_-
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby bat78 » Mon Oct 13, 2014 11:48 am

xenidius93 wrote:Okay. So here's project: https://www.mediafire.com/?510g0cazf5wbh7q
I'm from Poland, so there are some typos in my project x), like "vissible" or "deep" etc. project also is very primitive -_-


My dear sister from a game is from Poland. Polish people are good x) Wait.. I think i remember something. Kocham cie? was it? was it not? :D
P.S Thats one ..really bad way of controlling actor's visibility state.

But yeah.. like LcL stated, you better be rendering only the tiles you are supposed to see. It is easy.. and it is a logic.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby xenidius93 » Mon Oct 13, 2014 12:23 pm

XD. Kochasz mnie?! I'm trying to hide blocks (blocks out of vision), but there are still low fps. No change
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby bat78 » Mon Oct 13, 2014 2:06 pm

xenidius93 wrote:XD. Kochasz mnie?! I'm trying to hide blocks (blocks out of vision), but there are still low fps. No change


Nah, dw. LcL will help you. He now have the game's source code as he suggested.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby xenidius93 » Tue Oct 14, 2014 6:26 pm

Still I have no idea, please help me someone :/
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby lcl » Tue Oct 14, 2014 6:39 pm

Hi xenidius.
I'm sorry it is taking me so long. It is not so easy to go look at someone else's job and to understand what it does and how it does it. But I'll have a look at your ged tomorrow.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby xenidius93 » Wed Oct 15, 2014 8:29 am

Okay, I understand. Then I'm waiting :wink:
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby bat78 » Thu Oct 16, 2014 1:45 am

Oh man i just took a look at your game. Are you serious. Im sure you spent days on it.
Soo much code.. and time wasted. You could do that in like 20 lines instead. And it will be much more efficiant and productive.

I have mentioed over 3 times so far that actors in idle status do not reduce the fps.
The fps is being reduced only when the game is performing actions. The most cluttering way as an example is the DrawActor event. It performs constant actions, especially in your game. You have to EventDisable the draw actor event for each block, when its no longer needed.
Also you have to limit the use of Draw Actor because like i said.. you could do that in one character, no global variables, 20 lines of code.
Thats what we call efficiant with improvent performance.

Put the fps rate to 512 to optimize it.

And i am still wondering why are you loading tiles with timer. It is a loading method yes.. but it is slower and in your case it does not benefit a lot because of the reason i wrote above. Why don't you draw them at once? Use a for loop. I tested and That count of 11k actors are made in 1 second for my 2.20 GHz processor.

You have a nice logic. It will be great for you to start learning C programming. Your games will be coded much better, you will make them much more easier, faster, better.. and you won't have that much headaches.
11.200 objects once created properlly won't be a problem for the game. Just consider what i have wrote but im going to write it again.
-Do not change the visiblity state of the titles not currently on-screen. Because when they are on-screen.. they have to be-drawn. This is an action performed and will surelly reduce the FPS rate.
-EventDisable all the draw actors when no longer needed. (thought if a propper code only one draw actor event is needed)
-Do not create the tiles with a limited speed. create them at once. It wastes no more less then 2 seconds.
Learning this is much better then someone to just fix your game. Because if someone fix your game, you won't learn that much.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Over 11.200 objects. Help me please :(

Postby xenidius93 » Fri Oct 17, 2014 10:28 am

bat78, thank you soooooooooo much! It's working perfect. Maybe not 2 secs to generate 11.200 blocks [when terrain's generating FPS = +-12, but when it's finally generated FPS = +-45]. Thank you again bat78! Respect for you 8)
xenidius93
 
Posts: 37
Joined: Mon Jul 28, 2014 4:24 am
Score: 1 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron