Jump to content

mdgunn

Members
  • Posts

    626
  • Joined

  • Last visited

Posts posted by mdgunn

  1. J4Lf7wS.png

     

     

    I've been playing round with particles for some longer session in the editor recently and I am seeing them bunch up after a while of letting them run.

     

    I am using a number of emitters together, up to about 5 (as you need to if you want something a bit more convincing or interesting) but with fairly low quantities (e.g. about 10-20 each).

     

    The waterfall I was doing ended up with all the water bunching up so it looked like someone was throwing it from a bucket. If I changed the duration (even by 1) then it seems to restart the emitter, 'reseeding' it so the particles a are spread out again.

     

    I don't think it's related to multiple emitters or low particles but its more obvious in that situation. I don't think I'm doing anything special. I've seen this before but at the time I think maybe it was just an editor thing but I see it in game as well

     

    There could be a reasonable explanation for this relating to the low amount of particles but it seems you should be able to have low numbers and have a way to avoid bunching as well.

     

    Bug or known way round this?

  2. I use GetDistance to check when two characters are close and I use Point to make one face the other. Dead simple.

     

    You meant you do this?

    • store the current rotation
    • turn the source to point at the target
    • log the rotation
    • compare original rotation to rotation to target
    • turn back to original heading so everthing appears as it was for the screen refresh?

     

    If that's what you mean then that is what I ended up recently to do an enemy FOV check, though I suspected that using 'proper' math, vectors and trigonometry may be faster and potentially more useful for me to understand.

     

    I stumbled one or two articles I think but I've yet to read through it properly and get a grip of this.

     

    I suspect it will all be terribly useful for constructing a 'radar' or in-game dynamic map.

  3. If you are wanting global water (water everywhere of a SINGLE specific level) then you want the scene water as previously indicated.

     

    If you want some local water perhaps at different levels (e.g. various pools) then the cheap water may do it for you.

     

    You need to apply the material that is downloaded with the asset to a CSG brush - the primitive objects you build a level with (e.g. a cube), BUT then you need to go into the script tab for that object and set up the cheap water script that came with the material. It is the script that will animate the texture.

     

    You might want to play around with the scale of the texture or the speed that the script is animating at to get it how you want. Also I think the cheap water can use environment probes so put a probe in the room/area with the pool and build global illumination (in tools menu I think?) and I think you will get some blurred reflections. You may need to experiment a bit.

    • Upvote 1
  4. Thanks for that. I tried your script and i DO get a button though there are very many differences with current code. I don't have any background image of the map though, just back background. If I comment out the GUI stuff the view of the loaded map returns.

     

    I also retried things at home (was on my standard work desktop earlier) and the code that didn't work (at work) works a bit better at ome. I now see text and a tiny dot or square (presumably the button outline).

     

    Thanks for helping me get a bit further. I might poke around a bit more and also re-consider going back to FlowGUI for now.

  5. Having problems with my first try at getting the Leadwerks GUI code running for some menus.

     

    I got the exact code from this blog post....

     

    http://www.leadwerks.com/werkspace/blog/1/entry-1714-leadwerks-gui/

     

    and tried to run it but I get nothing. Am I missing something, did something change?

     

    I'm on the beta branch and I see no errors but I also don't see a button.

     

    I realise this is not final release but it looks like others are using it with success so any ideas what I'm doing wrong.

     

    Here is the main.lua I created from the blog post code...

     

     

    --Initialize Steamworks (optional)
    Steamworks:Initialize()
    --Set the application title
    title="$PROJECT_TITLE"
    --Create a window
    local windowstyle = window.Titlebar + window.Resizable-- + window.Hidden
    if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end
    window=Window:Create(title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle)
    --window:HideMouse()
    --Create the graphics context
    context=Context:Create(window)
    if context==nil then return end
    --Create a GUI
    local gui = GUI:Create(context)
    --Create a new widget
    local button = Widget:Create(20,20,300,50,gui:GetBase())
    --Set the widget's script to make it a button
    button:SetScript("Scripts/GUI/Button.lua")
    --Set the button text
    button:SetText("Button")
    --Create a world
    world=World:Create()
    world:SetLightQuality((System:GetProperty("lightquality","1")))
    --Load a map
    local mapfile = System:GetProperty("map","Maps/start.map")
    if Map:Load(mapfile)==false then return end
    --window:Show()
    while window:KeyDown(Key.Escape)==false do
    
        --Process events
        while EventQueue:Peek() do
    		    local event = EventQueue:Wait()
    		    if event.id == Event.WidgetAction then
    				    if event.source == button then
    						    System:Print("The button was pressed!")
    				    end
    		    end
        end
    
        --If window has been closed, end the program
        if window:Closed() then break end
    
        --Handle map change
        if changemapname~=nil then
    
    		    --Clear all entities
    		    world:Clear()
    
    		    --Load the next map
    		    Time:Pause()
    		    if Map:Load("Maps/"..changemapname..".map")==false then return end
    		    Time:Resume()
    
    		    changemapname = nil
        end	
    
        --Update the app timing
        Time:Update()
    
        --Update the world
        world:Update()
    
        --Render the world
        world:Render()
    
        --Render statistics
        context:SetBlendMode(Blend.Alpha)
        if DEBUG then
    		    context:SetColor(1,0,0,1)
    		    context:DrawText("Debug Mode",2,2)
    		    context:SetColor(1,1,1,1)
    		    context:DrawStats(2,22)
    		    context:SetBlendMode(Blend.Solid)
        else
    		    --Toggle statistics on and off
    		    if (window:KeyHit(Key.F11)) then showstats = not showstats end
    		    if showstats then
    				    context:SetColor(1,1,1,1)
    				    context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2)
    		    end
        end
    
        --Refresh the screen
        context:Sync(true)
    
    end
    

  6. I have something transparent. Z-sort seemed to be the key (thought I'd already tried that).

     

    Seems difficult to get something that is only slightly transparent. Maybe this is the way this transparency works, or are you supposed to modify the shader or pass values into it?

  7. Thank for the replies.

     

    I am thinking that in developing a model I'm going to be refining and re-importing it a number of times. Re-import unfortunately seems to wipe everything you've set up for the model (normal map correction, animation, scale etc.) The text file should help me quickly get the animations set back up at least.

     

    Kinda wish that if you're asking to RE-import something it at least gave you the option of re-applying some of the work you did last time and almost certainly don't want to repeat every time. Guess wiping it out is simple and clean.

     

    Thanks!

  8. In the model viewer there is an option to import an animation. I think if you have the right format of text file then it can construct the multiple animations from a single track if you tell it which frames to pull out.

     

    I can't find the format for this anywhere. Can anyone supply a link to this information, or the information itself for the format of the text file?

  9. I have some simple flying AI enemies that close distance to a player and I've started out just using simple distance checks, turns and moves as I thought that using standard character controller monster AI would not work for flying enemies.

     

    Is it right that character controller is not suitable for flying enemies,or should it work if set up or 'faked' right (e.g. some pivot to act as a 'ground foot' or something - fro me it may not be suitable as my enemies descend from high and should pass over obstacles they are currently above)? I'm thinking the character controller is designed for enemies that touch the ground in order to make use of the navigation mesh?

     

    Anyone got any feedback on how they went about flying enemies?

  10. It would be good if there was a delay before it flashed I think......then you could have a long time between short flashes, acting as a sort of visual hint rather than it seeming to be a continuously pulsing object (which may be jarring in a more realistic game).

     

    Also I'd move the magic numbers (0.25 and 0.75) to the top and comment them and possibly expose them. It could be handy if the object went 50% brighter and 50% darker say.

     

    I actually had a go at modifying it to do all this but got a bit bogged down and didn't complete it in the end. If I do I'll post it.

    • Upvote 1
  11. lwnov16challenge_screen1.png

     

    Here you go. Wasn't really sure how to best package it all up. Put what I could off in a separate addons directory though it relies on parts of FPS hud materials and sounds.

     

    Uploaded an EXE build package: https://dl.dropboxusercontent.com/u/67692508/leadwerks/leadwerks_nov_16_challenge/lw_nov_16_jetpack_challenge_exe.zip

    and the whole project: https://dl.dropboxusercontent.com/u/67692508/leadwerks/leadwerks_nov_16_challenge/lw_nov_16_jetpack_challenge_project.zip

    Main script is MDG_JP_FPSPlayer.lua

     

    Main desktop has some problems so had to do some final bits on my laptop intel graphics which is often a bit weird. You may get massive particles for the jetpack smoke.

     

    Enjoyed the challenge I there is a good chance I'll base my Christmas game on the work done here so thanks for setting up the challenge.

    • Upvote 3
  12. A pure VS2015 template solution is acknowledged as being on the road-map of tasks.

     

    Hopefully Josh will see there is another new user looking for this feature and evaluate this in light of existing priorities. I'm fairly sure he sees most posts in the forums here, or you could always PM him.

  13. I think it's a good idea. May be best if the theme is quite general so that people can find a suitable solution that they are capable of coding and also to come up with some imaginative and varied items. This way there may be several workshop worthy items that are different, rather than just ending up with trying to judge the best in a narrow field . 'Best' may be hard to judge.

     

    It would be good that people aim to produce a good quality item for the workshop and this is born in mind by the participants. However at the same time producing anything of any quality by anyone is also better than nothing and much can be learnt by the creator and also others involved just by participating.

     

    Perhaps some sort of review at the end as Josh does might be good to point out good aspects of different items (thus there doesn't have to be a best). Or the submitter is encouraged to say a line or 2 on submission and these can be used as the text in some sort of summary forum post so forum searches have some change of picking up these items.

    • Upvote 1
  14. I understand Josh sees a need for better learning material too and the plan was to have more templates (and probably of a more in depth nature) at some point in the future. I don't believe there is time scale on this but I think it has been considered high priority by him in the past.

     

    This would probably significantly close the gap that you (and many others) are experiencing. I hope there is some progress or announcement on this soon.

  15. Thirsty Panther's suggestions are good ones....

     

    I'd also suggest a few other things:

    1. keeping the thing you are trying to solve very simple and isolated. For example, create a test project where you experiment and build your knowledge, create a blank map for your specific problem of the time, solve that problem with cubes or whatever in the simplest way possible.
    2. Consider creating your own project template where you copy in your own own scripts you've built up over time. Just copy the blank project in steam to a new location and give it a new name. Copy in various starting assets from FPS template. E.g. sounds, hud materials etc. So the FPS controller works (its needs various sounds etc). I then tend to create a sub-folder in the scripts folder with my initials on and put scripts in there so its VERY obvious where my own scripts are.
    3. The example scripts (particularly the FPS controller and associated scripts - i.e. projectiles etc) are worth studying and tweaking.
    4. The online help system has some useful simplified examples which are worth checking out and tweaking to build understanding.
    5. Work shop items have some useful scripts with them. Beware though some may not be best practice (e.g. may process something when they should be doing a check and avoiding running code) but they often solve a focused problem. E.g. camera dolly, smoke mine, multi-level elevator etc.
    6. I almost always start from an existing script. E.g. the switch one where some of the basics are in place that are hard to remember (e.g. syntax for script parameters, exposing a function to be called by the flow graph - if you use it).
    7. System:Print is your friend (but your enemy if running in release code). If you're not sure what's going on System:Print the value and look in the console output. Long term you want a better strategy but for understanding problems it is quick and easy to put in place (and comment out).

     

    In general lua is fairly simple at the level you will 99% of the time be using. I don't think there is too much you need to know.

    Tables are one of the key features that make it a bit different to some other languages but I would not worry about knowing everything about them.

     

    The important thing is that they are a container which can hold values, other tables or functions. Because you can have these 3 things in there this gives you a simple mechanism to construct a sort of 'object' where you can store values in slots, create lists of items in sub-tables and work on those values and lists with functions.

     

    I think the confusion comes in the way the code needs to be written to talk to these things (e..g self.whatever Script:whatever) it's a bit odd but try to get through it. Leadwerks also has conventions for how it talk to lua (e.g. defining parameters and exposing functions to flow graph). These are not really LUA, just how leadwerks uses lua. Studying existing scripts is the best way to get comfortable with the conventions.

     

    Suggest your focus on some things (in isolated test project) like:

    - System:Print

    - types such as booleans (checking a boolean condition before running chunks of code is a good practice).

    - loops - useful but avoid doing many loops if you can (e.g. keep a reference to an object or thing so you can operate on it straight away) and if you have to loop exit out as soon as you have the answer see LUA loops.

    - Knowing how to loop through a table (check out key/values/pairs)

    - some built in table functions

    - manipulate strings

    - casting an object - So if you have a list of items you might need to cast it to the right thing so your code can access it properly (e.g. an entity etc.)

    - Understand that all objects are global unless you declare local, so most of the time you SHOULD declare local in your objects. Global is usually bad as if something else creates something with the same name you have issues. It can be useful in games, where you work along and understand ALL the code, to have some limited globals though as on small amounts of code it can be a quick and easy solution.

     

    OK this has got way bigger than I had thought it might. Better cut it short here.

     

    Suggest that it might be good if you generate a bullet point list of all the things that you can think of regardless of whether they seem silly or not. It's probably impractical to think that you'll get answers to them all here but I'm kind of interested in what you might list.

     

    I'd like to think I might do a tutorial or something to help you out, but it would probably take some time to do and I'm not sure I'll get round to it. If I do your list might be useful.

     

    Personally I think you have a very valid point about there being a bit of a gap in how you actually sensibly progress on on non-trivial project. Anyway maybe if you do a list and maybe high-light a couple of things that might help most then we may be able to get you on the right track.

     

    If you read all that and got this far....you have too much time (me too? - really need to get back to work)....you should be learning LUA in Leadwerks! :)

  16. I think you need one per room because the reflections that you see bouncing 'back' of the probe box are what would have hit that box from the central location of the box (er...I think). So if you're in a room but the box doesn't match the room (I usually have the box just penetrating the walls etc - don't know if that is optimal) you're probalby going to see something which doesn't match up with what you should see reflected there. I think if you have an open area you can probably have multiple probes and in that case it might work to have a large encompassing one and maybe that sort of takes over when the if you aren't currently in a more localised one but I've not really checked that out so I'm just guessing.

  17. A few suggestions:

    1) Take a simpler model (e.g. textured cube or something quick to generate). Make sure you're happy that the basic process of import does usually work. Usually you do have to do calculate normals.

    2) Make sure the model in blender looks OK turn on the normal direction display. It looks most like an issue with the source model given just a few triangles seem out.

    3) Post a link to your blender file (textures probably not required if it's a normal issue) so others can try.

×
×
  • Create New...