• What Are You Working On? Mesh Edition - August 2012
    650 replies, posted
[QUOTE=Map in a box;37460731]Ask the programming WAYWO, we won't hurt you.[/QUOTE] I thought it was more relevant here since I get the feeling most people there don't play GMod anymore but thanks, I'll post there now :)!
[quote][img]http://filesmelt.com/dl/gungen4.PNG[/img][/quote] I know I've posted a lot of pictures of this so far, but I thought this one deserved it. The sad thing is that when I get the actual generation done I can't imagine it making something this magnificent.
Appearantly FractionLeftSolid is broken as shit, I had to do some ghetto thickness measuring with util.PointContents, it works decently though It doesnt work on models though (fractionleftsolid did neither), I need to figure out a decent method to measure the thickness of models across a line [editline]30th August 2012[/editline] Also [vid]https://dl.dropbox.com/u/4838268/gm_flatgrass%202012-8-30%2010-00-54.webm[/vid]
[QUOTE=MadParakeet;37463491]I know I've posted a lot of pictures of this so far, but I thought this one deserved it. The sad thing is that when I get the actual generation done I can't imagine it making something this magnificent.[/QUOTE] That system of yours is just freaking amazing :D Would be awesome if you would allow me to implement it in my RPG when you're done.
These LUA tables are making me insane.. I wrote a little utility function to make a table indexed from 0 for me, but it uses varargs and other terrible hacks. [lua] function array( ... ) local content = { ... } local array = {} for index, val in ipairs( content ) do array[index -1] = val end return array end [/lua] What do you think, shall I get used to that indexing is from 1 ([IMG]http://www.facepunch.com/fp/ratings/tick.png[/IMG]), or I should stick to hacks like this ([IMG]http://www.facepunch.com/fp/ratings/cross.png[/IMG]) ? [editline]30th August 2012[/editline] Sorry for spamming waywo with my questions, but I wanted to ask more experienced developers :smile:
Instead of that content local you can just do ipairs{...}
[QUOTE=MDave;37465954]These LUA tables are making me insane.. I wrote a little utility function to make a table indexed from 0 for me, but it uses varargs and other terrible hacks. [lua] function array( ... ) local content = { ... } local array = {} for index, val in ipairs( content ) do array[index -1] = val end return array end [/lua] What do you think, shall I get used to that indexing is from 1 ([IMG]http://www.facepunch.com/fp/ratings/tick.png[/IMG]), or I should stick to hacks like this ([IMG]http://www.facepunch.com/fp/ratings/cross.png[/IMG]) ? [editline]30th August 2012[/editline] Sorry for spamming waywo with my questions, but I wanted to ask more experienced developers :smile:[/QUOTE] Just get used to indexes starting at 1. I mean seriously it's one index position and if you include this code to shift the table so it works for you it's going to confuse everyone else.
[QUOTE=MDave;37465954]These LUA tables are making me insane.. I wrote a little utility function to make a table indexed from 0 for me, but it uses varargs and other terrible hacks. [lua] function array( ... ) local content = { ... } local array = {} for index, val in ipairs( content ) do array[index -1] = val end return array end [/lua] What do you think, shall I get used to that indexing is from 1 ([IMG]http://www.facepunch.com/fp/ratings/tick.png[/IMG]), or I should stick to hacks like this ([IMG]http://www.facepunch.com/fp/ratings/cross.png[/IMG]) ? [editline]30th August 2012[/editline] Sorry for spamming waywo with my questions, but I wanted to ask more experienced developers :smile:[/QUOTE] ehhh [code]local function array( sometable ) sometable[0] = table.remove( sometable, 1 ) end[/code] fix'd EDIT: But I'm definitely giving you a [IMG]http://www.facepunch.com/fp/ratings/tick.png[/IMG]
[img]http://puu.sh/10kDh[/img] More metal. Sexy hexagons. Better tooltips. A templating system. The main tooltip template looks like this: [img]http://puu.sh/10kEg[/img] Every item type can declare it's own tooltip templates. Numbers are spacers. Strings are templates (will be replaced when processing). Tables are actual data. They are processed when the tooltip is shown. The tooltips are turning out to be harder than the inventory itself. And I've barely scratched the surface of what I plan to do with them. [editline]wohoo[/editline] More goodness: [img]http://puu.sh/10lkB[/img]
[QUOTE=vercas;37467560][img]http://puu.sh/10kDh[/img] More metal. Sexy hexagons. Better tooltips. A templating system. The main tooltip template looks like this: [img]http://puu.sh/10kEg[/img] Every item type can declare it's own tooltip templates. Numbers are spacers. Strings are templates (will be replaced when processing). Tables are actual data. They are processed when the tooltip is shown. The tooltips are turning out to be harder than the inventory itself. And I've barely scratched the surface of what I plan to do with them.[/QUOTE] I love that style of 1px border with 1px margin.
[QUOTE=vexx21322;37467752]I love that style of 1px border with 1px margin.[/QUOTE] I'm a coder, not an artist. :tinfoil: And yeah, I know that style has been recycled again and again for years. [editline]...[/editline] Which is better? This: [img]http://puu.sh/10ltv[/img] Or the other one, in the edit above?
[QUOTE=vercas;37468050]I'm a coder, not an artist. :tinfoil: And yeah, I know that style has been recycled again and again for years. [editline]...[/editline] Which is better? This: [img]http://puu.sh/10ltv[/img] Or the other one, in the edit above?[/QUOTE] I was actually being serious, I love that style.
[QUOTE=TGiFallen;37466103]Just get used to indexes starting at 1. I mean seriously it's one index position and if you include this code to shift the table so it works for you it's going to confuse everyone else.[/QUOTE] Whm, you got a point there. Also thanks for the feedback. I rewrote the maze generator code, and also made a mesh generator for it: [IMG]https://dl.dropbox.com/u/7659139/Facepunch/gm_maze_wip2.jpg[/IMG] I am getting some visual issues tought, like the ligting is not perfect, and also a lot of "Z fight" on the corners. It is now a big mesh without connected verticles, so there could be 2 overlapping walls on the corners, so there is work left, but so far so good. Altought, I am pretty afraid to initialize a pysics mesh from that mess ([sp]wonder why[/sp] :v:), but it would be required, as I would like to use it as a map for a gamemode.
[QUOTE=MDave;37468932] Altought, I am pretty afraid to initialize a pysics mesh from that mess ([sp]wonder why[/sp] :v:), but it would be required, as I would like to use it as a map for a gamemode.[/QUOTE] Why are you afraid? ;) It should be fine, give it a try.
[QUOTE=MDave;37468932]Whm, you got a point there. Also thanks for the feedback. I rewrote the maze generator code, and also made a mesh generator for it: [IMG]https://dl.dropbox.com/u/7659139/Facepunch/gm_maze_wip2.jpg[/IMG] I am getting some visual issues tought, like the ligting is not perfect, and also a lot of "Z fight" on the corners. It is now a big mesh without connected verticles, so there could be 2 overlapping walls on the corners, so there is work left, but so far so good. Altought, I am pretty afraid to initialize a pysics mesh from that mess ([sp]wonder why[/sp] :v:), but it would be required, as I would like to use it as a map for a gamemode.[/QUOTE] How do you actually generate mazes? I tried to make one like a year ago, but it didn't work that well out.. Are you planning to release the maze generator code? I'd love to take a look at it.
[QUOTE=ollie;37470100]How do you actually generate mazes? I tried to make one like a year ago, but it didn't work that well out.. Are you planning to release the maze generator code? I'd love to take a look at it.[/QUOTE] There was a toybox entity that generated mazes.
[QUOTE=Spencer Sharkey;37470136]There was a toybox entity that generated mazes.[/QUOTE] Actually, I wrote my own implementation based on a [URL="http://en.wikipedia.org/wiki/Maze_generation_algorithm"]wikipedia article[/URL]. [QUOTE=ollie;37470100]How do you actually generate mazes? I tried to make one like a year ago, but it didn't work that well out.. Are you planning to release the maze generator code? I'd love to take a look at it.[/QUOTE] Sure! It is not a big project, or something I want to sell. Luckily I just finished separating the generator code from the other mess, so here you go: h[URL="https://gist.github.com/3535839"]ttps://gist.github.com/3535839[/URL] It contains a few glua only operators, but it can be fixed by a simple search and replace. ( As you see, the gist hilights them with red ) I would be happy to see if someone used it actually for something bigger. [editline]30th August 2012[/editline] Added the print method I used to debug to the gist too
[QUOTE=MDave;37470316]Actually, I wrote my own implementation based on a [URL="http://en.wikipedia.org/wiki/Maze_generation_algorithm"]wikipedia article[/URL]. Sure! It is not a big project, or something I want to sell. Luckily I just finished separating the generator code from the other mess, so here you go: h[URL="https://gist.github.com/3535839"]ttps://gist.github.com/3535839[/URL] It contains a few glua only operators, but it can be fixed by a simple search and replace. ( As you see, the gist hilights them with red ) I would be happy to see if someone used it actually for something bigger.[SUB] ( Just please mention my name in the source )[/SUB] [editline]30th August 2012[/editline] Added the print method I used to debug to the gist too[/QUOTE] Oh that wikipedia article is neat, thanks for that!
Would anyone use a system which converts the whole of GLua to a class-like system? Something like this: [code]module "MyAddon" using System using System.Addon namespace MyAddon class Addon (BaseAddon) function Addon:OnActivate() print( "My addon was activated!" ) end function Addon:OnDeactivate() end[/code] There would be a tonne of useful classes to use in the standard library and would wrap GLua things, you could do things like have a server run multiple gamemodes at once or switch between gamemodes at will just by having a bunch of gamemodes inherit off the BaseGamemode class and stuff like that.
[QUOTE=thomasfn;37472339]Would anyone use a system which converts the whole of GLua to a class-like system? Something like this: [code]module "MyAddon" using System using System.Addon namespace MyAddon class Addon (BaseAddon) function Addon:OnActivate() print( "My addon was activated!" ) end function Addon:OnDeactivate() end[/code] There would be a tonne of useful classes to use in the standard library and would wrap GLua things, you could do things like have a server run multiple gamemodes at once or switch between gamemodes at will just by having a bunch of gamemodes inherit off the BaseGamemode class and stuff like that.[/QUOTE] That's actually a great idea, considering that's all perfectly valid syntax too. Neat! [editline]30th August 2012[/editline] Oshit better start preparing some highlights for September's thread. *sigh* The summer went by so fast </3
[QUOTE=thomasfn;37472339]Would anyone use a system which converts the whole of GLua to a class-like system? Something like this: [code]module "MyAddon" using System using System.Addon namespace MyAddon class Addon (BaseAddon) function Addon:OnActivate() print( "My addon was activated!" ) end function Addon:OnDeactivate() end[/code] There would be a tonne of useful classes to use in the standard library and would wrap GLua things, you could do things like have a server run multiple gamemodes at once or switch between gamemodes at will just by having a bunch of gamemodes inherit off the BaseGamemode class and stuff like that.[/QUOTE] I'll gladly help you with that
[QUOTE=MDave;37470316]Actually, I wrote my own implementation based on a [URL="http://en.wikipedia.org/wiki/Maze_generation_algorithm"]wikipedia article[/URL].[/QUOTE] I found the source for an interesting 3D maze on that wiki article, maybe when you've got the maze physics working you could [url=http://en.wikipedia.org/wiki/File:Prim_Maze_3D.svg]implement a hard mode[/url] :v: [QUOTE=thomasfn;37472339]Would anyone use a system which converts the whole of GLua to a class-like system? Something like this: [code]module "MyAddon" using System using System.Addon namespace MyAddon class Addon (BaseAddon) function Addon:OnActivate() print( "My addon was activated!" ) end function Addon:OnDeactivate() end[/code] There would be a tonne of useful classes to use in the standard library and would wrap GLua things, you could do things like have a server run multiple gamemodes at once or switch between gamemodes at will just by having a bunch of gamemodes inherit off the BaseGamemode class and stuff like that.[/QUOTE] Yes please! I can't really code without OO so I'd love a proper OOP framework :)
I cannot wait, 2 days until a new thread.
[code]local function TestFile() gear_module "MyAddon" using( System ) namespace( Test ) class "Hello" function Hello:Hello() print( "Hello world" ) end function Hello:TestFunction( param ) print( "param = " .. tostring( param ) ) end class "Hello2" inherit "Hello" function Hello2:Hello2() print( "Hello world again" ) end function Hello2:TestFunction( param ) self:CallBase("TestFunction", param) print( "inheritance ftw" ) end end TestFile() local function SomethingElse() using( Test ) local o = new( Test.Hello2 ) o:TestFunction( 10 ) print( o:ToString() ) end SomethingElse()[/code] Output: [code]Hello world Hello world again param = 10 inheritance ftw Test.Hello2 (table: 00638DC0)[/code] I used functions to simulate code being run in separate files. Unfortunately Lua only accepts bracketless function calls if the 1st (and only) parameter is a literal, so we can't have things like "using System" without brackets. The using and namespace functions are quite happy just accepting strings though, so you could do the following instead if you wanted. Also that using system isn't actually needed in the first function as I don't use anything from that namespace. I thought I'd call the system "gear" because it sounds cool and is somewhat relevant, unfortunately I couldn't come up with an acronym for it. [code]using "System" namespace "Test"[/code] Tomorrow I'll work on the standard library and wrapping GLua functionality up into classes.
Awe shit, this is gunna be cool.
Just posted the gamemode Sunabouzu and I were working on for like 4 days. [media]http://www.youtube.com/watch?v=ZGSEf739tLg&feature=player_embedded[/media] [url]http://www.facepunch.com/showthread.php?t=1209089[/url]
[QUOTE=FoohyAB;37477611]Just posted the gamemode Sunabouzu and I were working on for like 4 days. [URL]http://www.facepunch.com/showthread.php?t=1209089[/URL][/QUOTE] [IMG]http://puu.sh/10A3t[/IMG] You are always making badass shit.
[IMG]http://puu.sh/10A5E.png[/IMG]
[img]http://puu.sh/10Be6[/img] Shit's getting serious. [img]http://puu.sh/10Bf6[/img] [img]http://puu.sh/10BeJ[/img] I need to take this templating system a lot further. It seems to make my life a lot easier.
[QUOTE=Spencer Sharkey;37469963]It should be fine, give it a try.[/QUOTE] Physics from mesh, harder than I tought. I generated a mesh, and I can draw it perfectly with IMesh:Draw(), but... First I found 3 functions to init physics from a mesh Entity:PhysicsFromMesh Entity:PhysicsInitConvex Entity:PhysicsInitMultiConvex Of course, all undocumented. :v: At the first attempts, nothing happened, not even an error or something, just my entity was missing physics. When I tried the Entity:PhysicsFromMesh, gmod13 actually crashed, and before completely stopping, it tried to connect en external IP adress. :tinfoil:
Sorry, you need to Log In to post a reply to this thread.