• entries
16
8
• views
6774

1125 views

Making editors is a pain. I have a list of thousands of items I'd rather do than this - yet I made myself a promise to drag at least one full featured editor tool over the finish line. There are few reasons for that:

1. I believe I have quite useful engine, it was my pet project all these years, it went through many transformations and stages - and solid tool is something like a goal I'd like to do with it, to make it something better than "just a framework".
2. I'm very patient person, and I believe also hard working one. Throughout the years my goal is to make a game on my own engine (note, I've made games with other engines and I've used my engine for multiple non-game projects so far -> it eventually branched to be a full-featured commercial project in past few years). I've made few attempts but mostly was stopped by lacking such tool - that would allow me to build scenes and levels, in an easy way.
3. And the most important one ... I consider tools one of the hardest part in making any larger project, so it is something like a challenge for me.

Anyways so much for motivation, the tool is progressing well - it can be used to assemble scene so far, various entities (like light or materials) can have their properties (components) modified, with full undo/redo system of course. And so the next big part was ahead of me - asset loading and dynamic reloading. So here are the results:

Engine editor and texture editor before my work on the texture.

And then I worked on the texture:

And after I used my highly professional programmer-art skills to modify the texture! All credits for GameDev.net logo go to its author!

Yes, it's working. The whole system needs a bit of cleanup - but in short this is how it works:

• All textures are managed by Manager<Texture> class instance, this one is defined in Editor class
• There is a thread waiting for change on hard drive with ReadDirectoryChangesW
• Upon change in directory (or subdirectories), DirectoryTree class instance is notified. It updates view in bottom left (which is just a directory-file structure for watched directory and subdirectories), and also for modified/new files creates or reloads records in Manager<Texture> class instance (on Editor level)
• The trick is, reloading the records can only be done while they're not in use (so some clever synchronization needs to be done)

I might write out some interesting information or even short article on this. Implementing it was quite a pain, but it's finally done. Now short cleanup - and towards the next one on my editor todo list!

Thanks for reading & see you around!

There are no comments to display.

## Create an account

Register a new account

• ### Similar Content

• By hmcdev
I want to learn to code games in C++ but I have no idea where to start, can someone teach me?

