Author Topic: Flow  (Read 9475 times)

0 Members and 1 Guest are viewing this topic.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Flow
« on: December 24, 2012, 10:06:45 am »
You might have played Flow, one of the most popular games on Android and idevices.
https://play.google.com/store/apps/details?id=com.bigduckgames.flow
I decided to make a port of it.  :)
Now, there's only 1 level in it now, hard coded. (The first 5x5 level on the Bonus Pack.) I'll make a level editor later and ask for people to help me make levels.
The game is for 5x5, and I used different sprite shapes for lack of color.

I can't make a screenshot now (haven't got tilp working yet). To anyone who has time to download this and compile it with Axe and make a screenshot of it, please do so and post a screenie! Please!
I only included the source, you'll have to compile it with Axe.

EDIT: Of course I forget about controls and additional details. That's just me.
Arrow keys to move around, [2nd] to select something, then you can move its line w/ arrow keys. You can't move outside, into another line, or into the base blocks. [Alpha] to release. You release either above, below, right, or left of the block to complete it. It autocompletes.
« Last Edit: December 25, 2012, 08:15:53 am by dinosteven »

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Flow
« Reply #1 on: December 25, 2012, 08:26:02 am »
Sorry that this is a double post; anyways, I think I can make 8 byte levels, so a 20 pack should be 160 bytes, plus some for the name - ~200 byte level packs and a ~4000 byte game.
Time to reorganize my code!

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Flow
« Reply #2 on: December 25, 2012, 08:56:53 am »
Wow, that's small enough :p
Now start making it xp
I'll play it when i have time... Atm playing it on ipod xD

Ok much luck and i hope you can create something cool :p
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline TheNlightenedOne

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 427
  • Rating: +16/-1
    • View Profile
