Jump to content

  • Log In with Google      Sign In   
  • Create Account

Disciple of Jonato

Octree Voxel Planet

Posted by , 09 January 2015 - - - - - - · 906 views

Just some fun with octrees and voxels.

Basically as the observer gets closer the voxels break themselves down into more accurate pieces of the planets terrain. It's like a weird mix of octree and voxels.

Posted Image


Unity Tile Map Editor

Posted by , 28 October 2014 - - - - - - · 1,935 views
unity, tile, map, editor and 1 more...
Unity Tile Map Editor Recently I started a game with a friend which required a tile map, the following is a series of the editor progress.

So first I got a basic layout of the UI:

Attached Image

Then a pluggable menu bar (Inherit from ITileMapMenuItem and add it to the window).

Attached Image

Followed by ripped images from Tiled and all basic tools in as skeletons

Attached Image

Then I added the layer control and underlying API alongside a tile map asset for Unity and tile map selector and Tile Map view and grid.



Then I added the actual logic for stamp tool, fill tool and erase tool, fixed up the selection rect and a few little bugs



Following that I added undo\redo and keybinds for menu items




Then I added a proper TileSet asset which holds a list of tiles and their shared sprite



Today I changed some bits of the TileSet UI and updated it to work with Unity 5 beta, cleaned up the API, properly saved the tile definitions inside of the tileset and added ability for tilemaps\tilesets to have different tile sizes.

Attached Image

Things I have left to do:

TODO:

- erase should set the mouse object to a light blue null tile
- tile defining (When creating a tile-set asset for collider \ rigid-body)
- click drag multi-tile selection and placement
- prefab selection and placement

And the current LoC is 2120:

Attached Image


Toasty Update #9

Posted by , 28 January 2014 - - - - - - · 766 views

Toasty Update #9 Hey guys!

The lack of recent updates was because I was travelling with my partner, we went to many places but the main event was Las Vegas new years, which was insane!

So, I've been back for a few days and I'm ready for another update in this one I have added a basic AngelScriptSystem, which is pretty interesting.

The angelscript system has a few cool features, the first being you can provide a main file to use which will make AngelScript your main entry point, this means your entire game needs to be in AngelScript rather than C++. The second is that you can add behaviour scripts to an entity, this should work exactly like Unity.

At the moment only the first feature is in place and I am still attempting to register all the methods and functions! But check it out:
void main()
{
	print("Hello world\n");
	print(1+1);
	print("Creating an entity!\n");
	
	Entity@ ent = Entity();
	print("The default name of this entity is: ");
	print(ent.GetName());
	print("\n");
	print("Setting the name to something else...\n");
	ent.SetName("NathansEntity");
	print("New name is: " + ent.GetName() + ".\n");
	
	GameSystem testSystem;
	testSystem.AddEntity(ent);
	
	print("Starting the loop in...\n");
	DoCountdown(5);
	
	while(true)
	{
		testSystem.Tick();
		print(testSystem.GetFPS());
	}
}

void DoCountdown(int a)
{
	for( int n = 0; n < a; n++ ) 
	{
		print(a-n+"\n");
		WaitForSeconds(1);
	}
	
	print("Go!\n");
}
The C++ is literally just this:
#include "AngelScriptSystem.h"

//Commented like a newb.
int main(int argc, const char* argv[])
{
	Toasty::AngelScriptSystem* system = new Toasty::AngelScriptSystem(nullptr, "main.as");
        delete system;
	return 0;
}
This script results in the following:

Attached Image
Attached Image

The only issue is the fact that Toasty is modular which means I have to make a choice, does the angelscript system know about every other system or does every other system know about angelscript? Not sure at the moment, but as I think on it more I am sure I'll come to a conclusion.


Toasty Update #8

Posted by , 21 December 2013 - - - - - - · 730 views

Okay, I ran into an issue with the editor lately, and that is when a plugin is added and it adds it's control to the inspector (think from Unity) when an entity is selected with a component it added to the engine it will position itself very far down making it not look aesthetic, which I think is important. But in the mean-time (I haven't been able to fix the bug yet) I worked on the Ogre3D renderer, it's pretty simple at the moment and contains these components:

Attached Image

OgreMeshComponent

Simple mesh component, links to a file which it uses as the mesh.

OgreCameraComponent

While this does work, it will immediately crash the app when two are added as I do not know how I can create a camera but not enable it, something I have to fix.

OgreLightComponent

A pretty simple component that just adds a light.

OgreTerrainComponent

