Page 3 of 17 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 165
  1. #21
    Join Date
    Oct 2009
    Location
    The In Between. US
    Posts
    2,030
    Quote Originally Posted by mattcscz View Post
    u've probally been asked or stated this elsewhere but what language are you using in these projects?
    everything so far is in C# so I would assume this is as well
    elevating to new levels of knowledge (that's the plan at least )

  2. #22
    Join Date
    Sep 2008
    Location
    Salisbury, UK
    Posts
    2,812
    Quote Originally Posted by mattcscz View Post
    u've probally been asked or stated this elsewhere but what language are you using in these projects?
    c#..........

    I found
    my current avatar on google, so props to THIS GUY who created the original...

  3. #23
    Join Date
    Dec 2007
    Location
    Austin, Texas
    Posts
    499
    Quote Originally Posted by chronos78 View Post
    I'm wouldn't be so sure about that. But don't quote me on that just yet. It is true that you don't have access to low level OpenGL calls in the free version. Luckily I'm not using them. What I'm using instead is the Mesh Object provided by the Unity API and hand assigning the vertices, UVs, and triangles. No low level access required. So I'm pretty sure that the only thing I'm using that won't be available to everyone is real time shadows. Though I'll check later today on my other machine if standard can run this project and let you guys know for sure. And if not we will be covering that 1st way I did the project as well just not in a whole lot of juicy detail as it has a very limit ability to draw a whole lot of blocks.
    That is REALLY good news! I thought the only way you could generate meshes in Unity was with the OpenGL stuff!!!!

    This makes this project even better!

    I hope it does run in Unity Free!

  4. #24
    Join Date
    Dec 2002
    Location
    Virginia Beach, VA
    Posts
    861
    For all those who were concerned that you wouldn't be able to follow along with this series if you didn't have Pro or the Pro Trial be at ease. I've just verified definitively that the project will run on the free version. I expected it would but it needed to be verified just to be safe. As with all of our other Unity series we've tried our best to ensure there is value in the training even if you do not have the pro version. When those rare occurrences do occur that you have to have the Pro version we let you know and suggest possible compromises or work-a-rounds.

    Oh and by the way this project is coded in C# of course.

  5. #25
    Join Date
    May 2008
    Posts
    542
    Quote Originally Posted by chronos78 View Post
    Yeah about that infinite dynamically generated terrain. Well you see that one still got me stumped. Still having all kinds of problems with shifting things around in the 3d array and regenerating the meshes fast enough so that you don't notice or more importantly so stuff doesn't shift across frame calls so a gap opens in the ground and you fall into the abyss. Its not pretty. Spent the better part of the day yesterday and a good part of it today and still don't have and acceptable solution for that problem. Though the terrain generation code is ready to support it the moment I can get the array and mesh shifting working.

    Oh and did I mention the problem of figuring out what block your selecting on when things start moving around. Not fun considering that there are 512 blocks wedged into a single mesh. You have to figure out which triangle face you've hit, figure out its midpoint on the edge the joins it with the other face, use that to figure out where the center of the block would be relative to the mesh, translate that into world space, which then needs to transformed into chunk space which then needs to be transformed to the 3d array coordinates that hold the whole thing. Works fine till everything starts offsetting. Let's just say it gets complicated.



    Update:
    ........................

    Thought about it and I decided I couldn't call it a night with the last thing being me gripping about how incredibly hard some of this stuff is to figure out.

    Play time. It is a game after all.

    *SNIP*

    Admittedly it's the most impressive structure ever built in a block placing game. Though it does point out that you can if fact actually build things in the prototype. You may have also notice I was messing around with the terrain system so that it now will place some different texture based of of elevation in addition to the noise filter. Breaks up all that green quite nicely. Think tomorrow I might put snow on top of the mountains before I give trees a go.
    Doesn't raycast have stuff to easily figure out which triangle you've hit and what the barycentric coordinates are of the triangle?
    Hello everyone and welcome to another 3DBuzz VTM, and tonight we'll be programming in Brain****!

  6. #26
    Join Date
    Dec 2002
    Location
    Virginia Beach, VA
    Posts
    861
    Quote Originally Posted by Raziaar View Post
    Doesn't raycast have stuff to easily figure out which triangle you've hit and what the barycentric coordinates are of the triangle?
    It does. But then you have to translate those coordinates into worlds space, no biggie there. Then you need to figure out which of the 3 sides is the longest cause that will be the side that adjoins the second triangle that makes up that particular face. That is needed so you can determine the midpoint of that edge which will be the center of that face. Then you need to take the inverse of the normal return by the ray that hit it, offset that by 0.5 units so you can get the center of that particular block. Remember there are no blocks in this game. It only looks like it. In reality there are just chunks of polygons that happen to resemble a bunch of blocks. So we have to calculate where that block would be if it actually existed. Now once that is known you can ask the world object which of the many chuncks is the one that holds that particular block. Then once you have the reference to the chunk it can tell you where in the Block array to find the object that describes that block. Works great until the chunks and blocks start moving around in the world.

    That's where I'm having issues sorting out where things are fast enough that the system doesn't lag a frame or three and open a hole in the world. it would be easier if everything could keep lists to the things that it needs to keep track of, but with this many blocks that is not possible since it will exceed what Unity is capable of handling an it start crashing and throwing up Garbage Collection errors. So the world has to be expressed in the simplest possible manner with no redundancy if at all possible.

    It's funny really I've manage to optimize this system so much that the biggest slow down according the profiler wasn't the code that built all the blocks but the first person control that ships with Unity. So I rewrote that to be something much smaller and lightweight. Now my biggest problem is memory. Any way you look at it Unity isn't designed to handle hundreds of thousands of things loaded into memory at once.

    Now once I reboot my computer I'll grab a screen shot showing of all the block type that are currently available in the game.

  7. #27
    Join Date
    May 2008
    Posts
    542
    The more I read you talk about it and all the challenges you've encountered and overcome, the more excited I get about watching the videos!

    Really though, I think I'm just itching for anything Unity related from 3D Buzz.
    Hello everyone and welcome to another 3DBuzz VTM, and tonight we'll be programming in Brain****!

  8. #28
    Join Date
    Oct 2009
    Location
    Scotland
    Posts
    263
    Quote Originally Posted by Raziaar View Post
    The more I read you talk about it and all the challenges you've encountered and overcome, the more excited I get about watching the videos!
    So I'm not the only one then :P
    A wise man once said to me, "life is hard, but it's harder if you're stupid" - Duthos

  9. #29
    Join Date
    Jun 2003
    Location
    Beiseker, Alberta, Canada
    Posts
    2,611
    This is looking very cool Lee! I am looking forward to getting lost in that world working on it!
    For me, happiness is learning new things.

  10. #30
    Join Date
    Dec 2002
    Location
    Virginia Beach, VA
    Posts
    861
    First off I promised everyone a screenshot after I rebooted my PC. That started off a whole chain of events but first that screenshot.


    As you can see there are currently 41 differ types of blocks that the player can use to create whatever they want. There are a couple of others but those are reserved for special use. (i.e. grass, snow, trees and water)

    As to the chain of events that had me ready to jump from the nearest bridge. Well... The reason I needed to reboot my PC was that the prototype started crashing every single time I tried to run it with no changes to the code base. The only change was adding more textures to the atlas. Which I thought was really odd. Restarted Unity several times after repeated memory crashes decide to reboot. After the reboot same thing could not get the game to run as it had. So I started dialing back the size of the world to reduce the overall block count. That did the trick and was able to get the game running again.

    This made me very unhappy. I had spent an awful lot of time and effort to get the game up to running with roughly 900k block (887,808 to be exact) and I had to bring it all the way back down to 520k blocks to get it to run. And here I was think I might take the night off maybe play a game or two, get caught up on Chuck or the Event. But no I decided that an entire tear down and rebuild of the block system was in order.

    A couple of post back I had mention that the game in reality has no blocks they are just a couple of triangles arranged in such a way that they look like blocks. That gave me the idea of why not get rid of the blocks all together. Meaning from a class structure perspective. So that's what I did. I completely ripped out the base abstract class, the derived classes, the factory classes, all of it. It's now the meshes responsibility to figure out how it's suppose to look and what poly's need to be drawn where.

    The nice thing about this approach is that it should make my next attempt at an infinite world much easier since the chunk mesh can be created or removed with out needing to shift information in a master array. Which means that master blocks array was no longer needed and I was able to delete it. All in all it took about 7 hours to rewrite everything and get it working again. The result now looks something like this.


    You may notice that the world looks a little larger and it is and not just a little bigger. (Had to turn the fog way down otherwise you'd only be able to see half of the new landscape) There are 1,920,000 blocks in the above image and its still running at about 100fps (in the editor so about double that in stand alone). There is still a lot more work for me to sort out. The main issue is that since there isn't a master array holding all the block I'm going to need to find a much more optimized way of finding where neighboring blocks are at since they are stored as part of a different chunk and that is cause a lot of wasted parsing of list to find which chuck has which block. I've got a good idea of how I'm going to change that but it'll have to wait till tomorrow.

    Another thing is the couple memory test I've run show that this new system could probably hold another 500,000 blocks before running into memory issues again which is good to have some more head room than before. I'll test that theory once the new search is in place since the world take many time longer to build now with all the extra checks.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	blockWorld05.jpg 
Views:	732 
Size:	77.6 KB 
ID:	71088   Click image for larger version. 

Name:	blockWorld06.jpg 
Views:	745 
Size:	68.4 KB 
ID:	71089  

Page 3 of 17 FirstFirst 1234513 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •