00:00
00:00
Newgrounds Background Image Theme

apollonx just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

The Flash 'Reg' Lounge

3,046,806 Views | 60,186 Replies
New Topic Respond to this Topic

Response to The Flash 'Reg' Lounge 2014-01-23 17:07:07


At 1/23/14 07:29 AM, MSGhero wrote: int(Math.random() • 8) == 0 is what I was looking for. As3's random seems to randomly have random behavior, like randomly not picking from a random range of numbers for some random reason.

Well it is a psuedo-random number generator, so if you run it long enough you will see patterns. Computers are just incapable of generating true random numbers (it wouldn't make any sense for them to be able to).

At 1/23/14 11:50 AM, Luis wrote: It is that mouse. I still draw with a mouse so i need a big mousepad.

'Sup fellow huge mousepad user. I'm no artist, but I love using a low sensitivity on my mouse, so I have a big-ass mousepad (eleven inches from corner to corner).

Response to The Flash 'Reg' Lounge 2014-01-23 18:04:58


At 1/23/14 05:07 PM, Diki wrote: Well it is a psuedo-random number generator, so if you run it long enough you will see patterns. Computers are just incapable of generating true random numbers (it wouldn't make any sense for them to be able to).

I'm gonna add a less-random number generator to avoid some of the bs I saw. It's for a medal, getting all 8 things to show, so seeing the same one 3 times in a row is demotivating.

'Sup fellow huge mousepad user. I'm no artist, but I love using a low sensitivity on my mouse, so I have a big-ass mousepad (eleven inches from corner to corner).

My friend plays fps, mainly tribes when it was more popular, so he has a huge one too. I don't have room for one like that.

Response to The Flash 'Reg' Lounge 2014-01-23 18:53:38


At 1/23/14 06:04 PM, MSGhero wrote: I'm gonna add a less-random number generator to avoid some of the bs I saw. It's for a medal, getting all 8 things to show, so seeing the same one 3 times in a row is demotivating.

You mean you're going to roll out your own psuedo-random number generator? If so I wouldn't recommend that. It would be very easy to do incorrectly and make it generate numbers that are even less random.

Response to The Flash 'Reg' Lounge 2014-01-23 19:04:57


At 1/23/14 06:53 PM, Diki wrote: You mean you're going to roll out your own psuedo-random number generator? If so I wouldn't recommend that. It would be very easy to do incorrectly and make it generate numbers that are even less random.

I want numbers to be less random in this specific case. Might just be something simple like get a new number if it's the same as the last number or have more bias for the numbers that haven't been chosen yet.

I found a prng by polygonal that seems faster than normal random.

not like it matters for the rpg but still

Response to The Flash 'Reg' Lounge 2014-01-23 19:25:36


At 1/23/14 07:04 PM, MSGhero wrote: I found a prng by polygonal that seems faster than normal random.

Pretty much anything you find is a PRNG.
You can have a CSPRNG partially seeded by a TRNG, which is quite possibly the most secure you'll get, but slower than all hell.
Then, if you want a really fast "PRNG" you can just do some basic bitwise operations with a given seed.

Take this if you'd like. It's not perfect but it seems to work at any rate.


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-23 21:35:51


At 1/23/14 07:04 PM, MSGhero wrote: I want numbers to be less random in this specific case. Might just be something simple like get a new number if it's the same as the last number or have more bias for the numbers that haven't been chosen yet.

This may be what you were going for with your second idea, but it may be worth doing something similar to what Warcraft III called Pseudo-random distribution, where you decrease the range of numbers that a "thing" corresponds to after the RNG chooses it, and increase the range of a thing after it has gone several attempts without being chosen. Seems like a lot less hassle than making a PRNG.

Also, if it makes you feel less worried about the generator getting "stuck" or patterns forming, swap the ranges that things correspond to. The thing in the 0.5-0.625 range keeps getting chosen? Give it the range 0.0-0.125 instead, and assign whatever was in that range to the 0.5-0.625 range. That probably won't save some unlucky souls from being screwed over regardless, so use it with another system if you use it at all.


Doomsday-One, working on stuff better than preloaders. Marginally.

Response to The Flash 'Reg' Lounge 2014-01-23 21:40:25


At 1/23/14 09:35 PM, Doomsday-One wrote: This may be what you were going for with your second idea, but it may be worth doing something similar to what Warcraft III called Pseudo-random distribution, where you decrease the range of numbers that a "thing" corresponds to after the RNG chooses it, and increase the range of a thing after it has gone several attempts without being chosen. Seems like a lot less hassle than making a PRNG.

Oh yeah...we even talked about that a while ago. Good ol wc3 and dota save the day. Thanks, I'll probably do that and egg's fast prng (which I think is the same as what I linked).

Response to The Flash 'Reg' Lounge 2014-01-23 22:06:11


At 1/23/14 09:40 PM, MSGhero wrote: which I think is the same as what I linked

It's not, but close enough.
The visualiztion reminds me of poor 'ol ECB Tux, though :(

Remember, kids, block-cipher in ECB mode is bad for you

Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-23 23:24:53


(_from[name] as MessageChannel).addEventListener(Event.CHANNEL_MESSAGE, onChannelMessage); do { trace("hi"); } while (!(_from[name] as MessageChannel).messageAvailable); trace("Hello!"); private function onChannelMessage(e:Event):void { trace("Hello again!"); }

No other code is executed.

output:

hi hi hi hi hi hi hi hi hi Hello!

This is driving me absolutely insane.


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-24 13:31:39


Aha! Finally got it all working. Enjoy a mod system if you'd like.

Host.zip contains the classes the host (whatever's loading the mods) uses.
Mod.zip contains the classes the mod uses to contact the host.

Again, requires AS3 Signals library because I'm too lazy to make new classes. Or you could make events if you want portability.

And of course an example usage below.

Host:

public class Main extends Sprite { public function Main():void { ModLoader.ON_READY.add(onReady); ModLoader.loadMod(File.applicationDirectory.nativePath + File.separator + "mods" + File.separator + "myMod1.swf"); ModLoader.loadMod(File.applicationDirectory.nativePath + File.separator + "mods" + File.separator + "myMod2.mod"); ModLoader.loadMod(File.applicationDirectory.nativePath + File.separator + "mods" + File.separator + "myMod3.whateverFileExtensionYouWant"); } private function onReady():void { ModLoader.onReady.remove(onReady); ModLoader.ON_MESSAGE.add(onMessage); ModLoader.addChannel("myChannel"); ModLoader.addChannel("myChannel2"); ModLoader.startMods(); for (var i:uint = 0; i < ModLoader.numMods; i++) { ModLoader.send(i, "myChannel", ["Here", "Have", "An", "Array", "Because", "Why", "Not?"]); } } private function onMessage(modNum:uint, data:ModData):void { trace("Message from mod #" + modNum + " on channel " + data.channelName); trace("Data: " + JSON.stringify(data.data)); } }

Mod:

public class Main extends BaseMod { public function Main():void { if (Worker.current.isPrimorial) { stage.nativeWindow.close(); } ON_CHANNEL_MESSAGE.add(onMessage); addChannel("myChannel"); addChannel("myChannel2"); } private function onMessage(data:ModData):void { trace("Message from host on channel " + data.channelName); trace("Data: " + JSON.stringify(data.data)); sendChannel(data.channelName, {stuff:"You can out anything you want", stuff2:"In the data argument", stuff3:"It doesn't matter"}); sendChannel("myChannel2", {data:["Ohai", "How", "Are", "You?"]}); } }

Both of these examples are assuming they're made in AIR, so if they aren't stuff like stage.nativeWindow won't work and all that happy fun stuff. Also I don't think traces work in a mod when loaded from the host, though I might be wrong.

When sending ByteArrays, make sure the shareable property on them is true.
mods are given the same permissions and folders/etc as the host, so think of the mod as being the host when doing stuff like File.applicationDirectory and such.

In some versions of FlashDevelop Workers are a bit broken.

Other than that, yeah, it seems to work quite well which is a big surprise :D
(If you do decide to try it out, please tell me if there's bugs D:)


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-24 14:05:35


Why is there a ModLoader.ON_READY and ModLoader.OnReady? They look like they're referencing the same thing.

Response to The Flash 'Reg' Lounge 2014-01-24 14:20:41


At 1/24/14 02:05 PM, Diki wrote: Why is there a ModLoader.ON_READY and ModLoader.OnReady? They look like they're referencing the same thing.

That was my mistake, it's supposed to be ModLoader.ON_READY.remove(onReady);

I also noticed I left a ton of debug stuff in the BaseMod.as in the form on FileStream.open in the constructor, I recommend removing that >.>
What would happen if I replaced the zip file in the dumping grounds? Would it still be the same download link?


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-24 14:22:17


At 1/24/14 02:20 PM, egg82 wrote: What would happen if I replaced the zip file in the dumping grounds? Would it still be the same download link?

If you click edit and upload something new, yes. If you just upload a new file, no.

Response to The Flash 'Reg' Lounge 2014-01-24 14:30:20


At 1/24/14 02:22 PM, MSGhero wrote: If you click edit and upload something new, yes. If you just upload a new file, no.

Quick reply, thanks :P
In that case, It's sneakily fixed.

If you're curious, the reason I posted this whole thing is because the ability to mod is becoming a fairly big thing in games, and I haven't been able to find anything like what I developed for AS3 yet so I made it myself.
My hope is that someone will take my idea and fix anything that's broken and make it usable in a release environment because right now it's got a lot of caveats (like another, for example, is that it assumes mods are on the local File System when you can very easily change it to use online sources as well as local ones)


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-24 23:32:15


My home command center:

The Flash 'Reg' Lounge

Response to The Flash 'Reg' Lounge 2014-01-24 23:37:13


At 1/24/14 11:32 PM, BoMToons wrote: My home command center:

Also, here's a virtual tour I made when I first decorated!

http://bomtoons.com/nickofficetour.html

Response to The Flash 'Reg' Lounge 2014-01-25 00:05:52


At 1/24/14 11:32 PM, BoMToons wrote: My home command center:

Is that a little desktop microphone I see on the desk?


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-25 02:57:49


At 1/22/14 11:23 AM, egg82 wrote: What's the recommended way, then? I couldn't think of anything better than "add your own header"

No, no I'm saying nobody should be using serialization (i.e., writeObject) because I thought you were going the "hackish" way

If I needed to do that, I would probably combine packets and have the server split them where the first one's supposed to end.

Wait you're not doing that already? Also you didn't understand what I was referring to, this will help out (someday?) but tricks like these probably aren't used since dialup is dead (still helpful where bandwidth needs to be maximised and used wisely!)

rather than:

writeByte(isTrue ? 1 : 0) writeByte(isTrue2 ? 1 : 0) 2 bytes

you squish as much flags into one byte:

flag = 0 flag |= isTrue ? 1 : 0 flag |= isTrue2 ? 2 : 0 ... 1 byte up to 8 flags

..and then read it off as

flag = readByte(); isTrue = (flag & 1 != 0); isTrue2 = (flag & 2 != 0);

Also regarding squishing all packets into one buffer

This is how a typical server/client SHOULD process packets (in pseudo code), anything other than this (this does not apply to MINA, Java's NIO, XSocket or the likes) is what I would call shortcuts:

while bufferLength - bufferPointer > 0 read packet process packet clear buffer

If you're constantly flushing out packets one by one in some real time application then you're doing something wrong, it would only make sense if the application itself isn't real time or you're using an async/non blocking socket (even then you should be buffering all incoming packets if it's a real time application).

Response to The Flash 'Reg' Lounge 2014-01-25 10:50:38


At 1/25/14 12:05 AM, egg82 wrote:
At 1/24/14 11:32 PM, BoMToons wrote: My home command center:
Is that a little desktop microphone I see on the desk?

Yes it is! I even have a spitguard in the drawer next to it!

Response to The Flash 'Reg' Lounge 2014-01-25 12:19:39


At 1/24/14 11:32 PM, BoMToons wrote: My home command center:

You have some paper to left from your desktop. A whole pile of them.
I'm interested what you use those papers for.

Response to The Flash 'Reg' Lounge 2014-01-25 13:58:18


At 1/25/14 02:57 AM, slugrail wrote: No, no I'm saying nobody should be using serialization (i.e., writeObject) because I thought you were going the "hackish" way

Nah, I don't write full Objects, there's no point. String and numeric data types (also the occasional boolean) are all I've been using. I do also use a compression algorithm on the packet before I send it out, it should help a small degree.

useful stuff

I've certainly been using not-efficient means of sending data, then (not inefficient, but not entirely there, either)
The problem I'm facing is since the entire game is made up of mods I have no idea how I'm going to handle other people's decisions on what they send through. I was thinking about holding sending data until a certain point (either time or size, or both) but I think it might be just better to slap on a "caveat emptor" label to all mods and let the community decide what's good and what's not.
(assuming there is a community or even other people)


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-25 14:00:27


At 1/25/14 10:50 AM, BoMToons wrote: Yes it is! I even have a spitguard in the drawer next to it!

I've never heard a pop shield called a spit guard before xD
Is that little mic powerful enough to require a full pop shield, or would a little windbreaker over it be good enough?
(Also you should invest into a desktop boom, they help with the back problems when talking into the mic :P)


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature

Response to The Flash 'Reg' Lounge 2014-01-25 18:06:28


At 1/25/14 02:00 PM, egg82 wrote:
At 1/25/14 10:50 AM, BoMToons wrote: Yes it is! I even have a spitguard in the drawer next to it!
I've never heard a pop shield called a spit guard before xD
Is that little mic powerful enough to require a full pop shield, or would a little windbreaker over it be good enough?
(Also you should invest into a desktop boom, they help with the back problems when talking into the mic :P)

https://www.google.com/search?q=microphone+spit+guard

It's a pretty good sized mic, it just looks small in the pic.

I don't record enough to need a big old boom, but it would make my setup look more legit... :-P

Response to The Flash 'Reg' Lounge 2014-01-25 18:10:30


At 1/25/14 06:06 PM, BoMToons wrote: https://www.google.com/search?q=microphone+spit+guard

Found this in the image results for that search. Should work pretty good!

Response to The Flash 'Reg' Lounge 2014-01-25 18:17:48


At 1/25/14 12:19 PM, kkots wrote:
At 1/24/14 11:32 PM, BoMToons wrote: My home command center:
You have some paper to left from your desktop. A whole pile of them.
I'm interested what you use those papers for.

Desk Inventory:

1. Books
- What the Dog Saw - Malcom Gladwell
- The Botany of Desire - Michael Pollan
- Flowers for Algernon - Daniel Keyes
- Einstein - Walter Isaacson
- Go Forward With Faith - Sheri L. Dew
- Duma Key - Stephen King
- Steve Jobs - Walter Isaacson
- The Fountainhead - Ayn Rand
- Atlas Shrugged - Ayn Rand
- The Road to Serfdom - F.A. Hayek
- Welcome to the Monkey House - Kurt Vonnegut

2. Samurai Jack Figurine
3. All 4 Castle Crasher Figurines
4. Bender Head full of Futurama DVDs
5. Canon t4i DSLR
6. 2 Cups of pens and pencils
7. Receipt for new desktop comp
8. Invoice for a school stage rental
9. Mortgage statement
10. Checkbook
11. 1099 Form
12. MC Escher Art
13. Calvin and Hobbes Comic I edited to have the faces of me and my cousin playing a game we invented similar to Calvinball
14. Toenail Clippers
15. A bronze sculpture I made in a college sculpture class
16. A plastic bag of discs and install software that came with my new desktop
17. A bunch of check stubs
18. A stack of DVD-Rs on a DVD holder
19. A list of people I want to write snail-mail letters to
20. A piece of paper with weight-loss goals for the next 8 weeks
21. A super Meat Boy Plushie
22. A wooden block puzzle
23. A baggie of wheels for a cabinet or something

Response to The Flash 'Reg' Lounge 2014-01-25 18:27:04


At 1/25/14 06:10 PM, Diki wrote:
At 1/25/14 06:06 PM, BoMToons wrote: https://www.google.com/search?q=microphone+spit+guard
Found this in the image results for that search. Should work pretty good!

Ha ha, I'm imagining that covered with dried spittle on the inside...

Response to The Flash 'Reg' Lounge 2014-01-25 18:50:59


The first option in the game series. Down with linear plots! Well...more so in the next game probably, kinda too late to change the story now.

The Flash 'Reg' Lounge

Response to The Flash 'Reg' Lounge 2014-01-25 21:16:27


At 1/25/14 06:50 PM, MSGhero wrote: The first option in the game series. Down with linear plots! Well...more so in the next game probably, kinda too late to change the story now.

I imagine an open world game where implementing non-linear plot would require, like, a special system which works on story nodes and connects them to each other depending on events occurring in the game.
If your story nodes connections are preset and unmodifiable at run-time, you can talk about linear plot.

I do not see how resting or not resting at an inn is a choice which affects plot branching.

Response to The Flash 'Reg' Lounge 2014-01-25 22:30:58


At 1/25/14 09:16 PM, kkots wrote:
At 1/25/14 06:50 PM, MSGhero wrote: The first option in the game series. Down with linear plots! Well...more so in the next game probably, kinda too late to change the story now.
I imagine an open world game where implementing non-linear plot would require, like, a special system which works on story nodes and connects them to each other depending on events occurring in the game.
If your story nodes connections are preset and unmodifiable at run-time, you can talk about linear plot.

I do not see how resting or not resting at an inn is a choice which affects plot branching.

I was kidding. It'll affect the plot in the next game most likely. I was thinking about using a doubly linked list of dialogue nodes, where some are linked to multiple next nodes based on the dialogue choice and in-game events. Something like that, doesn't matter right now.

Response to The Flash 'Reg' Lounge 2014-01-25 23:42:59


What kind of computer chairs do you guys use ? I need to get a new one. My ikea chair is destroying my spine. :P