Just creates a terrain component that randomly generates itself using perlin noise.


I have also created a basic plugin for this system in the editor which exposes the light and mesh components with only the light component actually having a custom control. You can actually see the issues with the inspector in this screenshot.

Attached Image


Toasty Update #7

Posted by , 17 November 2013 - - - - - - · 727 views
toasty, engine, editor, component and 5 more...
Toasty Update #7 This update is being dedicated to the editor and here is what I have done and what's left to do so far:

Scene Entity View

Used to add or remove entities from the GameSystem and current scene it displays a pure list of entities. It has the ability to filter entities by name and grouping of entities. Sends an entityselected event and entitydeselected event on selection or deselection of entities.

To Do:
  • Search \ Filter functionality
  • Grouping
  • Allow multi-entity selection

Project View

The project view is used to display the project as seen on disk. It also creates events for any views to listen to for selecting or double-clicking a file \ folder in the project view, this will allow things like the Scene Entity View to change scene based on double clicking in here.

To Do:
  • Allow Double-Click event listening
  • Allow Selecting event listening
  • Allow renaming of items within the view itself (Rather than only on disk)
  • Properly add items under correct folder and catching rename events
  • Add ability to open a project already created
In-Editor Networking

This is responsible for hosting and joining a project and monitoring the status of the network. It also has a simple chat box for sending messages to people connected to the server. Messages are currently just routed to the console.

To Do:
  • Properly send networked commands
  • Change commands so they affect files only
  • Add ability to lock a file or folder restricting the ability to modify it on other peoples computers
Console

Displays text sent from std::cout or printf as well as wxLogMessage (Which includes a timestamp).

To Do:
  • Should directly use a file which it watches for edits.
Inspector

For inspecting entities. Plugins can add controls to this when an entity is selected if they need to. The only control the always comes up is the EntityEditControl.

To Do:
  • Multi-entity selection
EntityEditControl

Allows the user to edit the name, position, rotation and scale of an entity.

To Do:
  • Multi-entity selection
Plugin Loading

Plugins should be allowed to add menu items, listen for selection events and add controls to the inspector.
  • Just a code cleanup required to make the plugin more secure from the application.

wxSFMLPlugin

Runs an SFMLRenderSystem, allows creation of SFML Windows through the use of menu items and automatically creates one. Should listen for entity selections and add controls required based on components the entity has inside the SFMLRenderSystem. Adds menu items for adding SFML specific components.

SFML Window

Used to display the SFMLRenderSystems components. It should allow easy view movement and entity movement.

To Do:
  • View movement (panning, zooming)
  • Grid and grid settings
  • Read from changes in a scene folder
Wew, that's a decently sized update. I made a video so you can easily see the editor in it's current state if you like.


Toasty Inspiration

Posted by , 12 November 2013 - - - - - - · 907 views

I just thought I might mention projects I keep up to date on to help inspire me to finish Toasty plus I check them out to steal features or some aspects of editor or engine design. This might also be useful for people looking to find free or paid engines or editors out there!

Unity3D is the most popular engine\editor on the market at the moment and even though I have a few beefs with it, it's actually pretty amazing and currently the best of it's kind. Highly pluggable and uses the awesome mono project. Expensive if you want certain features.

Leadworks 3 is a fairly well known engine\editor as well, recently kickstarting their linux port they have cool features such as visual scripting among others that I will be taking for inspiration!

Duality is a free 2D editor that has some nice 2D specific controls and effects which I would like to copy for the SFML plugin portion of the editor. Is built on C#.

CopperCube 4 uses wxWidgets to create a usable advanced interface for creating games and exports to various targets like Flash, WebGL and Android as well as Windows and Mac. Very good inspiration as it's fairly advanced and feature rich the only issue is it has a hefty price tag.

PolyCode is heralded as the 'Unity Killer' by a bunch of people over the internet for good reason. It's interface is fully customised and customisable and built using PolyCode itself. It's generally useable but doesn't officially provide binaries as of yet.

CraftStudio is a cool multi-user game creation. I think it's tagline: 'CraftStudio: the Game to make Games' is an apt description. The real-time multi-user part is what I'll be copying to Toasty.

Game Maker: Studio An amazing piece of software for creating 2D games, IMO it's better than Unity3D (including with the latest 4.3). Is insanely expensive.

NeoAxis is a fairly mature piece of software, has some weird UI choices but interesting to follow and it's examples are awesome. Recently came
out with a free version.

