• What are you working on? v19
    6,590 replies, posted
My tile placement logic finally works. [IMG]http://filesmelt.com/dl/working1.PNG[/IMG] It takes an array of booleans and arranges tile objects onto a grid, proportional to the number of booleans.
[QUOTE=mlbfan560;31500785]My tile placement logic finally works. [IMG]http://filesmelt.com/dl/working1.PNG[/IMG] It takes an array of booleans and arranges tile objects onto a grid, proportional to the number of booleans.[/QUOTE] Wouldn't an array of ints be a better idea? That way you can have more than two tile types.
[QUOTE=bobthe2lol;31501323]Wouldn't an array of ints be a better idea? That way you can have more than two tile types.[/QUOTE] My thought exactly.
[QUOTE=bobthe2lol;31501323]Wouldn't an array of ints be a better idea? That way you can have more than two tile types.[/QUOTE] That's what I was thinking as well, it was just my train of thought at the time when I was coding it. At least it's easy to change now.
[img]http://gyazo.com/f92bc7b4e3565cbcf8fd5f2a4b4916a9.png[/img] I feel like making a Pong clone now
Here is a video showing the layer system I was talking about some days ago. [media]http://www.youtube.com/watch?v=l1cork4h6H0[/media]
[QUOTE=Chandler;31499584]I'm not using submit, I'm using map.[/QUOTE] This works too: [code] #!/usr/bin/env python3.2 import concurrent.futures import time class Foo: def __init__(self, salutation): self.salutation = salutation def __call__(self, subject): return "%s, %s!" % (self.salutation, subject) with concurrent.futures.ProcessPoolExecutor() as executor: for message in executor.map(Foo("Hello"), ["world", "universe"]): print(message) [/code] So does this: [code] #!/usr/bin/env python3.2 import concurrent.futures import time class Foo: def __init__(self, salutation): self.salutation = salutation def __call__(self, subject): return "%s, %s!" % (self.salutation, subject) with concurrent.futures.ProcessPoolExecutor() as executor: places = ["world", "solar system", "galaxy", "universe", "multiverse"] foo = Foo("Hello") def submitter(subject): return executor.submit(foo, subject) futures = [future for future in map(submitter, places)] for future in concurrent.futures.as_completed(futures): print(future.result()) [/code] with the quirk that concurrent.futures.as_completed() doesn't seem to like the iterable returned by map(), so I had to use a list comprehension to iterate it ahead of time and put the results into a real list. [QUOTE=Chandler;31499584]I've chosen and am sticking with .NET now.[/QUOTE] I think you may be jumping ship too early; passing an object with a __call__() to a ProcessPoolExecutor seems to work fine.
[QUOTE=Cyril;31503936]Here is a video showing the layer system I was talking about some days ago. [media]http://www.youtube.com/watch?v=l1cork4h6H0[/media][/QUOTE] Not bad, although it looks a little confusing to use... I wish I could think of something that you could add to make it a bit more intuitive
[QUOTE=Chris220;31503956]Not bad, although it looks a little confusing to use... I wish I could think of something that you could add to make it a bit more intuitive[/QUOTE] It should have a list of changeable textures on the right and you should change between layers with up and down arrow keys that's the best way I can think of
I need ideas for what to add to the planetary generation, what needs improving and what needs adding?
[QUOTE=Wyzard;31503939]This works too: [code] #!/usr/bin/env python3.2 import concurrent.futures import time class Foo: def __init__(self, salutation): self.salutation = salutation def __call__(self, subject): return "%s, %s!" % (self.salutation, subject) with concurrent.futures.ProcessPoolExecutor() as executor: for message in executor.map(Foo("Hello"), ["world", "universe"]): print(message) [/code] So does this: [code] #!/usr/bin/env python3.2 import concurrent.futures import time class Foo: def __init__(self, salutation): self.salutation = salutation def __call__(self, subject): return "%s, %s!" % (self.salutation, subject) with concurrent.futures.ProcessPoolExecutor() as executor: places = ["world", "solar system", "galaxy", "universe", "multiverse"] foo = Foo("Hello") def submitter(subject): return executor.submit(foo, subject) futures = [future for future in map(submitter, places)] for future in concurrent.futures.as_completed(futures): print(future.result()) [/code] with the quirk that concurrent.futures.as_completed() doesn't seem to like the iterable returned by map(), so I had to use a list comprehension to iterate it ahead of time and put the results into a real list. I think you may be jumping ship too early; passing an object with a __call__() to a ProcessPoolExecutor seems to work fine.[/QUOTE] Now I don't even know what the hell. :/ edit: OK. I just tried this within the area that I was having the issue, and it worked. Somehow. Thanks! :)
[QUOTE=Icedshot;31505503]I need ideas for what to add to the planetary generation, what needs improving and what needs adding?[/QUOTE] Make the land masses look more... land mass-ey [editline]3rd August 2011[/editline] By the way, does someone know how I can insert a value into a list in C# without already having something there? It seems that the array the list is based on has the right length, but the list itself has a _size property set to 0.
[QUOTE=Chris220;31503956]Not bad, although it looks a little confusing to use... I wish I could think of something that you could add to make it a bit more intuitive[/QUOTE] Maybe displaying something like this would help ? [img]http://dl.dropbox.com/u/14515180/layer2.png[/img]
[QUOTE=Chandler;31505544]Now I don't even know what the hell. :/ edit: OK. I just tried this within the area that I was having the issue, and it worked. Somehow. Thanks! :)[/QUOTE] The best way to solve problems is to go around them with hacks :v:
I'm working as an intern at a local software consulting company. It's so awesome seeing a huge gigantic project with professional build servers and bug trackers and developers and everything. Compared to the tiny projects I've been doing myself or with a few classmates seem so insignificant compared to that. Even though their developers are pretty awesome and the overall code quality is great, I found my first [url=thedailywtf.com]WTF[/url] today (after 3 days of working there). [cpp]@Test public void testSomething(){ //it obviously had a real name, I can't remember it anymore //.... try { someObject.equals(null); } catch (RuntimeException ex) { Assert.assertTrue(true); } //..... }[/cpp] When I saw it I was very confused by this obscure test case. It was already marked as a major warning by the build server because of the equals(null), but in context it made even less sense. When I looked at the equals method it made even less sense: [cpp]public void equals(Object obj){ throw new RuntimeException("Some error message"); //I can't remember the error message either }[/cpp] But the story doesn't end here. Since I found the code so amusing I told a college about it and he comes over to my PC and looks at the code for about 30 seconds and says "You know, I think I wrote that".
Did you ask him why?
[QUOTE=Dj-J3;31507972]Did you ask him why?[/QUOTE] Of course, but his explanation wasn't very clear. From what I understood he wanted the assertion to fail if equals(null) didn't throw a RuntimeException, but not only is that not the desired behavior, his code never fails at all. Usually he isn't a bad developer though and I have no idea how old that code is. He was probably shocked and surprised and wasn't sure what he thought when he wrote that either.
[QUOTE=Cyril;31503936]Here is a video showing the layer system I was talking about some days ago. [media]http://www.youtube.com/watch?v=l1cork4h6H0[/media][/QUOTE] You should do what LittleBigPlanet 2 did
[QUOTE=Robber;31507843]I'm working as an intern at a local software consulting company. It's so awesome seeing a huge gigantic project with professional build servers and bug trackers and developers and everything. Compared to the tiny projects I've been doing myself or with a few classmates seem so insignificant compared to that. Even though their developers are pretty awesome and the overall code quality is great, I found my first [url=thedailywtf.com]WTF[/url] today (after 3 days of working there). [cpp]@Test public void testSomething(){ //it obviously had a real name, I can't remember it anymore //.... try { someObject.equals(null); } catch (RuntimeException ex) { Assert.assertTrue(true); } //..... }[/cpp] When I saw it I was very confused by this obscure test case. It was already marked as a major warning by the build server because of the equals(null), but in context it made even less sense. When I looked at the equals method it made even less sense: [cpp]public void equals(Object obj){ throw new RuntimeException("Some error message"); //I can't remember the error message either }[/cpp] But the story doesn't end here. Since I found the code so amusing I told a college about it and he comes over to my PC and looks at the code for about 30 seconds and says "You know, I think I wrote that".[/QUOTE] I was programming with a friend at his house once over the weekend when the internet was down in 2007 I think. We had a ton of comments saying dumb stuff like "// This person died from an STD" when variables were set to 0 and "// This message box comes up because you were a pansy and caused an error. Don't do that!" We looked at it a couple months ago since it was on a CD marked "Weekend of Weirdness" and neither of us remembered it, and we almost died laughing :v:
Right now i am working on a simple "Keychanger" program in C++ i will come with updates anytime soon
[QUOTE=mlbfan560;31500785]My tile placement logic finally works. [IMG]http://filesmelt.com/dl/working1.PNG[/IMG] It takes an array of booleans and arranges tile objects onto a grid, proportional to the number of booleans.[/QUOTE] Nice! A good start. My game uses a world that is 7900x1200. In pixels, the world is 79000 x 12000. [img]http://i3software.org/s/SS-2011-08-03_12.20.08.png[/img] I don't want to loop through an array THAT huge, so I loop only through the visible area (plus a bit of padding). [code] public void Render(SpriteBatch batch) { SpriteManager manager = EngineConstants.Shared().spriteMananger; // This is the class I use for my sprite managment. for (int x = 0; x < 81; x++) // Visible X area (mine is 79 blocks). I add two just to make sure you dont see any of the background color while moving. { for (int y = 0; y < 62; y++) // Visible X area (mine is 60 blocks). I add two just to make sure you dont see any of the background color while moving. { int renderX = x + (xOffset / 10); // xOffset is the PIXELS moved to the right. Divide it by the size of your blocks int renderY = y + (yOffset / 10); // xOffset is the PIXELS moved to the right. Divide it by the size of your blocks if ((renderX >= 0 && renderX <= wWidth - 1) && (renderY >= 0 && renderY <= wHeight - 1)) // Make sure you're rendering within the map, as to not have an "out of bounds" exception called. { Texture2D cTexture = null; switch (World[renderX][renderY]) { case BlockType.Blank: break; case BlockType.Grass: cTexture = manager.TextureForName("Grass", true); // This method finds a sprite in a list of already loaded sprites. If it isn't yet loaded, load it, add it to the list and then return it, break; case BlockType.DarkGrass: cTexture = manager.TextureForName("DarkGrass", true); break; case BlockType.Dirt: cTexture = manager.TextureForName("Dirt", true); break; case BlockType.DarkDirt: cTexture = manager.TextureForName("DarkDirt", true); break; case BlockType.Coal: cTexture = manager.TextureForName("Coal", true); break; case BlockType.Iron: cTexture = manager.TextureForName("Iron", true); break; default: break; } if (cTexture != null) batch.Draw(cTexture, new Rectangle(renderX * 10 - xOffset, renderY * 10 - yOffset, 10, 10), Color.White); } } } } [/code]
[QUOTE=i300;31509826]snip[/QUOTE] Why don't you assign them the answer instead of multiplying two values?
[QUOTE=Dj-J3;31510179]Why don't you assign them the answer instead of multiplying two values?[/QUOTE] I imagine this makes more sense to him. It's most likely optimized away anyway.
[QUOTE=i300;31509826][code] Texture2D cTexture = null; switch (World[renderX][renderY]) { case BlockType.Blank: break; case BlockType.Grass: cTexture = manager.TextureForName("Grass", true); //blah break; case BlockType.DarkGrass: cTexture = manager.TextureForName("DarkGrass", true); break; case BlockType.Dirt: cTexture = manager.TextureForName("Dirt", true); break; case BlockType.DarkDirt: cTexture = manager.TextureForName("DarkDirt", true); break; case BlockType.Coal: cTexture = manager.TextureForName("Coal", true); break; case BlockType.Iron: cTexture = manager.TextureForName("Iron", true); break; default: break; } [/code][/QUOTE] this could become: [code] Texture2D cTexture = null; BlockType bt = World[renderX][renderY]; if(bt != BlockType.Blank) cTexture = manager.TextureForName(bt.ToString(), true); [/code]
[QUOTE=i300;31509826]Nice! A good start. My game uses a world that is 7900x1200. In pixels, the world is 79000 x 12000. [img]http://i3software.org/s/SS-2011-08-03_12.20.08.png[/img] I don't want to loop through an array THAT huge, so I loop only through the visible area (plus a bit of padding). [code] public void Render(SpriteBatch batch) { SpriteManager manager = EngineConstants.Shared().spriteMananger; // This is the class I use for my sprite managment. for (int x = 0; x < 81; x++) // Visible X area (mine is 79 blocks). I add two just to make sure you dont see any of the background color while moving. { for (int y = 0; y < 62; y++) // Visible X area (mine is 60 blocks). I add two just to make sure you dont see any of the background color while moving. { int renderX = x + (xOffset / 10); // xOffset is the PIXELS moved to the right. Divide it by the size of your blocks int renderY = y + (yOffset / 10); // xOffset is the PIXELS moved to the right. Divide it by the size of your blocks if ((renderX >= 0 && renderX <= wWidth - 1) && (renderY >= 0 && renderY <= wHeight - 1)) // Make sure you're rendering within the map, as to not have an "out of bounds" exception called. { Texture2D cTexture = null; switch (World[renderX][renderY]) { case BlockType.Blank: break; case BlockType.Grass: cTexture = manager.TextureForName("Grass", true); // This method finds a sprite in a list of already loaded sprites. If it isn't yet loaded, load it, add it to the list and then return it, break; case BlockType.DarkGrass: cTexture = manager.TextureForName("DarkGrass", true); break; case BlockType.Dirt: cTexture = manager.TextureForName("Dirt", true); break; case BlockType.DarkDirt: cTexture = manager.TextureForName("DarkDirt", true); break; case BlockType.Coal: cTexture = manager.TextureForName("Coal", true); break; case BlockType.Iron: cTexture = manager.TextureForName("Iron", true); break; default: break; } if (cTexture != null) batch.Draw(cTexture, new Rectangle(renderX * 10 - xOffset, renderY * 10 - yOffset, 10, 10), Color.White); } } } } [/code][/QUOTE] And also, you don't need to do your own texture caching. Xna's content pipeline does that for you. If you want to load a texture, it checks if it has it cached, and if not loads it, caches it, and gives it to you. Otherwise it just gives you the cached one.
[QUOTE=NovembrDobby;31510547]this could become: [code] Texture2D cTexture = null; BlockType bt = World[renderX][renderY]; if(bt != BlockType.Blank) cTexture = manager.TextureForName(bt.ToString(), true); [/code][/QUOTE] This could become [code] World[renderX][renderY].draw(); [/code]
[thumb]http://dl.dropbox.com/u/5619257/opc/fnng2.png[/thumb] So many weird bugs, at least it looks nicer where it works.
[QUOTE=NovembrDobby;31510547]this could become: [code] Texture2D cTexture = null; BlockType bt = World[renderX][renderY]; if(bt != BlockType.Blank) cTexture = manager.TextureForName(bt.ToString(), true); [/code][/QUOTE] Oh wow. Thanks! That's really awesome. [QUOTE=Map in a box;31510840]This could become [code] World[renderX][renderY].draw(); [/code] [/QUOTE] No. I don't use a class for a tile. Tiles are just an enum, if you looked at the screenshot I posted. [QUOTE=bobthe2lol;31510792]And also, you don't need to do your own texture caching. Xna's content pipeline does that for you. If you want to load a texture, it checks if it has it cached, and if not loads it, caches it, and gives it to you. Otherwise it just gives you the cached one.[/QUOTE] Oh cool. It is still helpful to have a list of the loaded textures for myself, incase I want to know which ones are loaded, and which aren't. [QUOTE=Dj-J3;31510179]Why don't you assign them the answer instead of multiplying two values?[/QUOTE] It makes it so I don't accidentally type a number that isn't divisible by 10. Does it really matter anyways?
[QUOTE=danharibo;31510946][thumb]http://dl.dropbox.com/u/5619257/opc/fnng2.png[/thumb] So many weird bugs, at least it looks nicer where it works.[/QUOTE] Are you planning to implement minecrafts bad networking protcol to connect n stuff?
I updated my game with the layer display system described above. It's way less confusing, see by yourself: [media]http://www.youtube.com/watch?v=szktNTKxh0I[/media]
Sorry, you need to Log In to post a reply to this thread.