Arsonide's Forum Posts

  • Right now I'm trying to whip up a test program and having issues with such a large tilemap and performance. I suppose that's more of a problem of the way the tilemap is set up and not the Perlin Noise object though.

    So basically how it works is this, there are three settings that affect the detail of the map - Octaves and Frequency affect the quality, Amplitude affects the height ( -Amplitude to +Amplitude is the values that it gives out. ), and lastly, the seed. Basically, if you give it the same seed, it will give you the same noise...so the terrain isn't only random - it's persistent. So it can be used in an RPG or whatever and integrated into the save game, and there is no limit to how much terrain you can come up with, if you keep adjusting the seed.

    The noise itself does not have a width and a height, but is percentage based. In other words, it doesn't think in terms of "X,Y", but more like "52% across the area, 32% down the area). I will set it up so that it uses layout coordinates, for simplicity, but the side effect of this is that, since it doesn't compute stuff in finite amounts, you can have a layout as large as you want, and the noise will still look good.

    The "Water Level" you see in that screenshot, was just an arbitrary number chosen by me. Basically those are all one white sprite in an array paste. At layout start it runs all of them against the PerlinNoise object and colorizes them according to the amplitude that is output where they are at. I do a system comparison event on that, if it's under zero it's water, and above zero is land. The entire cap is two objects, six conditions, and four actions...and if I change the seed a completely different output is given, as expected.

    I thought about making this into a "terrain" plugin, and integrating a lot of functionality specific to terrain, but perlin noise has applications unrelated to terrain, so I thought I'd keep it simple and let the cap designer use it how he wants to use it. I've wanted something like this in Construct *forever*. If and when someone else comes up with a Tilemap object - combined with this, we're talking the end of comparisons to MMS and Game Maker, because Construct will simply be a superior program.

  • Ashley you're a life saver! The object was NOT the issue, but your debug information pointed me to the fact that none of the parameters for the noise had been initiated, which pointed me to the fact that I was not loading my runtime serialization stuff in the same way I packed it up at edittime.

    I packed it up as ar >> 1 >> 2 >> 3 >> 4;

    I was reading it as:

    ar >> 1;

    ar>>2;

    ar >> 3;

    ar >> 4;

    <img src="http://content.screencast.com/users/Arsonide/folders/Jing/media/f221854e-eef3-4938-8e49-2097990709f3/Terrain.png">

    The fruit of my labors! Keep in mind that the noise is much smoother than that, but I just whipped up a quick test program using 64x48 sprites. Over 3000 of them. I'm going to keep working on this and release it to the community to solve everyone's random terrain problems.

  • Tonight I was porting the Perlin Noise library I'm using for console applications to Construct...and everything went great, except that the library clamps a specific value between -1 and 1, and that value is somehow getting up to 600. It does look like the noise is being generated persistently, like it should be, but the amplitude is way off. Also at some point when I was trying to fix this, it randomly started freezing at runtime.

    I know the exact line it freezes at though.

    At the moment I'm just hijacking "MyExpression".

    long ExtObject::eMyExpression(LPVAL params, ExpReturn& ret)
    {
    	// Get the example parameter
    	float XPos = params[0].GetFloat();
    	float YPos = params[1].GetFloat();
    	float XDim = params[2].GetFloat();
    	float YDim = params[3].GetFloat();
    
    	float CheckX = XPos/XDim;
    	float CheckY = YPos/YDim;
    
    	Perlin *PerlinMap = new Perlin(perlinOctaves,perlinFrequency,perlinAmplitude,perlinSeed);
    
    	float ValueAt = PerlinMap->Get(CheckX, CheckY);
    
                delete PerlinMap;
    
    	// Return 0 using ExpReturn's operator=
    	// Use ret.ReturnString() for strings.
    	return ret = ValueAt;
    }
    [/code:2igtm02p]
    
    It's the PerlinMap->Get line that kills the runtime process, and I have no idea why. I've used it before and it works great. If anything killed Construct I'd assume it'd be throwing a Perlin Noise Map on the heap...I *strongly* suspect that I'm creating this object dynamically when I should be letting Construct know about it ahead of time in the Serialization or something, but that doesn't seem to be a problem. The thing was (kind of) functioning for a while before I did something to it, and even then, it's buggier than it has been in prior programs - with no modifications to the code, so I'm thinking I'm invoking ACE incorrectly or something. Here's that ACE entry:
    
    [code:2igtm02p]	/////////////////////////////
    	// Expressions
    	// ADDEXP(List name, Category, Display string, Function address, Flags)
    	ADDPARAM(PARAM_VALUE, "X", "Your position along the X Plane, in percentile.");
    	ADDPARAM(PARAM_
    	ADDPARAM(PARAM_VALUE, "Y", "Your position along the Y Plane, in percentile.");
    	ADDPARAM(PARAM_VALUE, "XD", "X Dimension");
    	ADDPARAM(PARAM_VALUE, "YD", "YDimension.");
    	ADDEXP("My expression", "My category", "MyExpression", &ExtObject::eMyExpression, RETURN_FLOAT);[/code:2igtm02p]
    
    Right now, all I'm using is the code within the object itself, one expression to get the noise value at a specific coordinate, and four variables, accessible both at edit time and runtime, and I followed the tutorial with the Color Gradients.
    
    I'm not even sure how to hook VC++'s debugger into Construct properly to debug this. Do any of you guys have any tips? I know you probably know nothing of the Perlin class I'm using, I'm just asking for how to get started debugging. Originally this was a console program and I could carefully watch what was going on using my IDE's debugger, and since this DLL is intermediary between the executable, the debugger isn't working, or I haven't properly set it up. Also any common sense debugging tips would be appreciated.
  • It would be nice to be able to adjust the zoom of the minimap object - so it showed just the immediate surroundings rather than the entire layout.

  • I really would like to rebuild my generator in Python script, it'd solve a lot of problems. Currently I have a lot of global variables to hold things I need to hold between loops and events - things I only need once and for a short duration...but that I need between events. The second option is to make an object specifically to hold these variables, but I think a Python script would be more efficient - not to mention easier for me to read.

    However, Python isn't working consistently right now. At first I was getting a "Missing DLL: MSVCR71.DLL" error when trying to run a project using Python, which is the Visual C runtimes that I do have installed. I tried reinstalling and repairing and updating them to no avail.

    I finally installed Python 2.5 after reading this forum, and that allows me to view projects with Python (and run them) made in earlier versions, without this error. I can't actually make my own script, but I can modify existing ones in previously working projects to an extent. However, if I add any object and try to reference it in a script with a basic line, Python support completely fails on the entire program. Lines that worked fine with zero errors before now report errors at runtime. Lines other than the one I added, that worked fine before.

    For instance, if I open a project that works fine when run, that modifies a text object with Python...if I modify a line that changed the Text object, it'll modify it fine and the change will show up at runtime, but if I make another text object and try to use the exact same line on it, the whole program just fails, including the first line. They both report errors.

    A guy named Zack in chat last night had me "import sys", which is a standard library I guess, at layout startup last night and at first that appeared to work for a little while, but then the same symptoms showed up...in every layout and every project.

    Is there any way to get Python up and running right now, and if not, when is it planned to be fixed? Because if it's soon I can write a simple Python console program to generate my city and then port it into my Construct project fairly easily once Python is working in it.

  • I'll PM it to you. Since I don't know how to recreate it I'll just send you my project. The problem is on line 28 - the program won't even run, there's a runaway loop on line 28. Since I just restarted Construct all of the affected events show up properly, but as you mess with events they mess up. This happens if you restart Construct or not. Line 28 however is messed up right after you load the save.

    This is what I'm talking about: "ChosenDirection" 0 "None" - where 0 means "is equal to" since "is equal to" is the first thing on the list, and I guess the list is 0 indexed. It happens more and more as you mess with the program.

    What I just did, and you'll notice this if you check out the MacroGenerator Object and the list of Globals...is create all the Globals as private variables on that object, and through a lot of Find and Replace and manual editing, replace any instance of a global, with a reference to this object and it's private variables. Globals aren't necessary for the generation process since I only do it once. The problem is I guess I messed up somewhere cause line 28 is a runaway loop. While I was replacing, all these numbers started popping up and since I understood the problem I could check the index of what variable I wanted and replace it, but I guess I messed up at some point.

    Anyway long story short - it'd be easier to identify where I messed up if it wasn't doing that. Sending you the link Ash.

    EDIT: Line 81 also results in a runaway loop, if I toggle events 28 and 81 the program runs, but those events are really important. Line 81 is also messed up. It looks like this:

    Comparison: (Abs(MacroGenerator('ResidentialX') - MacroGenerator('IndustrialX')) + Abs(MacroGenerator('ResidentialY')-MacroGenerator('IndustrialY'))) / 2 3 (Abs(MacroGenerator('CommercialX') - MacroGenerator('ResidentialX')) + Abs(MacroGenerator('CommercialY')-MacroGenerator('ResidentialY'))) / 2

    That's two distance calculations - distance on an array - being compared. (I generally want residential to be further from industrial than it is to commercial.) The 3 is the comparison, I made it red to be easier to see.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Not sure why, but my event sheet is starting to show indexes for things with drop down boxes...and it's doing it at a very bad time - when I'm trying to replace all mention of my globals with private variables. It's making it nearly impossible to do this.

    I'll describe the problem a little better: If something has a drop down box, like say, which global I want to set, or private variable, instead of saying "North, South, East, or West" it'll say "0, 1, 2, 3". It also does this in things like comparisons, Instead of If RandInt is equal to 2, it'll instead say something cryptic along the lines of "If 7 0 2".

    Is this a bug or did I hit a button or something?

  • This will be my last update to this thread on progress on the program. I don't want to keep bumping this thread to the top of the forum. I will be making a simple blog for progress on the game in the coming days, and put it in the original post. That way anybody interested can see my progress, and anybody not interested doesn't have to deal with my thread being on top all the time.

    Last night Deadeye gave me a lot of really awesome performance tips. Seems that events don't have to have the Always condition to fire every frame. It also seems that comparisons done on an object will always pick the initial instance of that object and no further ones - unless you pick by comparison. Once this was hammered into my skull, my performance problems vanished...and knowing this I have a lot of refactoring to do. My program also has become frayed with features. There are a lot of features implemented, but a lot of loose ends to tie. For instance, the MacroGenerator - the process of generating the city's basic layout - is using globals right now. I need to migrate it to using private variables on a MacroGen object, because using ten globals for a process that happens once is bad design. I'm really afraid to start doing this, I've attempted and given up several times now...because there are several hundred references to these variables and one typo can screw up a lot of things. (Yes I am using Find and Replace, but a lot of it has to be done by hand as well.)

    The only way I can make it easier is with liberal commenting and group usage. If I comment every line, then if one is broken it will be more easily identifiable. So refactoring, and tying up these loose ends is my highest priority right now...I won't be adding any new features until MacroGen and MicroGen are working exactly the way I want them to, and I feel there are no more loose ends on the program. Then I will continue expanding on what is there.

    Last night as deadeye explained things to me a very simple concept for a map popped up into my head, and I figured it would speed development time to have one - a lot of my debugging time is spent looking for a road if I happen to start on grass. That was a thinly veiled excuse to ignore my refactoring pledge and add a map though, here is a quick four second clip of the concept: http://screencast.com/t/qbxdEh2bW

    I use Jing to quickly capture video and images, it lets me basically hit control-shift-s and designate a cropped area on my screen, capture, and upload in a matter of seconds. It makes really crappy videos though, so for the longer Youtube videos I use other capture software, but that takes a lot of editing time. For quick four second videos, Jing is fine.

    EDIT: Started the Blog! It is here. I have to go to work at the moment, so it's something I whipped up in a few minutes. I'll polish it up later. Oh and yes - my character's view of the world is inspired by Rorschach's.

  • I have no friends..

    Aha! The truth comes out. Quick! Get the developers some friends - and multiplayer will magically happen for all of our games!

  • This is a feature that would save me a lot of headaches. It would really be awesome to be able to toggle attributes - specifically the solid attribute, at runtime, on a per instance basis. I have a ton of buildings...and colliding with only the ones nearby saves a lot of performance. Right now I have to spawn collider objects, which is a pretty clunky way to do something pretty simple.

    It was suggested that I suggest this small change to make it easier on myself.

  • your intended level of detail is mind-boggling... but why would you want to model the interiors by hand when you could create them procedurally, like your city?

    Interiors will be based on maps, but the content will be procedural. For instance, there will be 100 interior maps for "LightResidential" buildings...but the furniture placement in there will be randomized in each one, even if you find the same map twice.

    The game goes into sidescrolling mode when you enter a building. Modelling stuff in Sketchup ensures that buildings are consistent both on top and from the side.

  • i'm looking forward to your progress! please check your videos for the correct aspect ratio next time, so your video diary is less irritating to watch.

    Sorry about that, had it in 1000x1000 from back when it was little dots and the whole city was 1000x1000 pixels. Got it in a regular ratio now.

    At the moment I'm focusing on the buildings. I decided that I want everything kind of stylized when I'm done, so I'm going to be using Google Sketchup to design the buildings and screenshot each side to texture their outsides, I'll probably use it to model their interiors and probably the furniture in there as well. It's a nifty little program created for designing architecture - for people who can't design/model/do art...such as myself. It was originally created for Google Earth, to get more 3D buildings on their map.

    Apparently it can even turn a picture into a 3D model or something. It's a really cool program, I think I'll enjoy using it.

  • More progress, looks much more professional. Threw in some props for Construct as well should anybody stumble across the movie while crawling through Youtube videos. Deadeye was telling me that some extra muscle around here would be good for the program.

    Subscribe to Construct videos now

    I'd actually done a rudimentary traffic model at the time this footage was taken, but I based it on the "grid" movement behavior, and I think bullet would be better. Grid is much easier to use, but it's kind of hard to get them to stay in their lanes when they are turning. I turned it off for the footage.

  • Not sure about curves at the moment, Mipey's right, if only key points of a curve are stored in the array then I'll have the curve going over some things on the array - if the curve is stored in two points on both ends, with the curve in the center, then the generator might think those center squares are grass or something. I could do it old school like curves in those old Transport Tycoon games - where a curve is actually like a gigantic L shaped tetris piece on the array, but visually pleasing in the world. Even then though, buildings won't be able to come flush up against the road for instance. It's something to think about, but definitely a tricky situation.

    Right now deadeye has me concerned with sidewalks and street paint and all the gritty stuff involving getting those roads and intersections looking like roads and intersections instead of ... well ... sprites on an array.

  • You can design your own tile map using an array of sprites currently, like I did in my procedural content post, but it is a little more complicated than a tilemap object. It serves the same purpose but requires a lot of looping.

    According to David they are at work on a Tilemap object already...though there's no telling when it'll make it into release.