Leviathan game engine
Todo List
Page Events

List events that are recognizable by scripts here

Allow scripts to create data for Leviathan::Event objects

Page Getting started tutorial
Create tutorials
Page How the Leviathan VideoPlayer Works

Make sure the latest, working code is copied here

This is outdated as CEGUI is no longer used. Replace with an example of playing video on an Ogre material

Page Leviathan Connections

Add a test that verifies that the server can be the one to call Leviathan::Connection::Init first

Add data to the Connect request / response to allow connections with the master server.

Class Leviathan::BaseConstraint
Make this actually ThreadSafe
Member Leviathan::BaseConstraint::Init ()
Allow the error messages to be silenced
Member Leviathan::BindEntity (asIScriptEngine *engine)
Create a wrapper around NewtonBody which has reference counting
Member Leviathan::BindNamedVars (asIScriptEngine *engine)
make this safe to be passed to the script
Class Leviathan::CallableObject
Rewrite this to be cleaner with the event return codes
Member Leviathan::CallableObject::GetListenerNameFromType (EVENT_TYPE type)
Have a bi-directional map to speed up lookups
Class Leviathan::ComplainOnce
Make this thread safe
Class Leviathan::ComponentState::PotentiallyUpdatedValue< T >
Replace with a bitfield in ComponentState that automatically is configured to be large enough
Member Leviathan::ComponentState::PotentiallyUpdatedValue< T >::BitsSetUntil (uint8_t BitNum) const
Verify that tail call optimization kicks in and this is inlined
Class Leviathan::ConnectedPlayer
Add a kick method and use it in NetworkServerInterface::CloseDownServer
Member Leviathan::ConnectedPlayer::OnKicked (const std::string &reason)
Add the reason to the packet
Member Leviathan::Connection::_Resend (SentRequest &toresend)
Create Resend method that pools together many failed messages
Member Leviathan::Connection::CalculateNetworkPing (int packets, int allowedfails, std::function< void(int, int)> onsucceeded, std::function< void(PING_FAIL_REASON, int)> onfailed)
Check whether the packets should be send in a cluster or not (as they are currently sent in one go)
Member Leviathan::Connection::Connection (const std::string &hostname)
Add a option to game configuration for default port
Member Leviathan::Connection::ExtraAckCount
Implement this
Member Leviathan::Connection::GenerateFormatedAddressString () const
this could be cached
Member Leviathan::Connection::Init (NetworkHandler *owninghandler)
Make this async resolve the address
Member Leviathan::Connection::LastReceivedMessageNumbers
Implement a lower bound (under which everything is dropped) and make this smaller
Member Leviathan::Connection::LastUsedLocalID
Fix that
Member Leviathan::Connection::SendCloseConnectionPacket ()
Add a message parameter for the reason
Class Leviathan::CustomCommandHandler

Allow scripts to register these

Allow optional usage of an internal command table with descriptions etc.