Construct2 A very nice piece of software with lots of different exports available, it's has only UI scripting available but is still pretty powerful. It keeps a very native windows feel (Think the new Office).

Ogitor a not so mature project, however is usable for Ogre projects I used old versions of this to help me get Ogre working on Mac. It's good for any integration with Ogre and is very pluggable.

Tiled is not for making games, but for making the maps for games. It has some advanced tile map functionality which I will also be stealing and adding some of my own additions. I'll be thinking about making the tiled format loadable for my editor to test out my tile map features.

Cool engines that I also watch:
Mutiny

Urho3D

If you know of any other editor \ engine that could be great for inspiration or even using feel free to leave a comment.


Toasty Update #6

Posted by , 12 November 2013 - - - - - - · 597 views
engine, sfml, component, based and 3 more...
Toasty Update #6 So in this update the big change is proper depth ordering, until now the depth of things drawn on screen using the SFMLRenderSystem was based on what order the component was added to the system. The new way just utilises the z component in the entities position property and sorts the vector every update and while may not be that great in my tests has almost no performance loss.

I also changed the render system so that it no longer directly handles the texture caching responsibility and it is now handled by the TextureResourceLoader which it holds, I also plan on doing the same thing with culling and sorting which will sort of work like this:
  • User adds a bunch of render components to some entities, then on every update:
  • RenderSystem request a cull by the assigned CullingMechanism (If one is assigned).
  • RenderSystem requests a sort from the culled components using the SortingMechanism (If one is assigned).
  • RenderSystem draws the culled and sorted vector.
Actually just talking about it I decided to do it, at the moment it just compares the bounds of all components against the current main view every update. I need to come up with a better way to cull objects though, a QuadTree comes to mind, but not sure how to update it I might have to add an isDirty flag to an entity and whenever it's position is changed update that.

So here is culling and sorting working on 7k+ entities:

Attached Image

Compared to no culling but sorting:

Attached Image

That's a difference of ~180 FPS!

Pretty good IMO!


Toasty Update #5

Posted by , 08 November 2013 - - - - - - · 694 views

Recently I have been thinking about how the editor works, now I don't really have much experience with GUI applications, especially those that are going to be as complicated as a game editor, yes I have done simple stuff like map editors but they do not compare.

So the first requirement I had is I want an interface similar to Visual Studio or Unity3D, with the detachable windows \ panes, the reason for this is because that kind of program works well with multiple monitors and doing different tasks along with the ability to make the experience your own, positioning windows where and how you want saving different layouts for different games which is something I find very handy myself in Unity3D.

The second requirement is because of the modularity of the engine the editor needs to be just as modular, therefore it needs to be plugin oriented.

The third requirement is the need for multi-user editing, which the Toasty Editor will be based on. This means that at any time you can host a project and see real-time edits of other users. This will require the locking of entities and components so only you can work on it, but this also means there needs to be admins or project managers with permissions to unlock anything. The direct idea behind this is that you could monitor and manage the project from within Toasty itself. I'll talk about this later on.


So to begin with the choice of wxWidgets as my GUI of choice. The reasons follow as:
  • Cleanliness, don't have to use macros and the ability to customize for smallest library size.
  • Unicode
  • wxAUI - The only issue with this is it doesn't have all the features I want however it's...
  • Open source with a good licence so i'm working on those features at the moment!
  • Excellent community support, both from the developers on the google groups wx-users and wx-dev and from the users at the wxForums. Ask a question on google groups and you'll at least have a response the next day.
  • Ultra active development, there are many commits per day, just checkout the puchcard.
  • Keeps backwards compatibility for a decent time
  • Works on Linux, Mac and Windows.
This solves requirement number one and two. I have done a bit of research in plugin architectures and the way I have found is to have a common library (wxWidgets and the plugin interface library I write) which the main application and any plugins will link to this way the common library is the plugin interface and because the main application uses it, it should be powerful enough to make any kind of plugin required. The only thing is making it secure!

The third requirement however is a bit harder but I think I have it solved with the MVC pattern. So the Model is the project in the filesystem so scenes are scenename.scene folders that contain entity files. Views can then listen for modification of files or folders they are interested in and display data as required. Controllers can be anything that edits the files and folders that represent the project but for the networking I intend to have NetworkedCommands which one will have to inherit from which will allow others to undo \ redo external changes and on top of that can have the ability to log all changes in large projects!

Lets see how it goes!


Toasty Update #4

Posted by , 31 October 2013 - - - - - - · 689 views
entity, component, system, toasty and 3 more...
Toasty Update #4 Hey there! Look it's already Update #4!

