Proxymity's Recent Forum Activity

  • Hi Constructurerers!

    Since quite a few hours now I'm trying to think about an algorythm, how to generate a dungeon with premade patterns the *best* way (there is no "best way", yes - but I want it to be as scaleable/ressource-friendly as possible ).

    The main problem might be, that I'm not exactly sure, what the correct name for such generator is, in english - things like "pattern based generation" or "dungeon generation with samples" doesnt showed me any usefull google.

    What I want to achieve:

    Sorry for the big picture; here's its direct link: http://proxy.wtf/_storage/construct2/screenshots/sketch_pattern_based_dungeongeneration.jpg

    When scene/level is starting, the generation-backend generates X (or less/more) rooms of an endless dungeon. The game starts when player wants to and ends when the player dies. A 8-way controllable player will be guided through a pixel-ish dungeon, filled with tons of monsters, secrets, chests, items and everything else, whats needed for a roguelike-hack'n'slash-RPG.

    The biggest deal (for me) on this project, beside the art/gfx (because I suck in creating it like noone ever before ), is the room-generation part.

    In what I need help:

    I need some advice in creating the generator. Thinking about an array, which stores informations about multiple, premade room-templates like: floor, walls, static elements; a random one is picked and "created" for the player. To make some pseudo-pseudo-code:

    Generation is triggered; // Trigger = player.X < 40% of current room; or a trigger-zone which is beeing entered

    Generator picks X; // X = a random number which represents a room-index

    Informations from array are parsed to the tilemap;

    Tilemap is beeing extended & parsed tiles are getting added;

    Generation finished;

    Because the player should be able to run backwards, I think, it would be the best to use a single tilemap which is getting bigger over time, instead of using multiple ones (if theres a more performance-friendly way, let me hear it!). Enemies, chests, dynamic objects, secrets and everything else should be added, too, when creating a room. Since Ild like to keep it on minimalistic hack'n'slay (not too heavy), many sprites are going to be generated each room (thinking about a minimum of ~10-15 objects and a maximum of ~20-25 sprites (or less, if the performance-impact would be too big in general... the targetted platform are mobile-devices)).

    So, if anyone got improvements on my sketch, before I start to script it, please tell me here. I'm thankfull for every idea or tip to make my life easier!

    Have a great weekend

    Proxy

  • TMAJA thanks that worked

    i have else problem

    i add other variables

    recoil (how fast enemy gun shoots)

    burst (how many projectiles spawn when timer is 0)

    Your timer for each enemy working

    but recoil and burst is for all enemy at once

    Please download again this same capx

    Or someone else please

    Hi IGDev,

    (Im on my mobile, cant load/open your project, so I hope I can help otherwise ;D )

    you could try giving your enemy objects instance variables (or if you are working with families, give it to them), one for each. With a "for each" event you could check every enemy on your layout; reduce their individual variables by X every X triggers (or seconds, however you want it to be). A third condition inside your for-each loop could check if the variable is = X (compare instance variable) and then trigger other events (hope you got how I mean it ).

    But be warned (if you have not had performance issues ever with C2), speaking about mobile games, "Every X seconds"-events *may* have a *huge* impact on cpu usage; if you plan having many enemies onscreen you possibly need an another solution for this (of course it depends on which device you have, its cpu, GHz, etc....).

    Hope I helped. Regards

    Proxy

  • Hi Constructururers!

    My newest creation isn't really a game, nor a template (for a game). It's something that could help anyone anywhen with nearly all possible problems/bugs/issues, totally unregarding what they are scripting/coding.

    What is logging?

    If you have never heared of "logging" or arent sure, if its something software specific, eatable or if it glows in the dark, I can recommend you this article (not from me, Im just too lazy to explain pros and cons (if any...) about logging at this point : http://vasir.net/blog/development/how-logging-made-me-a-better-developer .

    Simple Logging Backend

    (view the 10/10 cover image from above in fullscreen: http://proxy.wtf/_storage/construct2/simple_logging_template/c2_template_logging_backend.PNG)

    What is this template about?

    It offers you a leightweight logging backend; offering 3 log-levels (info, warning, error) into a TextBox and/or into the browers console. It's kept as simple and compact (and understandable) as possible.

    On 27 lines of code (and about 40 lines of comments ) Ive documented every single step (partially with additional informations to make it absolutely (at least I hope so) beginner/noob friendly).

    For who is this template?

    I love using debugging tools - unregarded if its Construct2, PowerShell, C# or any other code-/script/programming language. Its a pain in the back to find an error which occours sporadically or doesnt seems clear at first.

    This template is aimed for beginners/noobs. Ive commented everything (as already mentioned) to make sure, its absolutely understandable. Maybe beside the logging-engine itself this might give a feeling about functions and their parameters (and, of course, working with them) - and maybe some other logic-stuff.

    Features:

    • Logging into browser console and/or TextBox (multiline!)
    • 3 log-levels; info (for example: something triggered), warnings for non-critical issues (for example: chest appeared before a mob was killed), errors (for example: player exits the isolated bossfight area during bossfight before killing the boss (events which will have a huge negative impact on the game; or will break progress)
    • Costumize the used characters for prefixes, also different prefix contents

    ToDo:

    When Ive got time (and people are using this, of course), i might add additional features.

    • UNIX & human-readable-format timestamp
    • Export whole logfile (or a number of rows) as file

    This list may be extended in the future.

    Sidenote:

    Currently, theres only using the tickcount implemented. For me, its good enough to use. As long as it isnt possible to get system time or ask a ntp-server whats going on, without plugins, Ill not implement any other "source of time" for now. Like mentioned above; when Im feeling to, Ill add a "real" timestamping-method.

    This template can be used everywhere and anywhen (sending the source to mars is strictly allowed!). I hope, that some can profit from this template and may learn a bit from the logic behind C2 (if you are an absolute beginner with C2).

    Unregarding if someone uses this or not, every kind of feedback is accepted (and wished) here! In a world without feedback (especially negative responses), everyone would be lost while ending up coding flappy bird clon.... oh, wait...

    Have a great day

    Proxy

    Downloads:

    13.07.2016 | version 1 | initial release

    http://proxy.wtf/_storage/construct2/simple_logging_template/Logging_Template_v1_by_Proxy.capx

    P.S.: my english isnt the best, sorry for that if anything is unclear (how mentioned at least 20 times in the sources comments), feel free to PN me here, or better: just answer to this topic; ill do my best to make things clear.

  • Here's a very simple capx. When you press Esc, the square should turn red. It doesn't work for me, but it does if I change the event to any other key press. Tested in nw.js, Chrome, and Firefox. http://mikelaraman.com/misc/esc.capx

    Hi mikehive,

    I'll check it as soon as Im back home again <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> !

    Cheers

    Proxy

  • Hi mikehive,

    if you can post your capx I can take a look at it. With which browser are you testing it? Also, pressing ESC in YTs fullscreen mode is handled different than in "not fullscreen" things. Maybe try setting your preview browser on NW.js, just to debug the ESC-button.

    Regards

    Proxy

  • Cheers Proxy!

    Ah, I'm new in this (Whole programing) but I learn quickly

    GDrive

    There is my capx.

    Hi again,

    no problem .

    If you got answers you can write me a pm, if Im only and see it, ill write back ;P

    Cheers

    Proxy

  • Cheers SputnikCZ,

    as far as I understood, you want to give the player money and lumber as soon as they unlock the building - not before? The simplest way, which comes in my mind, declare a local bool (or a variable is also possible):

    if amout of buildings < 0 then

    activate group "produce"

    else

    deactivate group "produce"

    ... or in a picture:

    (this should have minimal impact on cpu, because you are not checking something on "every second")

    Hopefully, thats what you needed to know (getting tired...).

    Best regards

    Proxy

  • Hi guys!

    I'm writing my first C2 plugin (better to say, my first (bigger) confrontation with JS).

    I know what CORS is - and already had the one or another meet with it.

    Background info:

    I'm writing a little framework which handles account managing and data storation for a C2 dev. Ive seen a lot questions about accounting, etc. - got a great help days back - and now I'ld like to share my knowledge with anyone who doesnt know how to ajax userdata via php into a mysql db. For that Im rewriting an account managing system (with all its needs, registering, login, "forgot password"-function, token based, "remember me" function, etc..; incl. storing data (preffered as JSON) in the backend). But more to the plugin when its ready to see the light of beta-testers...

    To my problem:

    When I got a simple return...

    <?php
    header("Access-Control-Allow-Origin:*"); // Allow all origins
    
    $InputAction = $_POST["Action"]; // Eventhandler
    
    if ($InputAction == "Register") {
    		echo("-400")
    }
    ?>[/code:25w51riy]
    ... everything works fine. Even if Im extending the whole stuff. CORS is on * in row 2 as you can see (I was told from different sources, that its best to build a func, etc etc... but sources like [url]http://enable-cors.org/server_php.html[/url] also told me, that the one-row is ok. And unless Ive tested it with several scripts (including AJAX cross domain requests out of C2), Im at least sure that it works.
    
    Now, when I extend the source of the serversided script, like...
    
    [code:25w51riy]<?php
    header("Access-Control-Allow-Origin:*"); // Allow all origins
    
    require('includes/config.php'); // Prerequisite
    
    /** Numeric callbacks (!negative values!)
    -200 Registration successful; validation mail sended
    -250 Username OK
    
    -300 Username too short
    -301 Username already in use
    -302 Password too short
    -303 Invalid email address
    -304 Email already in use
    -305 Error while registration
    
    -400 Illegal request
    **/
    
    $InputAction = $_POST["Action"]; // Eventhandler
    
    $InputUsername = $_POST["Username"]; // Requesting username
    $InputMailaddress = $_POST["Mailaddress"]; // Requesting mail address
    $InputPassword = $_POST["Password"]; // Requesting password
    
    if ($InputAction == "Register") { // Action: Register
    	if(strlen($InputUsername) < 3){ // Check Username length
    		$error[] = 'Username is too short.';
    		echo("-300");
    	} else { // Check if username already exists
    		$stmt = $db->prepare('SELECT username FROM members WHERE username = :username');
    		$stmt->execute(array(':username' => $InputUsername));
    		$row = $stmt->fetch(PDO::FETCH_ASSOC);
    		echo("-250");
    
    		if(!empty($row['username'])){ // If username already taken
    			$error[] = 'Username provided is already in use.';
    			echo("-301");
    		}
    	}
    }
    else {
    	echo("-400");
    }
    ?>[/code:25w51riy]
    
    ... (its only a snipped, which could be used as a standalone "give me feedback!"-debug tool) Im getting a 500:
    
    [code:25w51riy]XMLHttpRequest cannot load http://api.proxy.wtf/debug.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.0.14:50001' is therefore not allowed access. The response had HTTP status code 500.[/code:25w51riy]
    
    There is no mistake in the syntax (the http-ui works perfectly; which contains same parts of the script in a single *.PHP) and I cant figure out whats going wrong here. I
    
    Does someone may have an idea whats going wrong here? After about 11 hours of work on the C2 plugin, everything breaks together because of this, driving me nuts....
    
    Have a great day,
    Proxy
  • Hi guys,

    the solution I got is a bit (too) rudimentary (plus very random in duration and questionable in effectiveness, no doubt):

    Does someone know a more accurate way? Im generating a map (dungeon) randomly and the player should be placed somewhere on a walkable spot (the worldgeneration starts in the middle of the generated field). I would like to use that routine also for spawning enemies, interactive objects, stairs, etc.. With my "solution" it *might* be possible to place the player (somewhat between instant and X minutes, depending on whats generated).

    Does someone can offer a player- and time-friendlier solution?

    Have a great day,

    Proxy

    Edit: also thought about extracting the JSON of the tilemap and search in that for the ID I want, but this likely will take the first match every time - so the player will always start in the top left corner, what I dont really want - and placing the enemies with that way would end in a massacre (without an exit )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just curious if you worked on this/there are updates?

  • Proxymity Thank you for your answer! I'll do it that way now, works fine. But out of curiosity: Would it be possible to write that into a .txt file?

    Glad I could help <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";-)" title="Wink">

    Hmm.. lets say: there has to be a way to download a *.txt file. Personally I didnt needed that before, so I cant tell you exactly how to <img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question">

    But what I sure can say is, that you could modify the "WriteLog" function to additi-break- while writing this I took a look at the browser manual, maybe the "Invoke download of string" or "Invoke download" will fit your needs (https://www.scirra.com/manual/110/browser).

Proxymity's avatar

Proxymity

Member since 24 Oct, 2014

None one is following Proxymity yet!

Connect with Proxymity