Skyline Game Engine Store uses cookies to store certain information to make your site visit more enjoyable. By proceeding to use the store, you are agreeing to the use of cookies.

Development Blog – Completed SceneEntity limits (with code)

Posted by SolarPortal 23/01/2018 0 Comment(s)

Well after many countless hours facing the beast at skyline's core, i have managed to tame and retrieve all stability back in the land. Really lol, what we mean by this is that we now have a fully working and tested sceneEntity unlimited(over 10,000,000 allowed) count that will be available in the next Skyline Release for the commercial version.

As i mentioned in a previous blog, skyline was limited to only 1000 sceneEntities in the free version and 4000 sceneEntities to the commercial version due to memory limitations running out if the number was too high. Now you have many(unlimited for commercial) amount of sceneEntities at your disposal to create your modular scenes.

For the next free version, the entity limit will be 1000, but ids are reused when they have been deleted meaning you can have 1000 static sceneEntities in the scene or 1000 dynamic entities on screen at once. Once deleted its id is stored and reused to allow continuous fights with bullets or bombs etc...

With modularity comes the need for optimization, with the new limit free count, scenes could be getting very large requiring a bit of a rendering change to handle the many entities. We are planning on an occlusion culling system to only display the meshes that can only be seen and a new batching system that will automatically group meshes together. More to come on the new changes planned soon in a later blog.

The External Scripts took a bit of a back turn and are still used as they have always been. It was more work than necessary to get around 1 bug we were having which we solved anyway making the task go a lot smoother. This means there is no more external script action and everything everyone is already using is safe.

Anyway, i am sure the programmers out there will be wanting to look at the objectpool class used to see how it is done. However, this is not the same as used in skyline as it is much bigger in skyline.

This is a simple class we first created before porting it too skyline.

Note: Scroll Down for full Visual Studio Project.

    _                   ____         __ _
   / \  _   _ _ __ __ _/ ___|  ___  / _| |_
  / _ \| | | | '__/ _` \___ \ / _ \| |_| __|
 / ___ \ |_| | | | (_| |___) | (_) |  _| |_
/_/   \_\__,_|_|  \__,_|____/ \___/|_|  \__|

aRa Aurasoft 2008-2015
© Copyright aRa Aurasoft & Skyline Game Engine

Hope this helps someone.
If used or adapted from, please give credit to where it came from.

Written by Jayce Young

#include "stdafx.h"

class Item{
	std::string name;
	int id;

	// Add your variables to your item class here

class ObjectPool{

	int maxCount;
	int numItems;
	Item * items[1000000];
	std::vector reusableItems;

	void init(){
		numItems = 0;
		maxCount = 1000000;

	Item* createItem()
		int id = numItems;
		bool usingemptyslot = true;
		if (reusableItems.size() > 0){
			id = reusableItems[reusableItems.size()-1];
			usingemptyslot = false;

		items[id] = new Item();
		items[id]->id = id;
		std::stringstream ss; ss << items[id]->id;
		items[id]->name = "MyName" + ss.str();

		if (usingemptyslot)numItems++;

		return items[numItems];

	void destroyItem(int id)
		delete items[id];
		items[id] = NULL;

	void destroyAllItems()
		for (int i = 0; i < numItems; i++){
			if (items[i] != NULL){
				delete items[i];
				items[i] = NULL;

		numItems = 0;

	Item* getItem(int id){ return items[id]; }
	void setItem(int id, Item *item){ items[id] = item; }

	int getNumItems(){ return numItems; }

ObjectPool objectPool;

For usage of this class simply access it like this:

// Initialise the system with
// Create new item with
Item *item = objectPool.createItem();
// Destroy that item with:
// Destroy all the items with
// Get the number of items found with
int numberOfItems = objectPool.getNumItems();
// Retrieve an item by id
Item *item = objectPool.getItem(id);

Thanks and i hope you like this and that it helps some of you wanting to create your own item management with good memory usage. Here is the full Visual Studio source project: Released under MIT license but we would like to be credited Download Full Visual Studio Project Note: As always, there might be some bugs or broken functions in lua. When you have this errors, then please report them to tech support. thank you

Leave a Comment