• I am made a lot of progress in my game but I have hit a small snag. in my code I am using an AABB collision detection. I have also used exit(0) to debug my code.it tells  me where in my code where it is getting access to. I have put exit(0) in the AABB collision detection and it accesses it just fine. but when I put only drawcollision_one function in the AABB collision routine it does not draw my collision sprite  animation. when I put drawcollision_one in the display function it works just fine. when the planes collide nothing happens but the exit(0) is accessed when the planes collide. here is the code I am working on.
void drawcollision_one() { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture[3]); glBegin(GL_POLYGON); glTexCoord3f(0.0f + screen, 0.0f, 0.0f); glVertex3f(0.5f, -0.5f, 0.0f); glTexCoord3f(0.167f + screen, 0.0f, 0.0f); glVertex3f(0.5f, 0.5f, 0.0f); glTexCoord3f(0.167f + screen, 1.0f, 0.0f); glVertex3f(-0.5f, 0.5f, 0.0f); glTexCoord3f(0.0f + screen, 1.0f, 0.0f); glVertex3f(-0.5f, -0.5f, 0.0f); glEnd(); glDisable(GL_TEXTURE_2D); } void timer(int val) { screen += 0.1667f; if (screen >= 1.0f) { screen = 1.0f; } glutPostRedisplay(); glutTimerFunc(500, timer, 0); } void coll_plane_one() { //draw bullet float x = -5.0f + horizontal; float y = 0.0f + vertical; float oWidth = 1.0f; float oHeight = 1.0f; //draw plane float xTwo = 5.0f + horizontal_one; float yTwo = 0.0f + vertical_one; float oTwoWidth = 1.0f; float oTwoHeight = 1.0f; if (checkCollide(x, y, oWidth, oHeight, xTwo, yTwo, oTwoWidth, oTwoHeight) == 1) { drawcollision_one(); } }

• Hey,
So I have got this asteroid type game and today I encountered a new issue while testing this game.
What happened was that two asteroids were close to each other and I shot a bullet at them. The asteroids were so close to each other that a single bullet could collide to both of them.
It collided and my game crashed there itself. I figured out it happened because two asteroids and one bullet collided in the same frame.
This is the code -
void Collision::DoCollisions(Game *game) const
{
for (ColliderList::const_iterator colliderAIt = colliders_.begin(), end = colliders_.end();
colliderAIt != end;
++colliderAIt)
{
ColliderList::const_iterator colliderBIt = colliderAIt;
for (++colliderBIt; colliderBIt != end; ++colliderBIt)
{
Collider *colliderA = *colliderAIt;
Collider *colliderB = *colliderBIt;
if (CollisionTest(colliderA, colliderB))
{
game->DoCollision(colliderA->entity, colliderB->entity);
}
}
}
}


void Game::DoCollision(GameEntity *a, GameEntity *b)
{
Ship *player = static_cast<Ship *>(a == player_ ? a : (b == player_ ? b : 0));
Bullet *bullet = static_cast<Bullet *>(IsBullet(a) ? a : (IsBullet(b) ? b : 0));
Asteroid *asteroid = static_cast<Asteroid *>(IsAsteroid(a) ? a : (IsAsteroid(b) ? b : 0));
Bullet *bulletMode = static_cast<Bullet *>(IsBulletMode(a) ? a : (IsBulletMode(b) ? b : 0));
if (player && asteroid)
{
player->playerCollided = true;
//AsteroidHit(asteroid);
//DeletePlayer();
}
if (bullet && asteroid)
{
collidedBullets.push_back(bullet);
collidedAsteroid.push_back(asteroid);
//AsteroidHit(asteroid);
//DeleteBullet();
}
if(bulletMode && asteroid)
{
collidedBulletMode.push_back(bulletMode);
collidedAsteroid.push_back(asteroid);
}
}


void Game::CollisionResponse()
{
if(player_->playerCollided == true)
{
DeletePlayer();
}
else
{
if(!collidedAsteroid.empty())
{
for(AsteroidList::const_iterator collidedAsteroidIt = collidedAsteroid.begin(), end = collidedAsteroid.end(); collidedAsteroidIt != end ; ++collidedAsteroidIt )
{
AsteroidHit(*collidedAsteroidIt);
}
collidedAsteroid.clear();
}

if(!collidedBullets.empty())
{
for (BulletList::const_iterator bulletIt = collidedBullets.begin(), end = collidedBullets.end() ; bulletIt!=end; ++bulletIt)
{
DeleteBullet(*bulletIt);
}

collidedBullets.clear();
}
if(!collidedBulletMode.empty())
{
for (BulletList::const_iterator bulletIt = collidedBulletMode.begin(), end = collidedBulletMode.end() ; bulletIt!=end; ++bulletIt)
{
DeleteBulletMode(*bulletIt);
}
collidedBulletMode.clear();
}
}
}

in my game->docollision() -
whenever an asteroid and a bullet used to collide, the collided objects get collected in collidedasteroids and collidedbullets respectively. When two asteroids collided with the same bullet, the two asteroids got collected safely in collidedAsteroid but the single bullet got collected in collidedBullets twice, so when the deletion was happening, the second time iteration of the bullet couldn't find the respective bullet and it got crashed.

How am I supposed to approach this problem now?

Thanks

• How to calculate angle between two points from a third point with the help of D3DXMATH library?
• By ryt
I recently started to explore how operator new and malloc() really work. If I understood correctly they get implemented using linked-list or forward-list when an array is used. This is probably because free (dynamic, heap) memory gets allocated all over (within its bounds) the memory and so something like std::vector isn't used, something that has continuous allocation.
If this is true than accessing such memory (through []) would not have access time of O(1) but some other, more complex.
Is this true or I misplaced something?
×