Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411500 Posts in 69373 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 01:33:59 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsEPIC
Pages: 1 [2]
Print
Author Topic: EPIC  (Read 5525 times)
motorherp
Level 3
***



View Profile
« Reply #20 on: September 28, 2011, 02:15:43 PM »

New update  Smiley
View the original blog post here

-------------------------------------------------------------------------------------

If you’ve been reading the previous posts in the blog here you’ll know that I’ve working to improve my procedural spacebox generator for EPIC since the generation times were far too long to be useful.  Well the good news is I’m finished.  Spacebox MkII is now ready, at run-time it can generate a new random space scene in under a second, and I even managed to throw in some improvements along the way.

So how come this new version can generate scene’s so quickly when the original version took over 30 seconds per scene?  Well firstly the spacebox now relies on a store of pre-generated high quality high resolution noise textures, the generation of which is what was taking up the majority of the time in the old system.  Secondly all the run-time calculations have been shifted to a graphics shader which also had the added benefit of allowing me to tweak parameters and see the results in real time.

The high quality noise generation is still using the same fractal brownian motion method as I used previously, and in order to try and conserve my texture budget I decided to restrict myself to no more than two high resolution textures per skybox face.  In an offline process I rendered three low frequency noises with differing parameters into three channels of one texture and similarly three high frequency noises into three channels of the second texture.  This would hopefully give me enough variety to work with.  In one of the remaining channels I rendered a turbulent noise function for use by the shader to create streaks in the resultant space-dust for the impression of gaseous flow, and the last remaining channel was filled with random values for use by the shader as a random number lookup for deciding when to generate point stars and give them random brightness.

The real trick with this is how to then create a seemingly endless number of variations of the spacebox at run-time using only this limited number of pre-generated noises.  Whenever a new space scene is called for during run-time, the skybox script generates another set of noise textures on the fly for use as various blend and combination factors by the spacebox shader to mix together the pre-generated noises in differing ways to come up with new results.  Since these textures are only being used to modify calculations and not rendered directly, I could get away with generating them at much lower resolutions and using lower quality noises with only one or two octaves which are exponentially faster to generate and allows for the run-time performance I was after.  I was a bit worried that only having three of each of the high quality noises wouldn’t be enough to prevent obvious repetition in the results but it actually turned out quite nicely.

Other than that the process of creating the scenes was much the same as the previous spacebox generator except that all the processing of the mixed noise to generate the final result was also shifted to the shader program.  To keep the shader instruction count down I generated another low resolution texture at the same time as the blend maps to store the results of calculations which remained constant for the lifetime of the current scene, such as galactic plane and galactic bulge distance/falloff calculations.  Also with a spare channel in the blend map I stored the results of an additional noise function which I used to create colour blends across the space dust for added interest.  Finally I really wanted to add in the flowing streak like features often seen in space nebulae which is where the previously mentioned turbulent noise channel came in.  The turbulence noise was combined with several of the other noise functions in the shader to break up the pattern into something more natural and the result was added as a brightness boost to the generated space dust to give it the streaks.

("Right click -> view" for a better look, or alternatively take a look at the gallery in the original blog post at my website.)









One last thing worth mentioning is that not all possible combinations of the additional tweakable spacebox parameters and colours came up with good results.  Therefore as a final step I created a couple of little Unity editor tools, one which lets you define colour schemes and save them as assets, and the other which lets you define spacebox parameter configurations with acceptable morph ranges as assets.  This lets me save as many good combinations as I can find and then during run-time when a new spacebox is requested, it randomly selects one of the predefined configurations and colour schemes, generates a random morph within the defined ranges, and uses the resultant parameters to generate the new scene.  This should let me randomly create many different variations during the game without me having to worry about it coming up with any really duff looking combinations.

Anyway, I’m quite pleased with the final results, I feel it’s an improvement anyway, and, most importantly, it’s now useable Wink.  There’s still lots of improvements that could be made, and many extra additions I can think of too, but at this stage I think I’m happy enough with it to move on for now.

Thanks for reading.

 

Dan.
« Last Edit: August 14, 2012, 02:06:59 AM by motorherp » Logged
Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #21 on: September 28, 2011, 02:34:59 PM »

I am in awe of how much work you've put into just the background My Word!
Logged

motorherp
Level 3
***



View Profile
« Reply #22 on: September 28, 2011, 02:47:49 PM »

I am in awe of how much work you've put into just the background My Word!

 Cheesy Cheers Belimoth.  I can't say I'll be putting the same level of effort into everything, but given its a space game and I really wanted to capture that feeling of exploration and discovery, I felt the backgrounds were pretty important.
Logged
motorherp
Level 3
***



View Profile
« Reply #23 on: September 29, 2011, 12:27:04 PM »

Woo!  Proto-world is born.  I call it planet Hendrix.



Yeh, the texture is just one of my packed noise maps I slapped on to check it for seams, it's not permanent I just wanted to test it.  I'm using this pretty cool cube to sphere mapping I got from here to create the planet geometry and I've ordered my faces and uv's to match the spacebox so I'll be able to re-use lots of the spacebox texture generation tech I've already written  Smiley.  Pretty cool but lots to do....

I think I might actualy leave a planet Hendrix tucked away in one of the systems somewhere in the final game for people to find Wink
« Last Edit: August 14, 2012, 02:07:32 AM by motorherp » Logged
motorherp
Level 3
***



View Profile
« Reply #24 on: October 03, 2011, 01:56:15 PM »

Making progress on the procedural planets  Smiley.  Still lots to do though and lots of issues to sort out with the rendering.  Just wanted to post a quickie WIP so you know I've not given up  Wink

« Last Edit: August 14, 2012, 02:07:42 AM by motorherp » Logged
Inanimate
Level 10
*****

☆HERO OF JUSTICE!☆


View Profile
« Reply #25 on: October 03, 2011, 04:17:21 PM »

That is a gorgeous texture. Absolutely amazing!
Logged
motorherp
Level 3
***



View Profile
« Reply #26 on: October 04, 2011, 01:11:38 AM »

That is a gorgeous texture. Absolutely amazing!

Cheers mate.  I dont know how much credit I can take given it's done proceduraly so really its my computer doing all the hard work, but since my computer can't exactly defend itself I dont mind taking the glory Wink
Logged
motorherp
Level 3
***



View Profile
« Reply #27 on: October 08, 2011, 01:51:59 PM »

Update incoming - this time gaian planets  Smiley
Link to the original blog post

---------------------------------------------------------------------

I figured it was about time for another update.  This time I’ve been working on planet generation, in particular I thought I’d tackle Earth like planets first since these are the most complex, therefore if I can make a system to generate a reasonable Earth I should be able to modify it to deal with other planet types without too much hassle.  At least that’s the theory.

Like with the skyboxes, I wanted the planets to be randomly generated to give many different variations and since I was quite pleased with how the skybox turned out I decided I’d try and re-use many of the ideas and methods developed for them.  Therefore the first step was to generate the planet geometry such that the six face texture mapping method used for the skyboxes would work with them.  In the end I decided to build the planets as quad-spheres since not only would they be compatible with the skybox texture generation methods, but also lead to far less texture distortion than other methods such as spherical mapping.  I found this cool quad-sphere mapping equation at the mathproofs website which is what I used.

To generate the planet texture’s themselves, I re-used the same ideas from the skybox, i.e. to mix together pre-generated high resolution noises in a shader using run-time generated low resolution noises to create different results.  I mixed together several noises to create a height-map for the planet which was used as a lookup for a 1D colour texture.  By controlling the positions of various colour bands within the lookup texture it was possible to create oceans, islands, and shore lines in differing ratios.  A second high frequency noise was used as an offset to help break up the shorelines to make them look more natural.  The position in the lookup texture of the shoreline colour band was passed as a parameter to the planet shader to define the separation point between land and sea and was used to control how the shader lit the surface.  If the current location was land then the pixel was lit using a matt-diffuse lighting method, else if it was sea then it was lit using a specular lighting method with a bump applied determined by one of my noise components.  This helped to make the water look more reflected in comparison to the land which looked quite nice when the planet was viewed at a glancing angle.

Next I added a cloud layer to the planet.  This was implemented in a separate shader which first displaced the planet geometry outwards along the vertex normal direction so that the clouds would sit on top of the planet.  The same noise blending generation method was used to create the cloud textures themselves but with the noise value also being applied to the pixels alpha and the results alpha blended on top of the planet.  Since the clouds are implemented as a separate render to the planet on their own geometry, I was able to have the cloud’s quad-sphere rotate separately from the underlying planet thus making the clouds flow.

Finally one last shader was implemented to render the planet’s atmosphere.  This consists of two passes, the first of which blends an atmosphere colour over the planet using a rim lighting like method to give the impression of atmospheric scattering.  A second path extruded the planet geometry and blended in a glow colour using the same lighting method the give the atmosphere depth.  For this I’m using a shader written by Nils Daumann gotten from the Unity Wiki with a few minor modifications.

('right click -> view image' for a better look or check it out on my website)


It ended up taking me quite a while to get this far.  I experimented with a lot of different texturing ideas, many of which ended up being discarded before I found something which started getting close to the results I wanted, and also I was having a lot of trouble with my inexperience with the Unity shading system.  Big thanks go out to Daniel Brauer from the Unity forum for helping me to resolve some of the shader bugs and issues I was having.

I’m still not quite all the way there yet with the Gaian planet generator.  At the moment the texture looks rather bland where large land masses appear.  I think more detail needs to be worked into the land areas as well as applying more colour variety and variations.  Also I’m finding it difficult to balance the atmosphere shader so that is gives consistently good results when the planet is viewed from all angles.  I’ll either need to upgrade the atmosphere shader to something more advanced or work on dynamically altering the shader parameters dependent upon the viewing angle relative to the light source.  Given that I’ve now spend a long time on this already though I’m feeling the urge to crack on and start tackling some more game related issues such as how I will structure the solar systems and how I will deal with the issue of scale.  Therefore I think I will move on for now and return to the gaian planets later.

Thanks for reading.
« Last Edit: August 14, 2012, 02:08:09 AM by motorherp » Logged
Chromanoid
Level 10
*****



View Profile
« Reply #28 on: October 08, 2011, 06:17:44 PM »

Looks great. Maybe interesting for you: High-Quality Rendering of Stars (in German, but google translate might be enough to understand)...
Logged
motorherp
Level 3
***



View Profile
« Reply #29 on: October 09, 2011, 03:49:46 AM »

Very cool article, cheers for the link  Coffee.  So much better than my simple pixel dot stars.  I really like the motion blur stuff in particular, I might have to pinch that  Smiley.
Logged
motorherp
Level 3
***



View Profile
« Reply #30 on: October 11, 2011, 02:36:15 PM »

Warning - mega text update approaching !!
Original devlog post here


--------------------------------------------------------------------------------------

Structuring The Universe


As interesting as spaceboxes and planets are, I decided I should start to spend some time laying down the framework for the game.  In particular I wanted to tackle how I would handle the structure of the game universe and it's contained entities since this would provide the foundations for everything else to sit on.  Given the scope of the game world I know that just blindly ploughing ahead with code will quickly get me in a mess and lock me out of wanted features without a major refactor, so better to have a good plan to begin with.

In the spirit of Elite, I want to create a huge game environment with thousands of different systems and planets and other objects where each entity in the game should be randomly decided upon to give a massive amount of possible combinations and variations.  Given the potentially huge scope, each system and entity should be able to be easily generated on the fly when requested and discarded when no longer needed since it would quickly become unfeasible to generate the entire universe at once at the start of the game and try to hold it all in memory and update it all at the same time.  Also, as well as being randomly generated, each system and significant entity must also be persistent such that when the player revisits them, the exact same one is generated again.  Lastly the framework should be ordered in such a way that the game is able to cope with the massive range of scales which will be present, from parsecs to millimetres, without being hampered by floating point inaccuracy issues or other such problems.

To try and achieve this I've planned on creating a nested tree of game systems which, in order from parent to child, consists of the universe system -> galaxy systems -> solar systems and deep space systems -> and finally planetary systems.  Each system will contain its children systems and a list of entities which exist within it.  Using a tree structure like this means that at any one time, only branches of the whole tree that contain the player need to be generated and stored and all other systems and their children and contents can be safely deleted.  Each system will also contain its own instance of the pseudo-random number generator (PRNG) used to determine its static content such as planets etc, and the first task of any system upon creation after determining its contained sub-systems will be to generate the PRNG seeds for those sub-systems.  This will ensure that the same static content for each system will be generated each time regardless of the order the systems are explored in and independently of what generations might be taking place in other active systems at the same time.  For generating dynamic content such as NPC trader ships and such, a global PRNG will be used instead since this is something you don’t want to be the same with each visit.  Finally, for most intents and purposes, each system will act as a separate self-contained game instance which helps me deal with the mathematical inaccuracy issues since each system can use its own scale appropriate to its size and only needs be concerned with the positioning of its own local contents.

So far so good.  With the above plan I should be able to create and populate a grander Elite style universe, but just like the original Elite it would lead to a universe that doesn't feel particularly alive or consistent in some ways.  For example, imagine jumping out of system and immediately after jumping straight back into it again.  You'd arrive to find all the dynamic content completely changed rather than similar to how you left it since the system will have been destroyed and re-created.  Similarly, imagine you follow an NPC ship after it jumps into another system by jumping to that same system straight after it.  You'd arrive to find it wasn't there since the system you jumped to didn't exist before you entered into it yourself and the NPC will have simply been deleted after it left the previous system.  Related to this problem is that I also know I wish for the player to be able to indirectly command multiple game entities that may or may not be in the same system as the ship the player is currently piloting so that they can potentialy control armies and such.

Clearly game entities in some circumstances need to have life-times beyond that of the player’s current system and need to be able to still extract information about their surroundings and interact with the system they are occupying in a sensible manner, at least for a limited time.  Thus those additional systems also still need to be created and stored in memory.  However, why bother consuming the time and resources needed to generate a planet texture, or have the NPCs' AIs calculate precise ship manoeuvres for that matter, if those things can’t be seen because they are happening in an external system the player cant see.  Therefore I've decided that systems and entities will have two levels of resolution, the macro and the micro.  All render objects and frame to frame logic and updates will exist in the micro instance and will only be generated when needed, and the macro instance will contain only statistics about the entity and high level logical updates.

To facilitate this I've come up with a list of entity statuses and associated rules which will determine when and how micro and macro level instances and updates for entities and systems are created and destroyed.  The entity statuses are:

    minor - entities that are inconsequential to the player at the current time.

    static - a special case of minor for entities which are persistent such as space-stations and planets which can store persistent data.

    significant - minor entities are upgraded to this after being actively observed by the player (through an observer status entity or currently watched witness status entity).  This status only lasts a limited time period after leaving the current scope before being downgraded again.

    witness - an entity owned by and under indirect control of the player and is therefore capable of transmitting information about its current surroundings to the player although the player cant directly view its system.

    observer - an entity capable of directly viewing its system such as the players piloted ship or remote cameras.

Each active entity will exist in its macro instance by default and its micro instance will only be active as long as there is another entity of observer status in the same system.  Similarly, systems will only have their micro instance active if they contain an observer status entity, they will activate their macro instance if they contain any entity with significant, witness, or observer statuses, and will destroy themselves and their contained entities if they contain none of the above.   Finally significant, witness, and observer status entities are all capable of spawning systems they jump into, whereas minor status entities will be destroyed upon leaving their current system.

Hopefully these plans will be enough to create a large scale universe which appears to be living and breathing even without the direct influence of the player.  Now for the hard bit, I have to code it all up.  Sorry for the big wall of text and the lack of pictures but I've been doing a lot of thinking and planning and not much else recently.

 

Thanks for reading.
« Last Edit: October 11, 2011, 03:07:51 PM by motorherp » Logged
motorherp
Level 3
***



View Profile
« Reply #31 on: October 27, 2011, 12:07:35 PM »

Long time no update.  Most of the developments on EPIC have been in the back end recently so there's not been much to show.  Here's what I've managed to put together since last time:

  • I got the game structure I talked about in the last post implemented and working
  • I've made a first pass at a dynamic resource management system
  • I implemented a system which periodically set the camera to the world origin and repositions the universe around it.  This helps to combat render accuracy issues given the scale of the systems and how far away from the origin the player can roam.  Fortunately this turned out to be simple since I have everything structured in a hierarchy anyway so I only needed to reposition the root node and everything else follows automagically.
  • Implemented camera fades for smoother transitions.
  • Started putting together a map implementation which will allow the player to navigate the universe

I should hopefully have something more interesting to show once the map and navigation systems are finished since you'll then actually be able to move around the Universe and it might actualy start to feel somewhat like a game  Smiley.

I also took a bit of a brake from EPIC in the last couple of weeks to knock together a little something for my girlfriend.  It's a dynamically arranging music box, pretty cool, although it turns out not the easiest thing to implement using Unity.  Check it out here if you want to:

http://forbiddenfunction.com/main/?page_id=396



Now I'm done with the first pass of that though I'm going to return to EPIC for a while so hopefully should have something exciting to show soon  Smiley
Logged
Chromanoid
Level 10
*****



View Profile
« Reply #32 on: November 25, 2011, 04:11:18 PM »

a link i found in my favorites, when i saw it, i thought of your project. maybe it's new and interesting to you Smiley:
http://www.projectrho.com/rocket/index.php (topic list top right corner)
Logged
wzl
Level 1
*



View Profile WWW
« Reply #33 on: November 25, 2011, 05:06:18 PM »

Hey motorherp,

i just joined here and i find it nice to see some familiar faces Coffee
(redwater from shmupdev)

This is an interesting project you've been working on. Eventhough i have never played the orignal Elite, so i'm kinda clueless on how the gameplay will work. Are you in a commander kind of view switching from planet/system to another, or actively flying around in a ship?

I'm really impressed by the work you've put into your skyboxes and planet surfaces, and it is amazing how elaborate and detailed you are in your posts! cheers for that.

Good work sir Gentleman

Logged

Long pork is people! wzl's burrow
motorherp
Level 3
***



View Profile
« Reply #34 on: November 26, 2011, 04:44:41 AM »

@Chromanoid :  That's a really cool link, I'm enjoying that, cheers for thinking of me hehe  Smiley.  The stuff about dispelling sci-fi myths was interesting, particularly the stuff about stealth space combat.  In my mind I'd always imagined that if space combat became a reality then it would be more akin to submarine warfare but apparently that's not entirely correct.  When it comes to epic though I dont mind bending the laws of physics in the name of gameplay and fun though.  For me I'd rather try to re-create something which takes me back to my childhood dreams of space acventuring rather than creating a simulation.  There's still lots of good inspiration there though.  Cheers.