Re: Re: Flow
« Reply #3 on: December 25, 2012, 09:12:44 am »
That's not too bad of a size, and don't forget that you can always optimize later. I'm sure this'll be awesome!
"Eris" (Ndless 3.1)
"Keto" (Ndless 3.1)
"Luna" (AMS 3.10, HW4)
"Aurora" (2.55MP)

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Flow
« Reply #4 on: December 25, 2012, 09:27:47 am »
Thanks! Does anyone know how to input an appvar name? I'm planning on having that level default and let people load their own level pack. Can I use the input command or do I need some other text input system? (Never used input command)
EDIT:
For my own use:
Red = Pic1 = CDEF
Yellow = Pic2 = GHIJ
Blue = Pic3 = KLMN
Green = Pic4 = OPQR
« Last Edit: December 26, 2012, 12:07:24 pm by dinosteven »

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Flow
« Reply #5 on: December 25, 2012, 12:52:20 pm »
you can use input, but it's not really worth it, as it looks a bit awful. i and a few others have made and pasted custom input routines around here somewhere.
* shmibs goes to look.
basically, though, the idea that the majority use is to clear out 10 bytes at the beginning of some free ram area (L1, etcetera), use the first of those to store the header that says which sort of variable it is (the "pgrm" token, the "appv" token, etcetera), have a constant string somewhere that maps key values pressed directly to letter values (i.e., L has a getkey value of 21, so the 21st element in the string would be the "L" token. then you would have a "getkey->var" line and insert the var'th element of your string into the next empty position in your free ram area).

it's a bit more complicated than that in reality, because the getkey values for letter keys do not start at 0 (the smallest is W, at 11), so you'd have to use var-11 instead of just var to get the proper string position, there are values outside the bounds of the letter key section that you'd have to ignore (numbers smaller than 11 and greater than 47, the value of A), so you'd have to have a "If var>10 and (var<48)" check, or something like that, before inserting values, and there are several numbers in that range which don't have a corresponding letter value, so you'd have to deal with those as well. the easiest way i know of is to insert null bytes into your string at those positions (i.e., your string would look something like: "WRMH"[0000]"?θV  ...). then, rather than using a variable to keep track of the next empty position in the string, you can use the length( command. because length( checks up to the nearest null terminator, inserting a null byte at the end of the string won't change the length, so the next key pressed will insert to the same position.

lastly, if you want to have lowercase letters and numbers as well, you can use one really long string that is three concatenated together ("WRMH"[0000]"?θV  ... "wrmh"[0000]"?θv ... [000000000000]"36 ...) and then have a variable which is multiplied by the total length of the first string and added to var, so setting that variable to 0 would select from upper case, 1 from lower case, and 2 from numbers.
« Last Edit: December 25, 2012, 01:08:47 pm by shmibs »

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Flow
« Reply #6 on: December 25, 2012, 01:29:47 pm »
I've found a better way, instead of keeping track of letter arrangements, would be to keep track of the key values. That way you can have one uninterrupted array of key values, the first element being the getKey that matches the letter A, and so on. Then you can just simply use inData(getKey,data(...))+65 to retrieve the ascii value of the letter :D

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Flow
« Reply #7 on: December 25, 2012, 01:48:49 pm »
that's good =D. how would you incorporate numbers and special characters into that, though? theta would be an annoying one to handle, for example, because it doesn't change between upper and lower case. would you just have different data sets for the three different states (upper, lower, num)?

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Flow
« Reply #8 on: December 25, 2012, 01:57:08 pm »
Well theta comes right after Z in TI's ascii set, so that's not a problem. You'd need a different data set for numbers, but for lower case you can add a different number instead of 65 (I think 97 points to lowercase a). Other special characters are a bit of an issue, but if you're just wanting to input something like an appvar name it's not a big deal.
« Last Edit: December 25, 2012, 01:57:37 pm by squidgetx »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Flow
« Reply #9 on: December 25, 2012, 05:18:37 pm »
What is Flow?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Flow
« Reply #10 on: December 25, 2012, 06:55:58 pm »
Well theta comes right after Z in TI's ascii set, so that's not a problem. You'd need a different data set for numbers, but for lower case you can add a different number instead of 65 (I think 97 points to lowercase a). Other special characters are a bit of an issue, but if you're just wanting to input something like an appvar name it's not a big deal.

if you are in lower case mode, though, you'd have to either use a special case for theta or have a separate data set. the same thing is true for ?, :, and space, but it's still probably better, though not as clean, to have checks for those beforehand instead of using another data set.
« Last Edit: December 25, 2012, 06:56:52 pm by shmibs »

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Flow
« Reply #11 on: December 25, 2012, 09:46:30 pm »
https://play.google.com/store/apps/details?id=com.bigduckgames.flow
Flow is a super-addicting game where you connect things of different colors with pipes. You can play it on a computer here: http://moh97.us/flow/
I looked at ztrumpet's Jump! code and found some text input code. It works.
So after I get the name string, how do I access the data from it? You have to store something like "appvTITLE"->Str1 and then GetCalc. I know how to do that - I used it in my Bounce game - but how do I add the "appv" part?

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Flow
« Reply #12 on: December 26, 2012, 08:49:58 pm »
like i said, use a freeram area. you don't need to store the name to an Str, and that wouldn't allow you to use dynamic input, as that hard-codes the string in your program at compile time. in order to do it dynamically, you would need to do something like 21->{L1} (21 is the value that axe inserts when you use the appv header token), put your name in bytes L1+1 onward, making sure that there is a null terminator ([00]) at the end, so it knows where the end of your name is, and then do something like Getcalc(L1).

also, you should really use squidget's method; the code is much smaller and neater.
« Last Edit: December 26, 2012, 08:50:31 pm by shmibs »

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Flow
« Reply #13 on: December 26, 2012, 09:09:49 pm »
Now, there's only 1 level in it now, hard coded. (The first 5x5 level on the Bonus Pack.) I'll make a level editor later and ask for people to help me make levels.

There really shouldn't be a need to have people make levels. You can generate them with a little bit of topology (well, more than a little).
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Flow
« Reply #14 on: December 27, 2012, 08:43:42 am »
I suppose I could possibly generate random levels, but the original game has level packs.  I also have no idea where to start in making a random level generator.