So in this update I included a video to show things off in motion and the video has an explanation of the update. The test currently involves about 40000 tiles (200*200 map) and ~4000 entities (trees and a single animated goblin) the map is randomly generated each time (Which made me realise how complicated C++11 random number generation is, so I'll have to pull that out into some easier to use functions later on).

I decided the best way to test a game engine is to create a game with it, so I made this test which will be a game similar to settlers with not much complexity.

Stuff to do:
  • AI System
  • Builders + A couple of buildings
  • Have trees drop logs which loggers pickup and take back to a storage area
  • Soldiers
Go here to see the demo. It requires the VC++ Redist 2012 package to run.


Toasty Update #3

Posted by , 27 October 2013 - - - - - - · 767 views
c++, entity, component, based and 6 more...
Toasty Update #3 Things done for this update:

SFMLDeltaTimer Added

I added an SFML based timer so that it can be used instead of the chrono timer on windows.

SFMLRenderSystem Added

Attached Image


So the SFML render system is pretty simple, it's constructor takes width, height and a window title. It automatically creates a window with those attributes (Which you can change or get after creation). It also handles management of textures, if you try and load a texture twice it will return the original texture. this works for sprites as well. The render system currently has a single view which one can manipulate, it basically just exposes zooming, moving and rotating of a view, support for multiple views will come eventually. If the window is closed it will return false on it's Update function and close the window.

This system updates a render components position, rotation and scale to that of the entity just before drawing the entity. The system does no culling of any sort at the moment nor does it have any kind of depth sorting it is just last component added is the one drawn on top.

SFMLRenderComponent Added

Attached Image

This is essentially just a sprite, it requires a string and an SFML render system to create. It uses the SFML render system to get a texture pointer which it uses to create the sprite.

SFMLTextRenderComponent Added

Attached Image


Just used to render some text onto the screen and at the moment will load and use it's own font resource, it's something I'll have to change.

SFMLAnimationSystem Added

Attached Image


This is a spritesheet based animation system and is not that robust at the moment. If the animation component has been set to play it will advance the position of the frame to the next one after the frame timer goes past the allowed frame time.

SFMLAnimationComponent Added

This just contains a map of strings to animation data, what the current animaiton is and whether it is playing. It has functionality for stopping and playing at the moment. It requires a SFMLRenderComponent to be able to be created as it uses it's sprite, it's best to give it the component that is attached to the entity! After it's created you have to give it very specific data:
  • frameWidth
  • frameHeight
  • frameNumber
  • startX
  • startY
  • currentFrame
  • currentRow
  • currentCol
  • animationTime
  • frameTime
It's done this way because you might have different sized animations in the same atlas.
SFMLTileMapComponent Added

Attached Image


During my test I noticed performance issues trying to render my own little map, so I decided to make this to alleviate that. It's a simple class and takes a string to use as the texture atlas, an int* for the data, the dimensions of the tiles and the desired width and height of the map. The data is just ints ranging from 0 to how many tiles you have, the SFMLTileMapComponent will assign 0...N in a row first left to right order, so that the top left tile is 0 and the on to it's right is 1. I basically stole some code off the SFML wiki to get this working.

I plan on having several TileMap implementations, a simple one like this one and a multi-layer, multi-atlas one, I'll probably think of more features as I think on it.

GameSystem

I added the ability to create an entity in the game system, this makes creating a relevant entity to use in a game system a lot neater. I also added an ability to get all entities in a radius, it's pretty fast but I wouldn't use it if you had more than...say 1000 entities. I had a crazy bug when I first started:

Attached Image


and after a bunch of debugging and optimising it turned out I had just copy pasted x where y should have been...

Attached Image



I am already seeing failures in my API design and so I am re-evaluating and might do a refactor, although not before I get this version 'done'.



The (MinSizeRel) ToastySFMLRenderSystem.dll is about 64 KB.



Stuff TODO:

  • Fix crash if texture load failed from the render system
  • Add an action based sfml input system (Unity style)
  • Add basic collision system for SFML (no collision response)
  • Add culling pluggability into the SFML Render System
  • Have at least one culling mechanism to use in the SFML Render System
  • GUI, I'll probably base it on an already existing GUI.
  • A way to re-order render components
That's it for now! Thanks for reading!






December 2016 »

S M T W T F S
    123
4 5 678910
11121314151617
18192021222324
25262728293031

Recent Entries

Recent Comments

Latest Visitors