Jump to content

AggrorJorn

Members
  • Posts

    4,816
  • Joined

  • Last visited

Posts posted by AggrorJorn

  1. 11 hours ago, burgelkat said:

    Creating a river with the Spline Tool from Aggror. I love this feature. Too bad that there is no possibility to see the result in the editor

    Don't forget to credit Shadmar, it is all his shader work that made it possible. 

    • Like 1
  2. That is the cool thing about game development. Things can magically work their way around in your game. I will have a look this weekend.

    I expect that a buffer needs to get cleared at some point. I can't find it in the API docs though.

  3. 5 hours ago, jerleb said:

    Does developing games require a better graphics card than playing them? 

    Not per se, but it can't hurt to upgrade your graphics card. From a bright side: your game is developed against the lowest specs. If it runs on your pc, anything with better hardware will certainly work.

    A cheap graphics card with a good bang for buck is the GT 1030. 

    • Like 1
  4. If you are really new I would start of with Lua, because you can get results a little bit faster. Plus you can make use of the editor scripts.

    You can do everything that you mention in your post using the Sprite class. They can automatically face the player camera. You don't have to worry about performance. This also affects the GPU rather than the CPU.

    https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_Model_Sprite

    You could do your level design with CSG brushes and use enemies/pickups using sprites. 

    • Like 1
  5. Are you using Leadwerks widgets or just drawimage etc? Can you post a screenshot of what is going wrong? I can't see the hud being drawn in the minimap.

    So during the update, your player camera is placed in the sky, rotated so that it looks down and then what the camera sees is being stored in a buffer. this buffer will result in to the minimap texture drawn on to the screen.

  6. Sorry hadn't had time to look at the project yet.

    On 2/20/2018 at 5:28 PM, havenphillip said:

    One last thing is that the minimap shows my other HUD elements inside the minimap. I don't know of any way to get rid of that but I would love to get rid of it. It's workable as is but it's one of those little annoyances in the back of my mind.

    As for the UI being drawn inside the minimap: disable all UI widgets before rendering the world for the minimap. In you minimap script do something like:

    DisbaleUI()
    world:Render()
    EnableUI()

    The documentation contains a Hide and Show function for widgets you can use for this. https://www.leadwerks.com/learn?page=API-Reference_Object_Widget_Hide 

  7. Okay so the white screen is a good sign. The original in game menu code is still in place and also reacts to the escape key being pressed. The easiest solution at that point is to use another key. Or you have to make sure that the mainmenu script doesn't work when you have initiated the ending screen. 

    The reason you are seeing a white screen is because white is the active color. Use the SetColor() command right before drawing a rect to set the color.

    I would recommend following the tutorials in the docs and possibly the lua basics. https://www.leadwerks.com/learn?page=

  8. You can go the project manager and press export. After the export is made simply exclude files that are not used by the map you want me to open. Think about sounds, models, terrain textures. This reduces the files you want to send to me significantly.

  9. First off I would recommend watching some tutorials about how lua scripting works in combination with Leadwerks. Some usefull tutorials: 

     

     

    Secondly:

    Pasting in the code from the previous posts isn't going to work because they are not object scripts, but adjustments to the main.lua script.

    Create a new script and call it something like endscreen.lua and attach it to your pivot. Drag this pivot in to the flowgraph as well. Use the code below for the endscreen.lua script. (warning: I have not tested this.)

    --This function is used to connect to in the flowgraph editor.
    function Script:EnableEndScreen()--in
    	self.drawEndScreen = true
    end
    
    --Draw some text that the game is closing and that they need to press escape again.
    function Script:PostRender(context)
        if self.drawEndScreen then
            --Draw a black screen
            context:DrawRect(0,0,context:GetWidth(),context:GetHeight())
    
            --Draw red text
            context:SetColor(1,0,0)
            context:SetBlendMode(Blend.Alpha)
            context:DrawText("Thanks for playing. Press escape to quit)",0,200,512,512)
            context:SetBlendMode(Blend.Solid)
        end
    end

     

  10. I actually meant a zip file so that I can import the project and try out the map.(minus unnecessary models, sounds etc). I would have to build up a scene from scratch to try out your code. 

  11. A real basic approach would be something like this (pseudo code)

     

    while gameIsActive do   
        --Start the ending phase of the ending     
    	if  window:KeyHit(Key.Escape) then 
            closingGameInitiated = true
        end
    
        -- The game is closing and by pressing escape again, you close the game completely
        if closingGameInitiated and window:KeyHit(Key.Escape) then
            return false 
        if 
    
    	Time:Update()
    	world:Update()
        world:Render()
        
        --Draw some text that the game is closing and that they need to press escape again.
        if closingGameInitiated then
            --Draw a black screen
            context:DrawRect(0,0,context:GetWidth(),context:GetHeight())
    
            --Draw red text
            context:SetColor(1,0,0)
            context:SetBlendMode(Blend.Alpha)
            context:DrawText("Thanks for playing. Press escape to quit)",0,200,512,512)
            context:SetBlendMode(Blend.Solid)
        end
    
    	context:Sync(false)
    end

     

  12. Ah that would not work I see now. Can you undo the if statement with the last changes and make a screenshot of what your are currently seeing.

    That last if statement is also confusing me a little since I would not expect any enemies to found outside the drawing rectangle. But perhaps with an offset here and there, some enemies might slip through. Alternatively the calculation for drawing the enemy pos is not correct.

    Everything so has been from the top of my head. If you want I can have a look at your project. Can you send the project via pm? (excluding assets I do not need.)

     

  13. Note that this line 

     (self.radar / 2 / self.radar)

    will always return the same value, if self.radar is above 1. For instance: (20/2) /2 = 0.5 or (80/2) / 80 = 0.5.  It is probably unlikely you will use a value smaller than 1, so I would just do self.miniMapSize.y / 2. 

     

    7 hours ago, havenphillip said:

    I'm trying to get the dots to disappear when they are outside of the miniMapSize.x and .y but this only works on the right border and the bottom border. Why is it not doing the same on the top and left? Need to learn Vec4?

    No need for Vec4 (can be used for colors, uv coordinates etc). You are very close to achieving this btw. If you look at your if statement you can see that you only check the most outer right and outer bottom of the minimap coordinates. I believe you have the drawing coordinates of the minimap stored in x and y right? Only thing left is checking if the enemy pos lies further than those x and y coordinates. You can expand your if statement like this:

    if 
    	enemyDrawX >= x and
    	enemyDrawX < self.miniMapSize.x and 
    	enemyDrawY < self.miniMapSize.y and
    	enemyDrawY >= y and
    	then

    I would also recommend renaming the variables 'x' and 'y' to something more clear, because there are a lot of variables in this script that do somehting with x and y. After a while you will have no idea what those x and y are referring to. Something like: Vec2 miniMapDrawPos(x, y), but that is up to you.

  14. Well done. Some feedback:

    • The calculation for the draw width is now taking place within the loop. With 10 enemies you would be doing that calculation 20 times. Instead calculate it once before the loop and store it in a variable. This makes your drawing code also easier to read. You will not notice an actual difference in performance but it is good practice to do so.
    local miniMapEnemySize = Vec2(self.miniMapSize.x/25,self.miniMapSize.x/25)
    • The same thing can be done for calculating the enemy pos.
    --these lines: 
    (self.radar / 2 / self.radar * self.miniMapSize.y)
    (self.radar / 2 / self.radar * self.miniMapSize.x)
    
    -- Can be shortened and stored in a variable before the loop:
    local radarHalf = Vec2(self.miniMapSize.x / 2, self.miniMapSize.y / 2)
    
    --and in the loop:
    local enemyDrawX = (enemy.x - pos.x) + radarHalf.x
    local enemyDrawY = (enemy.y - pos.y) + radarHalf.y

     

    As for your zoom in scaling. The radar variable, should adjust to the zoom level. Your radar has a start value of 60 and your zoom is 0.6. So when you in (zoomInc is 0.5), then you need to decrease the radar value. If you would zoom out, the radar value needs to increase. Note that this should also affect the minimapSphere where you perform the GetAABB() on.

     

  15. All answers are found scattered throughout the company blogs.

    1. Josh said in his blog that it would be available as a subscription as well as a single purchase. 
    2. not sure. I know Josh is looking for other options because Steam was changing their policies.
    3. I don't think so. There might be a special license that includes full source but I doubt that would be cheap. It was mentioned that the editor was going to be opensource, but that is just speculation.
    4. No royalties
    5. No, apart from the blogs.
  16. 1 hour ago, havenphillip said:

            local pos = self.enemyEntities:GetPosition()
            context:DrawRect(200+pos.x,200+pos.z,20,20,0,1)

    That is not going to work since you are using the 3d position of the player and you use that as the 2d drawing coordinates. I assume you want to draw it on your minimap right? I will do my best to explain because it is a little tricky. Luckely I have access to high quality programmer art to aid in this process.

     

    1. I am going to calculate X. Try to see if you can do it for Y.
    2. Lets say the player is at x coordinate 50
    3. The sphere has a size of  60.
    4. That means the outerleft of the sphere is at 20
    5. Enemy X is at 35.
    6. Subtract enemyX - outerLeftX = 15
    7. divide 15 by the spheresize: 15/60=0.25
    8. This 0.25 is the ratio to draw with.
    9. So if your minimap is 200 pixels width, multiply it with the ratio of 0.25 and you get 40. That is the enemyDrawX coordinate inside the map.
    10. So the first argument in DrawRect: (x +  enemyDrawX, - - ,

    enemy.jpg.2ff91d62bc1e18d34ae977c40a9dd498.jpg

     

     

    • Like 1
  17. Don't worry, that is all part of becoming a developer. But you can't give up. Slowly you will get better and better. Ans asking questions is no problem as long as you try things out yourself as well.

    As for your error: I made a mistake with cleaning the table. This line is incorrect:

    self.enemyEntities = nil

    After its first update the table is currently set to nil. And the loop no longer functions because the table is nil. That is also what the error is saying

    So instead of setting it to nil we have to empty every enemy reference that is in there. Try something like this:

    for k,v in pairs (self.enemyEntities) do
        self.enemyEntities[k] = nil
    end

     

  18. Had a look at your script.

    • It looks like you want to fill in the enemy characters by hand? 
      • Script.enemyEntities ={}
        Script.enemyEntities[0] = "Prefabs/Characters/German Zombie 1.pfb" --path
        Script.enemyEntities[1] = "Prefabs/Characters/Gasmask Zombie.pfb" --path
        Script.enemyEntities[2] = "Prefabs/Characters/Helmet Zombie.pfb" --path
        Script.enemyEntities[3] = "Prefabs/Characters/Officer Zombie.pfb" --path
        Script.enemyEntities[4] = "Prefabs/Characters/Drag Zombie.pfb" --path
        Script.enemyEntities[5] = "Prefabs/Characters/German Zombie 10.pfb" --path
        Script.enemyEntities[6] = "Prefabs/Characters/Officer Zombie 9.pfb" --path
        Script.enemyEntities[7] = "Prefabs/Characters/Pilot Zombie.pfb" --path

        There is no need to do that since the callback function will fill up the table. Every seconds or so, it will refresh this table with the enemies that are in vicinity.

    • The enemies tables is part of the script and can be accesses using 'self.enemyEntities' when in the PostRender function

    • At the bottom of your post render you can start drawing a rectangle per enemy entity. Give it a shot. If you are really stuck I can help out.

    	for key, value in pairs(self.enemyEntities) do
    		--calculate the position to drawcolor
    		context:DrawRect()
    	end

     

×
×
  • Create New...