Register
Email: Password:
Forum » General Programming thread
  • « previous
  • 1
  • 2
  • 3
  • » next
  • General Programming thread

    Anonymous1157 4 years ago
    MageKing17 said:
    Can anyone guess what this is? (Snip)
    It looks like pseudocode script to turn keyboard input into character movement, unless the script isn't so pseudo and you've posted this because you wrote the interpreter, or something like that. It's an interesting idea either way.

    Edited 4 years ago
    #
    MageKing17 4 years ago
    Anonymous1157 said:
    MageKing17 said:
    Can anyone guess what this is? (Snip)
    It looks like pseudocode script to turn keyboard input into character movement, unless the script isn't so pseudo and you've posted this because you wrote the interpreter, or something like that. It's an interesting idea either way.
    The latter. This is a sample of a character script from the upgraded version of my sidescroller project. The player is handled as a state machine, and various inputs cause transitions into other states (and certain outside forces can force a state change... like being hit shoves you into the "hurt" state, and being hit in the air shoves you into the "knockback" state, unless you've got immunity to knockbacks). You may or may not have noticed that the "evade" key has two state changes; these are not both executed. Either the first one succeeds, or the player lacks backdash capability, in which case the second one is attempted. If the player lacks superjump capability as well, the script stops caring, because nothing is supposed to happen then.
    #
    ville 4 years ago
    Ooh! It's a new platformer! Screenshots?

    MageKing17 said:
    Can anyone guess what this is?

        state stand (ground):
    if not __prevstate__ == "walk": anim.skip("stop")
    if not __prevstate__ == "duck": anim.skip("standup")
    on key[left] and not key[right]:
    facing = "left"
    state -> walk
    on key[right] and not key[left]:
    facing = "right"
    state -> walk
    on key[down]: state -> duck
    on key[up]: state -> charge
    on ~key[jump] and key[jump]: state -> jump
    on ~key[attack] and key[attack]: state -> attack
    on ~key[evade] and key[evade]:
    state -> backdash
    state -> superjump
    #
    MageKing17 4 years ago
    ville said:
    Ooh! It's a new platformer! Screenshots?
    Well, actually, it's an old platformer with a new engine.

    Sadly, the new engine doesn't have any screenshots (unless you want to see a screenshot of a developer console... which I'm sure you can visualize just fine), but here's an eye-hurting screenshot from the old one (and if anybody wants to know more about the old engine, I actually put a page on my TiddlyWiki, which you can find here: http://deviance.duckish.net/tw/index.html#[[Sidescroller%20Engine%20Test]]).

    (The reason I made that a full link is because that URL makes the BBCode parser go crazy if I stick it in a [url=] block.)

    Edited 4 years ago
    #
    Vacuus 4 years ago
    Looking for some world building here...

    Basically I'm developing a little 2D iso RPG in the theme of Baulders Gate, Arcanum, Icewind Dale etc etc...

    The stage I'm at ATM is procedually generating the world itself - or atleast configuring the engine to do so properly.

    Basically I have an outline for a game map that defines the coastline and other features such as major lakes etc. (it's all flat at this stage -- but I can generate a heightmap later). Rivers etc. can be generated (I'm thinking something with fractals?) at a later date.

    What I'm wondering about is the area inbetween and getting it to generate to a matching set of conditions.

    The simpleton in me says I should just gift wrap the entire coastline in a convex hull and then subdivide the crap out of it (effectively into the same tiles that will be skewed and used on the map proper), determining which is coast and which is not can be done by checking if the convex hull runs through that subdivision or not (resulting in a somewhat jagged coastline depending of the complexity of the detection algorithm used, but given the viewport it's unlikely to be an issue). I could then just declare that all random 'tiles' get transformed into a random tile within a specific range based on the region.

    You could even take that one step further and using something like markov chains to better determine what goes where, although this would depend on sufficient input which basically means hand crafting a world (albeit a smaller one) anyway.

    But I dunno, I'm just not really happy with that solution. It feels kinda 'clunky' to me for each region to depend on a set of arbitrary tile ranges on the map itself which would form unatural patterns. Being that the 'map' is purely black&white, I guess I could just skew that and use it as some sort mask on which to place the terrain. That would absolutely have to be combined with an appropriate height map in order to work though.

    So like I said, I'm not sure... Any other thoughts?
    #
    MageKing17 4 years ago
    Well, Baldur's Gate just had specifically-created maps. I take it this option is a little more work than you want to do?
    #
    Vacuus 4 years ago
    Not really, it'd actually be easier to just do specific maps rather than randomise everything.

    That being said -- I'm still planning on having specially created areas (they really are essential from a story perspective) which are going to fill in certain areas on the map that are left blank.

    I want to randomise it as much as possible because the world is meant to be harsh, unforgiving and {most importantly} unknown. I dont want players to go back through it a second time and think that they know every twist and turn.

    I'm open to alternatives to tile maps, by the way. They just seemed like the simplest way to quantify -- and hence randomise the landscape.
    #
    E_net4 4 years ago
    Heightmaps are not such a pain to create if you use a Perlin noise library... otherwise, it is. And since you won't be using true 3D, it might just not be efficient enough for your likings. On the other hand, it can easily give you coasts, mountains, rivers and so forth.
    Edited 4 years ago
    #
    Venom31 4 years ago
    RPG... Ok, then, how're you going to make cities?
    #
    Pete 3 years ago
    I HAVE ALL THE POLYGONS



    yes I did wait for someone else to revive the forum before I posted this meaningless post why do you ask

    yes Im aware the last post in this thread is 9 months old frankly it could use some attention

    #
    MageKing17 3 years ago
    Have all the polygons!

    So, I tried running my Sidescroller Engine Test on my Pandora and found the opening room ran at an amazing... 12 FPS. So I decided to see if using a more optimized object manager would improve performance. And it did! ...15 FPS. Granted, this is the "old & terrible" engine instead of the unfinished "new & fancy" engine, but I'll be honest and say I don't think the new engine will wind up being more efficient than the old one. I don't think the scheme my engine is based on will work for the Pandora at all. Not without overclocking, anyway. Perhaps switching to a tile-based system is better all around; it would certainly simplify collision detection, which is probably the biggest slowdown. On the other hand, I'd need some tiles to make maps out of.
    #
    E_net4 3 years ago
    Pete said:
    I HAVE ALL THE POLYGONS

    <pic>


    Into this topic: Narvius and I are working on something rather curious and useless. It involves little creatures living in your computer. Hope to get it done some day.

    Oo, oo, check this out. It's cracking me up.

    Edited 3 years ago
    #
    NeoGangster 3 years ago
    E_net4 said:
    ...
    Oo, oo, check this out. It's cracking me up.
    I can't think of a scenario where this would be useful.
    #
    E_net4 3 years ago
    NeoGangster said:
    E_net4 said:
    ...
    Oo, oo, check this out. It's cracking me up.
    I can't think of a scenario where this would be useful.
    Perhaps you missed the comments on the question.
    #
    Pete 3 years ago


    Now I have less polygons hooray

    that should not have taken six hours
    but I wanted to share anyway
    because I have nothing better to do
    maybe I should look up how these things are usually done before I start butchering code next time
    cant even remember how to do punctuation anymore
    or capitalisation
    or how to type like a human being


    (Yeah, six hours and the grand result is a terrain that looks almost exactly the same. Woop dee doo.)
    #
    E_net4 3 years ago
    What're you using anyway?
    #
    Pete 3 years ago
    E_net4 said:
    What're you using anyway?
    C# + OpenGL... with a uni-supplied wrapper that does very little. Tis a class project.
    #
    Narvius 3 years ago
    I just spent four hours writing stuff in the esoteric language FALSE.
    Four. Hours. That I didn't notice passing by.

    Did I mention that that's also time I don't have right now?

    I need to brag, though:
    Read integer from stdio, print binary form to stdout.

    1_[^$1_=~][]#%1 0@[$1_=~][@$10*@'0-$0 10@@\$@\>~\@\>&$[%@*@+@1_]?~[\%%\@]?]#%\%
    $1 0@@[\$@$@\>][2*@1+@@]#%%1-1\[$0>][1-2@*\]#%[$0>][$@$@/$1=$["1"%%\$@\-1_]?~["0"%]?\2/]#%%

    It's slightly suboptimal at places, because I replaced... "subroutine calls" with inline code. But it works. Unless you feed it garbage.

    Good. Luck. Deciphering it. And because I'm nice I even put a newline at the most important logical demarcation point!
    (also, interpreter)

    [Edit]
    The version above actually has a retarded bug (16 -> 000). I could've fixed it but it would've been bloated beyond recognition then. So, here's the clean, relatively nice version:

    b [@@\$@\>~\@\>&] \: { #2 < #1 & #1 < #3 }
    c [\$@$@\>] \: { #1 > #2, non-destructively }
    l [l;\l:\1 0@@c;[l;*@1+@@]#%%\l:] \: { Log[#2](#1), rounded up }
    p [p;@p:\1\[$0>][1-p;@*\]#%\p:] \: { #1 ^ #2 }
    g [1_[^$1_=~][]#%1 0@[$1_=~][@$10*@'0-$0 10b;!$[%@*@+@1_]?~[\%%\@]?]#%\%] \: { Read num from stdin }

    g;!$$$2l;!2\p;!=["1"]?2l;!1-2\p;![$0>][$@$@/$1=$["1"%%\$@\-1_]?~["0"%]?\2/]#%%

    Edited 3 years ago
    #
    Pete 3 years ago
    So occurs to me Ive never actually shared the results of my bumbling endeavours into 3D rendering and bloody well Ive put enough work into this that someone will damm well at least see a screenshot of it if nothing else



    (download)
    Some controls : WASD (guess), shift(run), I/K (time control), N/M (FOV control), O (wireframe), L(hide mesh)

    (visual studio project with sources if anyone wants to see this mess of uncommented code)

    #
    Narvius 3 years ago
    So... I wrote a quine in Befunge-98. Because why not.
    0>:a:+`a*j:0g,1+1jf<@

    [Edit]
    I out-golfed the code on the esolangs wiki, but lost to Rosetta Code. Meh.

    Edited 3 years ago
    #
    MageKing17 3 years ago
    I'm currently working on a puzzle game; one of the first things I had to write was a parser for level files. Anybody else had to parse a whole lot of ambiguously-formatted data? It's a bitch and a half, but I actually got it working on the first day; everything since has been focusing on the even-bigger annoyance that is UI coding. :/
    #
    Forum » General Programming thread
  • « previous
  • 1
  • 2
  • 3
  • » next
  • Post Reply


    Your email:
    Your name: