Friday, 26 July 2013

Friday And The Randoms

Terrain Save, Load and Random Generate

Another good (but hot) night in the coders dungeon. At night I have to switch off the blessed air-con as the open window lets all the moths in.  After 10PM the office gets hotter and hotter and hotter this time of year!

It's now 3AM and I'm practically in a sauna, sweating like a coder without a compiler and hoping this blog entry is nice and succinct so I can go to bed. Some good news in that the Monday meeting has been pushed to Thursday which gives me much more time to add some polish and even start the Physics prototype next week!  The downside of course is that without a demo for management to approve, there will be no pictures or videos now until next Friday. If you want this policy to change, you know Rick's email ;)

Terrain Saver and Loader

It was key to be able to save all edits performed and reload the terrain in the exact same state to resume editing and of course to load in when the level requires it.  A few hitches though. One bug one is that when I construct the height data manually in the terrain module, I drop from 200 fps down to 30 fps for some unfathomable reason. I have yet to dive into the source code of the module and might just be something silly, but it has me a little vexed.

I also found that converting the terrain height data to a height map image, and then feeding that back through the loader created import distortion of some kind which would slowly (but subtly) change the terrain heights each time you saved and loaded. Not a good idea as your terrain would have washed away after the 100th save :)  I am instead directly storing the heights in a Dark Basic Pro memblock file so I can keep a very accurate eye on this most valuable data.  I also save the veg shadow map too, this time as a simple image and map it back to the system when I restart the prototype. It works just great.

Holy Random Terrains Batman!

A tickbox on my schedule was the successful generation of a believable 'random' terrain as part of the Reloaded terrain editing suite. I was certain many users would not want to define every hill, dip, lake, bump, slope and mountain over a 50,000 x 50,000 area.  They would want a single button to make one up, and then allow some editing in the part of interest.

To that end I borrowed inspiration from our friendly Dark Basic Pro forum, and an entry into our 20 line challenge which is a bit of fun which tasks any programmer to write something useful in under 20 lines of code. It's great to see the amazing things coders can do in such a small space and in this case, someone produced a terrain generator in 20 lines!

The name of this DBP star is Lewis999 who adapted a Diamond-Square algorithm to populate a matrix with realistic height data. Using the same technique, I generated pure height data using the same idea and applied it to the terrain constructor.  I then painted textures based on distance from the water level, and used smoothing to create a nice transition. I also painted a band of grass at the point I felt grass would ideally grow (not too high in the mountains, not underwater or on the shore).  You can still paint all this manually, but the terrain generator starts off as an automated process.

Finally I played with the grass sizes to create a more dynamic and rich veg experience, and concluded that a few more grass and vegetation models and textures would really lift my terrain visual. Something to add to Mark's list when he's not looking!

Is Something Missing?

Running around my newly generated terrain for a while, as good as it was, there was something missing. Naturally there is no game, so no enemies, no buildings, no game objects, no nout of course. Still, you can have a convincing terrain without all the above, right?  As I am making a deliberate effort not to add trees (as that is for another pack and another day), I wondered what else I could add. Perhaps a few cactus plants models when/if they are created, sure, but I need something more substantial!

Is it a bird, is it a plane, no it's a Rock!

Sure enough, what my bleak terrain level needed was rocks, and lots of them!  Not the little pebbles that can be baked into the floor texture but large ugly rocks left after the last glacier strolled through the land.  From my extensive terrain editing (playing) I knew how to create a rock by making a sharp raised land, then squashing the top bit, then adding a rock texture and surrounding it with grass.

Given that knowledge, I proceeded to add a system which would strategically add a rock, and not just a single rock but what I term a rock clump. These clumps comprise of about 15 rocks in close proximity and they really do look natural when sprawled over the floor. The system then moves somewhere else in the land and makes another clump, and so on until there are enough.

The terrain generator is pretty good for a V1 now, but it does take a while (30 seconds for 150 rocks) and the final level would probably need a few thousand of them.  The good news is that once the rocks are in the land, you can save and load the whole terrain within seconds :)

Signing Off

So that's the week, and apart from IDE integration, all my terrain objectives have been met on schedule which I am pleased about. Still needs spit and polish of course, but we're well on the way now.  It also occurs to me that our AI system will need to know about height map terrain so enemies can work out a path through cliffs, valleys, slopes, work out line of sight, know what height advantage means, e.t.c.  I have already started a list :)

