Jump to content

Jorns2

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Jorns2

  1. Hi, i use c++ and when player collides with physical objects (i have some boxes on map (20-30)  fps drop to 2-4 ms and lags.

    If player collides only with terrain everything is ok. I have noticed when game starts after compiling code on start lags and after 2-3 seconds fps go to 60. And after collision with physical objects drop fps again. Where is the problem.

     

    Here is some code:

     

    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    
    Entity* player;
    const int playerAngleModifier = 3;
    int playerAngle=0;
    int playerMovement = 0;
    int playerMovementSpeed = 7;
    
    
    
    void ListEntities(Entity* entity, Object* extra)
    {
    	
    	if (entity->GetKeyValue("type") == "player")
    	{
    		System::Print(entity->GetKeyValue("type"));
    		player = entity;
    	}
    }
    
    
    int main(int argc, const char *argv[])
    {
    	Leadwerks::Window* window = Leadwerks::Window::Create("TEST", 0, 0, 1366, 768, Leadwerks::Window::Fullscreen);
    	Context* context = Context::Create(window);
    	World* world = World::Create();
    
    
    
    	
    
    
    	
    
    	Map::Load("Maps/Prva mapa.map", ListEntities);
    
    
    	Camera* camera = Camera::Create();
    	camera->SetPosition(player->GetPosition()+Vec3(0,15,0));
    	camera->SetRotation(90, 0, 0);
    	camera->SetFOV(45);
    	Listener::Create(player);
    
    
    
    	while (true)
    	{
    		if (window->Closed() || window->KeyDown(Key::Escape)) return false;
    
    	
    		if (window->KeyDown(Key::Up))
    		{
    			playerMovement = playerMovementSpeed - (playerMovementSpeed * 2);
    		}
    		else if (window->KeyDown(Key::Down))
    		{
    		playerMovement = playerMovementSpeed;
    		}
    		if (window->KeyDown(Key::Left))
    		{
    			playerAngle = playerAngle - playerAngleModifier;
    		}
    		else if (window->KeyDown(Key::Right))
    		{
    			playerAngle = playerAngle + playerAngleModifier;
    		}
    
    
    
    		player->SetRotation(0, playerAngle, 0);
    		player->SetInput(playerAngle, playerMovement, 0);
    		camera->SetPosition(player->GetPosition() + Vec3(0, 15, 0));
    
    
    		playerMovement = 0;
    
    
    
    
    		Leadwerks::Time::Update();
    		world->Update(1);
    		world->Render();
    		float text = Math::Round(Time::UPS());
    
    		context->SetBlendMode(Blend::Alpha);
    		context->DrawText( "FPS:" + std::to_string(text), 2, 10);
    		context->Sync(true);
    
    
    	}
    	return 0;
    }

     

  2. I have used a example script from documentation

    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    Model* model = NULL;
    int main(int argc, const char *argv[])
    {
        Leadwerks::Window* window = Leadwerks::Window::Create();
        Context* context = Context::Create(window);
        World* world = World::Create();
        Camera* camera = Camera::Create();
        camera->Move(0,0,-3);
        Light* light = DirectionalLight::Create();
        light->SetRotation(35,35,0);
            
        model = Model::Box();
        model->SetColor(0.0,0.0,1.0);
    
        while (true)
        {
            if (window->Closed() || window->KeyDown(Key::Escape)) return false;
        
            model->Turn(0,Leadwerks::Time::GetSpeed(),0);
            
            Leadwerks::Time::Update();
            world->Update();
            world->Render();
            context->Sync(false);
    
        }
        return 0;
    }

    and then:

     

    image.thumb.png.2a9e167c54a66c83d27f5c32e0dee777.png

  3. Hi, i started programming my game with c++. When i tried to load context,world,window everything is ok. When i call world->Update i give error: attempt to index world a nil value or something like this.

    . In definition is virtual void Render();//lua. If i understand this good world->Render method is executed only in .lua script? Why ?

    This is caused when i Load map in c++..

     

    Thanks for answers.

  4. I try it but with no difference i have tried a other texture

    The bottom part is terrain (blurry) and top part from picture is a csg box.

    Fyi i disable mipmaps - this cause a sharp texture on csg box (if i look from higher height)

     

    image.thumb.png.4be1d21a7d0d7ea91ce87427b8d644d7.png

  5. I know, i know how i can change a texture size, but problem is other.

    I ask how i can change a texture quality. Look at the darker object on printscreen - He has a bigger quality than terrain.Terrain texture quality has no details and bumpinnes (I have used a same texture and bumpmap).For explanation - I have a solid geometry with diffuse shader and his quality from top view is OK. When i use the same texture and dot3 texutre for terrain - texture become a blurry just has no quality. Another printscreen here:

     

    image.thumb.png.892efbc566dbbb1e66da5ee0c837213d.png

  6. Hi all,

     

    How i can change shader to be more detailed terrain texture? So there is a stair wchich i made with csg boxes with good details (diffuse shader). When i use a classic terrain i have blurry texture. Before i read forum and i look at same problem which is resolved by modifiyng value #define TERRAIN_LOW_FREQUENCY_BLEND 8 to #define TERRAIN_LOW_FREQUENCY_BLEND 0. And i remind i have topdown view game (like gta2). How do i make it ?

    image.png

  7. So, i have fully reinstalled windows (complete clear installation) and the problem persist. I have two suggestions: 

    problem is located in steam (where is stored player setting etc...)

    or

    i have another problem with starting leadwerks. Application throuh steam won't start, the i found problem with exe which request "Msvcr100.dll" (yes i have installed msvc++ redist) . I have downloaded this library and engine works

     

    But fbx. models cannot be converted again and again...   

     

    When i use converter in folder Tools it works perfectly, only drag-n-drop system in editor not working.

     

    And before (year before) all works perfect in this time i use 4.3 or 4.4 i dont know...

×
×
  • Create New...