Class Leviathan::DataBlock< DBlockT * >
Add support for move operators to this too
Class Leviathan::DataBlock< DBlockT >
Add move constructor and move assignment operators
Class Leviathan::Delegate
Allow unregistering callbacks
Member Leviathan::Delegate::Call (const NamedVars::pointer &values) const
Find a way to more efficiently pass known types or data that may not be stored (only copied)
Member Leviathan::Engine::OpenNewWindow ()
Allow changing the parameters
Member Leviathan::Engine::Release (bool forced=false)
Add a thread that monitors if the thing gets stuck on a task
Member Leviathan::EntitySerializer::DeserializeWholeEntityFromPacket (GameWorld *world, Lock &worldlock, ObjectID id, sf::Packet &packet)
Allow reporting invalid data
Member Leviathan::GameModule::GameModule (const std::string &modulename, const std::string &ownername, const std::string &extension="txt|levgm")
Make load all source files, instead of loading just the first
Member Leviathan::GameWorld::CreateEntity ()
Make this have a per world counter
Member Leviathan::GameWorld::DestroyEntity (ObjectID id)
Make this less expensive
Member Leviathan::GameWorld::GetAddedFor (COMPONENT_TYPE type, std::vector< std::tuple< void *, ObjectID, ComponentTypeInfo >> &result)
Find a better way than having to have the component type specified here. This is only used by script node proxy, so this has to be somewhere for it to access
Member Leviathan::GameWorld::HandleEntityUpdatePacket (std::shared_ptr< NetworkResponse > message)
Cache the update data for 1 second and apply it if a matching entity is created during that time
Member Leviathan::GameWorld::NotifyEntityCreate (ObjectID id)
Allow to set the world to queue objects and send them in big bunches to players
Member Leviathan::GameWorld::Render (int mspassed, int tick, int timeintick)
Allow script systems to specify their type
Member Leviathan::GameWorld::SetFog ()
Fix this for Ogre 2.1
Member Leviathan::GameWorld::SetWorldPhysicsFrozenState (bool frozen)
Synchronize this over the network
Member Leviathan::GameWorld::ShouldPlayerReceiveEntity (Position &atposition, Connection &connection)
Implement this
Member Leviathan::GeometryHelpers::CreateScreenSpaceQuad (const std::string &meshname, float x, float y, float width, float height)
Parameter to specify if shadow geometry is needed
Member Leviathan::GlobalCEFHandler::RegisterCustomJavaScriptQueryHandler (std::shared_ptr< GUI::JSAsyncCustom > ptr)
Add support for removing existing ones
Member Leviathan::GUI::CefApplication::OnRegisterCustomSchemes (CefRawPtr< CefSchemeRegistrar > registrar) override
Register custom schemes
Member Leviathan::GUI::CefApplication::OnRenderThreadCreated (CefRefPtr< CefListValue > extra_info) override
Should the custom extensions require static strings that would also be available in the render process? To reduce copying and converting between utf8 and utf16
Class Leviathan::GUI::GuiManager
Add GUI window objects to this which are associated with different windows
Member Leviathan::GUI::GuiManager::GetTargetViewForInput (bool iskeypress, int mousex, int mousey)
Add support for multiple views inside a window. And prefer the active input if this is a keypress
Member Leviathan::GUI::GuiManager::LoadGUIFile (const std::string &urlorpath, bool nochangelistener=false)
Make sure that loading a path with spaces in it works
Class Leviathan::GUI::VideoPlayer
Implement pausing and seeking
Member Leviathan::GUI::VideoPlayer::OnVideoDataLoaded ()
Rename to CreateOutputTexture
Member Leviathan::GUI::View::OnLoadEnd (CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, int httpStatusCode) override
Make that future multi Gui::View windows don't all get focus back
Member Leviathan::GUI::View::OnProcessMessageReceived (CefRefPtr< CefBrowser > browser, CefProcessId source_process, CefRefPtr< CefProcessMessage > message) override
check access level properly
Member Leviathan::GUI::View::SetZVal (float zcoord)
This is unimplemented
Allow this to not be a multiple of TICKSPEED or smaller than it
Member Leviathan::LAN
A proper lan detection
Class Leviathan::Logger
Allow logs that don't save to a file
Class Leviathan::NamedVariableList

Make this reference counted

Make all methods throw exceptions on invalid operations

Class Leviathan::NamedVars
Make all methods throw exceptions on invalid operations
Member Leviathan::NamedVars::NamedVars (const std::string &datadump, LErrorReporter *errorreport)
Allow predefined values
Class Leviathan::NetworkCache
Make the QueuedTasks used in this class completely thread safe in case someone decides to delete lots of variables
Member Leviathan::NetworkCache::RemoveVariable (const std::string &name)
send remove message to clients
Member Leviathan::NetworkClientInterface::_OnProperlyConnected ()
Do what this should do
Member Leviathan::NetworkClientInterface::DisconnectFromServer (const std::string &reason, bool connectiontimedout=false)
Add a check to not close the connection if it is used by RemoteConsole
Member Leviathan::NetworkMasterServerInterface::CloseDown () override
Actually call this, maybe make this an event listener
Class Leviathan::NetworkResponse
Re-implement limiting string lengths in messages
Member Leviathan::NetworkServerInterface::_HandleServerJoinRequest (std::shared_ptr< NetworkRequest > request, Connection &connection)

Check connection security status

Add basic connection checking and master server authentication check

Member Leviathan::NetworkServerInterface::CloseDown () override
Actually call this, maybe make this an event listener
Member Leviathan::ObjectFile::AddObject (std::shared_ptr< ObjectFileObject > obj)
Disallow adding templates with this function
Member Leviathan::ObjectFile::FindTemplateDefinition (const std::string &name) const
Allow template overloading with different number of parameters
Member Leviathan::ObjectFile::GetObjectWithType (const std::string &typestr) const
Add a function which returns all that matched the type
Member Leviathan::ObjectFile::IsObjectNameInUse (const std::string &name) const
Check template names
Class Leviathan::ObjectFileTemplateDefinition

Potentially allow changing the definition to update instantiations

Make this more robust and nice and reduce the bloat in the implementation

Member Leviathan::ObjectFileTemplateDefinition::CreateInstanceFromThis (const ObjectFileTemplateInstance &instanceargs, LErrorReporter *reporterror=nullptr)

Refactor this function to be smaller

Allow objects to use the special defined values in the ObjectFileProcessor

Class Leviathan::ObjectLoader
Allow objects to be created that will be sent to clients only after the caller has had the chance to create constraints etc.
Class Leviathan::ObjectPool< ElementType, KeyType, AutoCleanupObjects >
Should this class use the ordered_malloc family of methods to allow better use of memory blocks (but is slightly slower for a large number of allocations)
Member Leviathan::ObjectPool< ElementType, KeyType, AutoCleanupObjects >::ObjectPool ()
Figure out the optimal value for the Elements constructor (initial size)
Class Leviathan::ObjectPoolTracked< ElementType, KeyType, AutoCleanupObjects >
Created and destroyed vectors could use swap with last and remove the last to remove more effectively
Member Leviathan::ObjectPoolTracked< ElementType, KeyType, AutoCleanupObjects >::RemoveFromAdded (KeyType id)
Check if this gives better performance than noticing missing elements during node construction
Member Leviathan::ObjectsComponentStates< StateT >::GetMatchingOrNewer (int ticknumber) const
How can the caller of this method detect when a state has been missed and should instead (maybe) wait a bit? Or should we just skip missed states and start interpolating from the later state
Member Leviathan::PhysicalWorld::ResimulatedBody
Potentially allow this to be a vector
Class Leviathan::Physics
Global Newton lock
Member Leviathan::Physics::ApplyForceInfo::Callback
Allow deleting this force from the callback
Class Leviathan::Position
Initial position states should not be generated or initially sent data shouldn't have the state instead the first state would be guaranteed to be sent after it
Class Leviathan::ProceduralSoundData
Move all the other classes from this file to SoundInternalTypes.h
Class Leviathan::RayCastHitEntity
Move to a new file
Class Leviathan::Received::StoredState
Possibly add move constructors
Class Leviathan::ReferenceCounted
Make sure that all functions using intrusive pointers use the MakeIntrusive function
Member Leviathan::ReferenceCounted::GetRefCount () const
Make sure that the right memory order is used
Member Leviathan::RenderingPositionSystem::CreateNodes (const std::vector< std::tuple< RenderNode *, ObjectID >> &firstdata, const std::vector< std::tuple< Position *, ObjectID >> &seconddata, const ComponentHolder< RenderNode > &firstholder, const ComponentHolder< Position > &secondholder)
This should probably not be templated
Member Leviathan::RenderNode
Hidden as serialized data
Class Leviathan::RepeatCountedTask
Merge common parts from this and RepeatCountedDelayedTask
Member Leviathan::RequestCommandExecution
Implement if(Command.length() > MAX_SERVERCOMMAND_LENGTH)
Class Leviathan::ResourceFolderListener
Use only one inotify instance on linux
Class Leviathan::ResourceRefreshHandler
Combine listeners with the same file into a single thing
Member Leviathan::ResourceRefreshHandler::ListenForFileChanges (const std::vector< const std::string *> &filestowatch, std::function< void(const std::string &, ResourceFolderListener &)> notifyfunction, int &createdid)
Allow watching for files in subfolders
Member Leviathan::ResourceRefreshHandler::StopListeningForFileChanges (int idoflistener)
Implement this
Member Leviathan::RunTaskQueuerThread (ThreadingManager *manager)
Improve performance
Class Leviathan::ScriptComponentHolder
Allow defining if release should be called on the script object. and then calling it now only the object is dereferenced so that it probably gets garbage collected soon
Member Leviathan::ScriptComponentHolder::GetIndex () const
Check can we somehow return all the keys and the objects to avoid having to call Find from scripts after this
Member Leviathan::ScriptExecutor::GetScriptModuleByFunction (asIScriptFunction *func, bool reporterror)
When module is null find the module by AngelScript module pointer (set the userdata pointer on the module to point to the ScriptModule object) for faster finding
Member Leviathan::ScriptExecutor::RunReleaseRefOnObject (void *obj, int objid)
This is actually a method in the angelscript engine, so use that, but this is a good example how to run any behaviour
Member Leviathan::ScriptExecutor::RunScript (const std::shared_ptr< ScriptModule > &module, ScriptRunningSetup &parameters, Args &&... args)

Allow recursive calls and more context reuse. Also wrap context in an object that automatically returns it in case of expections (_HandleEndedScriptExecution can throw)

Also make all the script module using functions automatically get it if they need for error reporting

Member Leviathan::ScriptExecutor::RunScript (asIScriptFunction *func, std::shared_ptr< ScriptModule > module, ScriptRunningSetup &parameters, Args &&... args)
Wrap context in an object that automatically returns it in case of expections (_HandleEndedScriptExecution can throw)
Member Leviathan::ScriptExecutor::RunScriptMethod (ScriptRunningSetup &parameters, asIScriptFunction *func, void *obj, Args &&... args)
Merge common parts with RunScript
Class Leviathan::ScriptSafeVariableBlock

Unify multiple values containing things and naming

This whole thing should be made again and the types should be integrated to a single VariableBlock class that has a void* and an angelscript type

Class Leviathan::ScriptScript
Remove this and replace with direct access to ScriptModule
Member Leviathan::Security
Implemented packet breaking for this type
Class Leviathan::Sendable::ActiveConnection
Make sure that CheckReceivedPackages is called for entities that have stopped moving ages ago to free up memory
Member Leviathan::Sendable::ActiveConnection::SentPackets
Move this into GameWorld to keep a single list of connected players
Class Leviathan::SendableSystem
Change this to take distance into account don't send as many updates to clients far away
Member Leviathan::SentNetworkThing::GetStatus ()
Make sure this cannot deadlock
Class Leviathan::SimpleDatabase
This needs proper tests and fixing
Class Leviathan::StateHolder< StateT >
The GameWorld needs to notify this when ObjectID is deleted
Class Leviathan::StringOperations

Get rid of ElementType and just use ints for everything and hope that it is large enough

Drop wstring support

Member Leviathan::StringOperations::ToUpperCase (const StringTypeN &data)
Make this work with any unicode characters
Class Leviathan::SyncedResource
Possibly do a global static class that will automatically register all when single StartSync is called
Member Leviathan::SyncedResource::SyncedResource (const std::string &uniquename)
Actually check if the name is actually unique
Member Leviathan::SyncedResource::UpdateOurNetworkValue (Lock &guard)
Proper locking
Class Leviathan::SyncedVariables


Add function to be able to check if sync completed successfully

Member Leviathan::SyncedVariables::ValueNamesUpdated
Potentially use a map here
Class Leviathan::System< UsedCachedComponentCollection >
It would bemore efficient to directly create nodes as entities are created instead of running CreateCachedComponentCollections (implemented in subclasses of this)
Member Leviathan::SystemCachedComponentCollectionStorage< UsedCachedComponentCollectionT >::TupleCachedComponentCollectionHelper (ObjectPool< std::tuple< FirstType &, SecondType &>, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder)
Also figure out if "CachedComponentCollections.Find(id) != nullptr" should be before _TupleHelperGetIfComponentExists
Member Leviathan::ThreadingManager::Release ()
Do something about unfinished tasks here
Member Leviathan::ThreadSafeObjectPool< ElementType, KeyType, AutoCleanupObjects >::RemoveFromAdded (Lock &guard, KeyType id)
Check if this gives better performance than noticing missing elements during node construction
Member Leviathan::VariableBlock::ConvertAndReturnVariable () const
Throw an exception if unallowed
Class Leviathan::Window
Implement global lock for input handling
Member Leviathan::Window::_StartGatherInput ()

Move to KeyMapping.cpp

Fix mouse capture

Member Leviathan::Window::InjectMouseWheel (const SDL_Event &event)
allow configuring if mouse wheel is considered a key (for Gameplay input mode)
Page NamedVars
This needs redoing
Member Pong::PongGame::OnPlayerStatsUpdated (PlayerList *list) override
Implement this
Member Pong::PongServer::RunAITestMatch ()
Add a score limit and a way to go back to default state afterwards
Make this work
Page Support of event types in scripts
Remove this CEGUI mention and add new GUI click stuff
Actually implement callbacks to ThreadingManager for Engine to call this and make this work