I plan to use the weekend to quickly add shadow generation to the prototype, experimenting with things like burning the normals as shadows in the texture to improve LOD transitions, calculating when a large hill or rock casts a shadow onto the terrain and the big one, rendering the entire 'outdoor' scene of a level such that I can burn the resulting shadows into the veg shadow map too.  This of course means we cannot have a moving sun for day and night cycles, but adding cascade shadow mapping to the terrain proved too costly and unless there is a performance friendly solution out there I have decided to aim for quality visuals rather than a day / night cycle in V1.  I should have plenty of time to work on my shaders, and it won't be long before a solution pops into my head which allows us to have our cake and eat it.

As is my custom, no blog entries this weekend so I can be free to do nothing, or burn the candle at both ends.  I was going to sneak out a screenshot of the latest progress, but I resisted (Rick will be proud).  See ya Monday!


  1. I would rather have day and night cycle instead of veg shadow. Would that be going into the world efx pack. A world without day and night and weather is a dull world. A must have in my opinion. But I will probably be a minority. Unless everyone wants it too

  2. I would have to disagree with science man. FPS games rarely have any kind of time reference. And if I had to choose between terrain shadows and day/night cycles I would go for former. Remember this is not FPSRPG or MMORPG or any kind of that mumbo-jumbo "creator".

  3. At first I would have agreed with science man. I was quite disappointed that there would be no day-night cycle. Then I thought about it some more and realised that while (unlike X9) Reloaded COULD create games worthy of day-night cycles (RPGs and the like), it's actually not likely to happen. Anyway, I realised that I won't be trying to create that kind of game. Unfortunately for science man, you probably are a minority.

    Just remember that we'll still have awesome weather effects and if you need a level to be day on one walk through and night on the next, you should be able to do that (even if it means having two versions of the same level).

  4. I agree. I do get carried away. But I would definitely pay for any expansion packs thats for sure. It is fpsc and so forth. But the more dynamic it can be the more appeal from more audience. I am a minority for a skyrim. Fallout etc but there is potential for much more. And I will have to button it. With fingers crossed.

  5. Don't worry guys, I think day night cycles, weather patterns, massive terrain based earthquakes and all manner of level altering states are for the grasping. I just want to get to V1 with some very nice screen shots and very exciting fast game play. I am sure I can solve the conflict between semi-baked terrain shadows/veg and the set of shaders I am working on. Just a matter of time...

  6. On thing I am confused about: if the level size is 500x500 why is the terrain going to be 50,000x50,000? Is this for an infinite horizon effect that goes out 49,500 past the physical world or is 50,000 units the equivalent of 500 segments? Either way what you've managed to create so far is amazing.

  7. Man... So many details described in this entry left me salivating for a screenshot or better yet, video! It sounds like excellent progress. Not to beat a dead horse (re: dev art screenshots) but did you see the SimCity engine concept video at ? EA released it a full year before the game was complete and used mostly crude and unfinished models to demonstrate the technology of the engine (at the 1 min mark they show off the terrain editor which reminds me very much of some of the 'dev art' screenshots and videos you posted previously). It received wonderful reviews for the tech, I don't think anyone assumed the models and media was meant to show a final form, it was clearly just a dev tech demo.

  8. Despite hopefully being a much better engine product than any TGC predecessor I think everyones looking at Reloaded out of context.

    Its an indie engine and not going to be in the same league as the big boys engines. Hopefully the engine itself will have the same strict criteria applied to it as the screen shot quality control imposed upon it throughout its life cycle.

    Its the engine itself and the games made with it which will surely swell the reputation and promote the product if its good. If the quality of the engine despite any visual qualities is not good then it will soon detract from its future. Small world this indie game making business and if Reloaded provides a stable and quality platform for indies to develop with then then that is what will be enough to self promote it with of course any additional marketing and promotional help from all concerned. If it fails to deliver for indies then its success will be relative to that and no amount of visual quality will be enough change that.

    Thus to potential users visuals don't really have a real bearing though nice to see. The time will come soon enough albeit potentially a long way off yet when the engine itself will have to support and promote itself and then the visual quality will be just be icing on the cake or of no consequence at all.

    Both screen shots, videos and the engine itself have at some point to be released into the public domain and that's inevitable if you want to sell the product and cant be avoided so much patience and everyone will be happy or not as the case may be.

    No doubt sooner or later the engine will come under close scrutiny and the engine itself will have to be good to be talked about in the same league as many engines and games which have been referred to by the community and developers of it. Thats not very realistic in my humble opinion.

    Marketing and promotion is a hit and miss thing and so is commercial success as humans are strange creatures at best.

    Reloaded apparently has or will perhaps potentially have and in theory enough features of "Quality" to make a decent impact on the indie market and undoubtedly it should sell well for TGC but its not a reality yet and much can change and probably will as we all know from long past experience.

    Everyone awaits the Engine for without it no one can adjudge anything until its in the hands of game makers and their results in the hands of game players. Then Reloaded quality will be finally its saviour or not.

    You can sell anything to anyone with enough hype of course but sooner or later the Reloaded engine will be judged upon its real merit and that will govern its long term success or not.

    Reloaded has a much harder task to do in promoting the FPSC line than its predecessors as a credible engine for more than hobbyists if that's what you want and the engine itself will be needed for that and thats where the quality control really needs to be maintained.

    If anyones like me drooling over screen shots, videos and what might be then it wont make a great deal of difference at the end of the day unless Reloaded actually delivers any of it in a way thats useful to the game maker in practical use developing and deploying and eventually game players who also have considerable clout in influencing and or promoting a game engine or not by their reviews.

    Patience is required and October, December and 2014 and beyond will be here before you know it and if and when any engine is eventually released then the Quality of anything and everything will really matter.


  9. I rather think people will start reading my blogs for the comments section eventually :) Thanks for the continued feedback guys!! I just cracked pre-computed terrain shadow casting last night so my hills now throw a shadow onto the grassy plane, and really adds something I considered was missing from the scene. Going to tackle pre-computed normals now (which work better with LOD and can be switched too for the final standalone build).

  10. I hope you guys avoid the early adopter (EA) approach for FPSCR. I remember back in the days FPSC EA got a really lukewarm response due to many issues. Most of them were addressed before the final came out but the damage was done. Bad reviews roamed the vast of the internet for ages. My advice would be to skip EA and instead hire a bunch of beta testers and do a closed beta testing month or so. This would result in much more polished and stable product.

    Another thing to remember. Make sure you don't leave out any "essential" features for post V1. This also won't go down well with the audience and especially the reviewers. Something like "V1 ships with a basic AI, *but* we will eventually be upgrading that to a killer intellect in the upcoming expansion packs" will never sell really well. People expect to get a product which is self-contained, mature and finished. Anything else that comes out later in form of an update or an expansion pack should only contain additional non-essential features. I know you guys earn a lot from selling expansion packs but lets face it, if the FPSCR core is rotten (read unimpressive) you won't persuade non-TGC fans to join the ranks of TGC-heads and buy the product and the expansion.
    In short, I would suggest you go for the excellent first impression. The wow-factor is really important in this case. Once you get a good rep sales of paid-upgrades (expansion packs), model packs and other related tools will only soar.

    1. Olby is right, and of late it is something I am truely fearing. While the work you are doing is phenominal Lee, I cannot help but wonder if "After version one" is going to be used to write off important features.

  11. It was always intended for this product to be less a V1, and more a rolling series of updates. Rather than a 'box' strategy, it would more resemble an online cadence release.

    It's an interesting point though. Do you think the community would prefer a release in October and be part of the play-testing effort, or wait until Christmas and play a version I've put through 3 months of usability testing? In the past I found the best testers where the customers, and the feedback born of necessity ;) In an ideal world I would sit on a V1 for at least 6 months in or near it's final state to make sure it's not only a WOW factor engine but delivers a bulletproof user experience. My fear is that pledger's will not want to wait that long. I suppose it boils down to whether you, the customer, want to test it now or test it later :) On a more general muse, is a Game Maker ever really finished?

    1. Well now I am far less enthused about Reloaded. :(

    2. I want to see a product that has well-rounded features that feel like they were built along with the engine and not as injected, tacked on extras. For example I don't want half finished features that allow makers to better do something, but introduce new things they cannot do, I want features that completely revolutionise the way FPSC users make, envision and design their games.

      First impressions are everything, even to those loyal pledgers. So I suggest that you take the time to work on a complete version that looks and plays good, that can truely capture the attention of budding game makers and encourage their visions, not destroy them through lack of intuitiveness/capability.

      I'm sure, myself included, that all of us here would love to beta test the software, but I think we would like something coherent to test, rather than a couple of updates to an old engine.

  12. How about instead of a v1 october release
    release a Beta Version for Pledgers only?
    this way the product would get the needed testing phase
    and TGC would get enough time and feedback to make a solid v1 for christmas along with
    the pledgers would eb able to start using/ learning reloaded and
    be able to give feedback and probably even start to produce content

    so by teh end of teh year FPSCR wouldnt only have Reloaded as a showcase - it might even have some community project showcases
    see teh point in this?

  13. It must be difficult to decide when best to release anything to users. In an ideal world yes I guess TGC could test it indefinately internally. Of course that makes a lot of work and extra time invested for you that could be spent elsewhere I guess.

    I am sure many potential users would like to get something as early as possible like myself so we can see what we are up against in the development pipeline and get some experience of using it so as to make a start making assets over and above any that come with it out of the box and build some bespoke assets ready to go. At the moment one would not really know where to start with that.

    If we were to wait for an additional 6 months to find those kind of things out then clearly thats a delay that would have to be lived with before kicking off at all with any asset preparation and start from a standstill as it were. Obviously an early release would also give users the opportunity of feedback on any issues that may be of some help in addition to any internal testing as they go. Not sure if that may muddy the waters at all from TGC point of view though.

    Unless TGC will do very extensive internal testing then end users are likely to find issues anyway in real time development.

    Again with regard to the quality issue of any release those users that already use FPSC and other engines understand full well that any early alpha or beta release is release is potentially likely to have some issues and accept such releases for what they are.

    Cant say about external or general public perception as thats perhaps another matter but I guess they wont be getting a copy of any pre release will they unless they have already pledged and then they should be aware of what any pre release is all about - testing and not a final product.

    As you have said even with all the time and effort in the world is an engine ever finished?

    I suppose a compromise is always needed. I am sure you Lee will know best as you are the only person really who has any idea apart from anyone else you make privy to the engine other than yourself about how the development is performing.


  14. Olby27, I wouldn't discredit all the hard work that actually went into the RPG Mod. It shows what type of alternative FPS games people wish to make. Which includes many of the current pledges.

    I for one would love these weather forecast and day/night features. Even if they are rolled out into V2.

  15. "but I guess they wont be getting a copy of any pre release will they unless they have already pledged and then they should be aware of what any pre release is all about - testing and not a final product."

    I entirely agree, as a pledger chances are you'd know that you're using software still in development. I personally would like to get my hands on any FPSCR as soon as possible, but of course with due patience. I would find it awesome to help out development of FPSCR pre release through bug finding etc. Isn't that one of the biggest reasons to buy the pledger, to gain access to the early betas of FPSCR?

    "Do you think the community would prefer a release in October and be part of the play-testing effort, or wait until Christmas and play a version I've put through 3 months of usability testing?"

    So would the pledgers be able to beta test FPSCR from october, then a release in christmas (or along those lines) or would V1 be out in October and rolling updates from then on based on community feedback bugfixes etc?

    Personally, I'd prefer not to have to wait until Christmas, but that's ultimately a mild preference. I am most prepared (as a pledger myself) to wait for a good while, but do hope as a pledger to gain access to the betas whenever its ready or best to release as just that.

    Overall I'd like to emphasise that I probably won't know what's best for FPSCR in terms of a product as a whole, but I'd definitely like to have access to FPSCR betas and help as a tester sooner as opposed to later.

  16. Many pledgers I am sure have done so that they can have access to alpha or beta versions though if there are none then that kind of overides that and then that part of the pledge deal would fall through and they would have to wait for some version perhaps more akin to a final release.

    Given what we know currently I think you will be lucky to get any final release until well into next year at the earliest so if there are no pre releases then a long wait it may be. More than 6 months from now is my guess.

    TGC and pledgers may have a long wait for a "Finished" version release as described. Thats if TGC can wait that long themselves.

    If there are no Alpha or Beta versions to be then to be honest and up front which is good for TGC reputation then it should be removed from the pledge details. Thats may prevent many new pledgers as they might just as well wait to buy when they can see what they are getting for their money and then they have a choice to buy or not whereas pledgers have already pledged.

    We don't want repeats of FPSCR and X10 promises that never materialised. That was part of the problem with lack of support for them. They never delivered from the beginning what was promised or suggested if you like and never lived up to expectation as an indie tool despite all the lovely and good things about them. Its the bad things that concern users. The good things are expected and taken for granted.

    Clearly pledgers have themselves agreed to a delay up until around Christmas to add things to FPSCR. I doubt they will be happy to wait much longer than that for something at least though they will I am sure support Reloaded and TGC for some time before losing patience completely.


  17. There's no harm in TGC's reputation if the closed Alpha/Beta testing is done with the pledgers. This way TGC can save some money and get a real world feedback during the testing phase. If the general public (non-pledgers) will not be able to buy the Alpha/Betas this will save TGC from the bad rep (reviews) early on. So I would go for a closed testing phase with the pledgers and no external PR and such. Once the initial testing is done and the product is more or less stable it can go out in the wild.
    I'm still concern about the rolling update phase, like many said before, I really hope this will not hold off any essential features.
    Remember the less there is the better it is. Don't promise blue wonders if you can't deliver them. I would always go for a small, but fast game engine that has less features and eye candy if it works really fast and has the potential for extensions.

  18. I will push to get a beta release to pledger's as soon as possible. I want to get the basic physics, editing and test game working and looking nice before assaulting your senses with a version. I am curious if wanted access to the prototypes as well, which show of small specific features such as character control and terrain?

    From our marathon comments section, it sounds like a good plan would be to start usability testing in October using the pledger community only, and schedule a full scale PR launch once we decide all the kinks are worked out (maybe Christmas, maybe 2014). Does this sound reasonable?

    As to long lost promises, please don't take anything in this blog as a promise of features in the future, merely as an open discussion between coders and all the implied creative ramblings that it fosters. The good thing about rolling updates, and having me work on Reloaded 100% during 2014 is that any lost promises would much sooner be rectified :)

    1. Drat. You posted this while I was typing my comment. Grr.

    2. Yes, that sounds reasonable. It's pretty much what I suggested in my latest comment, only you had to go and ruin it by typing at the same time and posting first! ;)

      Yes, we understand. Just because you say it might be cool to have support for infinite worlds doesn't mean you're promising we will have it.

      I see this blog as an awesome privilege. I mean, we get to talk directly to the developer of the program as it's being developed, and he actually listens. When we all start getting upset, you change whatever's wrong. That's so cool.

  19. Wow, sometimes the comments just explode.

    First off, people are good at breaking things. Like, REALLY good. So a semi-public (pledger) beta is perfect for bug-finding and is, in my opinion, a necessity to prevent a launch swarming with bugs.

    Next, most of the pledgers will already realise that they have access to a beta and not a finished product; for those that don't realise immediately, the word "beta" should be plastered everywhere so they get the picture.

    Finally, people are not stupid (well, most aren't) but they can be a bit forgetful (I seem to remember every single person commenting here or on the forums said they would rather wait an extra month than have the memory-limit in place). I think most of the people that commented so far would be surprised at the changes to the engine if they were to see it all working together. Some may have forgotten those things were ever changed, some may not have read far back enough into the blog (I went back and read from the beginning and haven't missed a post so far) to see some of the changes.

    So my suggestion is this. Work full-tilt on the essential features (bearing in mind that whether or not a feature is essential is entirely subjective) with a view to get them finished by Christmas, and release betas to the pledgers whenever there's not too much broken and whenever you add any new features.

  20. Will the engine support direct x11 or it will remain to x9?

    1. The engine will be DirectX9 only because it's being programmed in DarkBASIC Professional, which is X9. Still, I see no major advantages in DX11 over X9. The graphics will still be pretty spectacular.

  21. I think shooting a beta early one to pledgers will have the desired effect, as laid out in previous comments. It may even help nab you a few more pledges; once it gets out that pledgers are getting their hands on a beta version. ;)