I'm creating an open-world RPG like Neverwinter nights. But I’m worried about memory and am afraid if I just populate a huge world with physics based sprite nodes, I won't have any memory for anything else.

The method I thought of is to remove the sprites when they go far outside of the viewport and then re-add those sprites when I get close to their location.

How could I accomplish this?

  • \$\begingroup\$ Try not to worry about the problems you have not faced yet. Make a prototype and do the load-testing and see what are the actual bottlenecks. \$\endgroup\$ – Kromster Jun 14 '20 at 8:59
  • \$\begingroup\$ How does your game know which sprites to spawn where in the first place? \$\endgroup\$ – DMGregory Jun 14 '20 at 9:53
  • \$\begingroup\$ @DMGregory I'm thinking I would have a invisible sprite node that encapsulates all others in the area and on collision, I then add those sprite nodes to predesignated points through a function \$\endgroup\$ – Mugs Jun 14 '20 at 14:12
  • \$\begingroup\$ @Kromster A fair point lol \$\endgroup\$ – Mugs Jun 14 '20 at 14:13
  • \$\begingroup\$ That sounds like an approach worth trying. What happens when you test the idea? \$\endgroup\$ – DMGregory Jun 14 '20 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.