@wzl : Hey dude, good to see you getting your project about.  Like in the original Elite, in Epic you'll mostly be flying around in a ship, trading, pirating, taking on military missions etc.  However I really want to push the concept further by not restricting the player to the confines of an individual pilot.  I'd also like for the player to be able to command multiple ships and armies also and give them the freedom to jump into the body of the pilot of any ship they own.  This will allow the player to orchestrate large operations whilst at the same time also being able to focus their attentions and jump into the action however they wish to so they can experience many different aspects of their own large scale space saga.  How exactly that will work in game I haven't decided yet but its something to work towards.


Well its been a while now since I've updated this devlog so whilst I'm here I figure I should say a few words about the project.  To be honest I haven't done a large amount of work on this project recently and what has been done is mostly behind the scenes work on the program structure and supporting systems so there hasn't really been anything visual to show.  This project is starting to get a bit intense and the code-base large and complicated so work is slowing down since its not so easy to just dip in and out.  I also let myself get distracted a bit with creating a small rogue game using libtcod to give myself another side project which was much simpler for times when I wanted to work on something small.  I haven't stopped on Epic though, I just need to get over the hurdle of getting all the foundations in place and solving some of the core issues and then things should get more fun and pick up pace again hopefully.
Logged
motorherp
Level 3
***



View Profile
« Reply #35 on: February 29, 2012, 12:50:41 PM »

original dev log post here

---------------------------------------------------------------------------------------------------------------------------------

So its been a while now since I've posted anything on this project, or in fact done much work on it at all.  I've been doing some research recently though and so I've decide its time to pick things up again.  Therefore I'm going to be focussing in on some of the more interesting aspects of the project rather than getting bogged down in leg work and hopefully rectify some issues I wasn't too happy with when I last left the project.

To be specific I'm going to be looking at planet generation again, and although I think I made some good progress last time I wasn't massively satisfied with the results.  In particular, the noise mixing methods I was using ended up giving results which looked good at a glance or a distance but on closer inspection they were rather bland lacking any specific details.  Also the image qaulity degraded significantly as you got closer to the planets, and although I dont intend for people to be able to enter the atmosphere or anything like that since I dont want to deal with terrain generation issues, I would still like for the players to get close enough for the planets to make impressive backdrops rather than just distant objects.

As a result of this post analysis I've decided to tackle planet generation in a different way.  This time I'm going to use traditional sample textures rather than proceduraly generated ones as a starting point so I can capture easily the types of details I'm after.  Since I'd still like for each planet to look different I then aim to use texture synthesis, tiling, and combination techniques to transform these starting textures into unique planets.  By using tiling I'll also be able to increase the resolution of the planets without massively increasing the texture budget to allow the camera to get closer without noticable bluring.  This all came about as a result of studying several planet texture tutorials designed for artists working in photoshop and I've been thinking of ways to break the various steps down into generative automated methods that hopefuly might produce similar results.

My first step on this path was to find a way to turn small texture samples containing the texture detail I desired into something more usable by the system for generation.  After reading some techinal papers I've decided to give image quilting a try, a method which takes many little samples from your source texture and 'quilts' them all together to create larger textures which resemble the details of the sample.  The reason for doing this is that having then generated a larger texture composed completely of the desired details this can then be used for generating wang tiles which will be my next step.

Therefore I've spent the last couple of night writing a texture quilting extension for Unity and I think the results have turned out alright.  The tool takes any texture as the source and then from that generates the quilt texture with the user specified width and height.  Since the generation can take some time I also made the generation part muti-threaded so that the tool doesn't lock up Unity whilst its working allowing me to continue doing other things.  After generation you can click on the small quilt texture preview to pop up a full sized preview and if you're happy with the results you just need to click the save button.  Simple.  Here's what the tool looks like:



And here's an example of the result.  The small image is the starting texture sample and the large image is the generated results (click for full size):





The next step will be to write a tool which turns these into wang tiles, but I'll leave that for another post.  Thanks for reading.
« Last Edit: August 14, 2012, 02:08:39 AM by motorherp » Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic