topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • July 17, 2019, 11:34 PM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - p3lb0x [ switch to compact view ]

Pages: prev1 [2] 3 4 5 6 7 ... 17next
26
Would be possible, but I am not sure what reddit/quoras policies are with regards to scraping.

27
Living Room / Re: good Videos [short films] here :)
« on: August 23, 2017, 11:07 AM »


I laughed (political commentary)

28
Added Naudio to the project, should hopefully be able to play mp3 files now.

edit: Also stops sounds when you press the stop button

edit edit: Also just noticed that that killed the single shot playback. Hurh durh, give me a second

edit edit edit: Should be fixed now

edit edit edit edit: Added a small icon as well

29
The only issue I've had so far is that the program only utilizes .wav files, which meant I couldn't use the audio file I had originally planned on using.  This was no problem though as I just had to select a different audio file.

I'll look at using NAudio to allow playback of files other than wave at some point in the foreseeable future.

30
Good to know! I have been wondering though, what is it used for? I am guessing either idle games or some sort of error notification.

Also any usability upgrades you can think of while you have been using it?

31
Living Room / Re: Interesting "stuff"
« on: August 08, 2017, 06:17 AM »
Maybe? Anyone care to try it?

32
Living Room / Re: Interesting "stuff"
« on: August 07, 2017, 08:58 PM »
I am gonna have to guess vodka wouldn't work. You'd need something that can burn by itself, 40% alcohol doesn't ignite unless heated up.

33
Do tell if any glaring bugs occur. I'll probably fix it if it isn't too time consuming. Feel free to drop a few bucks to DC or me using the donationcredits system if you feel like it (Though don't feel compelled or forced).

34
Developer's Corner / Re: Your First Programming Language vs Now
« on: July 17, 2017, 10:33 AM »
What was your first programming language?
I think the first programming language I really did anything in was Lua for creating mods for the game Cortex Command.
Amounting to:

Eventually moved on to PHP for programming class in high school (and hating it immensely) and Assembly for the electronics class (though I used C for the final project)
This translated well into Assembly, then C, then C++ and C# at university.

Can you remember a snippet from that language?
Not really, I do dabble every now and then in Lua for various reasons (WoW interface mods being the latest IIRC)

What's your current language of choice?
I've become really partial to C# because of the convenience of having most common things handled for you through the .NET framework. And the syntax is pleasing to me. C++ is my bae, though.

How would you rewrite that snippet in your current language?
If I had to rewrite something similar to the Brolands mod in C# I would definitely take advantage of the OOP paradigm.
Here is the single file I had for pretty much all code used. Note uneven indentation, barely any refactoring of code blocks to functions and pointer being used instead of reference as Lua has no pointers.

35
DC Gamer Club / Re: Factorio - Automate All the Things!
« on: July 15, 2017, 04:05 PM »
One extra small thing to shove into Factorios already large pot of praise. I bought the game and sent the developers a small encouragement email and apology for pirating the game earlier (The Demo wasn't a good showcase of the late game in my opinion, and from what I heard). They responded humbly and thanked me for the praise. Definitely seem like nice and listening people.

36
It's very rough, just as soon as I figure out how to actually package it, I'll put it up. Sourcecode as well (probably gonna do a bit of clean up first).

Here you go, binary is in the root of the rar and source code is in the directory. It IS made using C# and .NET v4.5.2. So you'll need to get the redistributable from Microsoft if you don't have it already. In case you're running Linux it would have to be ported to mono or something, and I don't have that installed at the moment (and I am using WPF, so UI would have to be redone).

Instructions:
Select a sound
Select a color (no color picker, wasn't as trivial to do as the other stuff)
Select retrigger delay (How long it will wait before triggering again, set it to 0 for only triggering once)
Select a rectangle to "look" in (Might be a bit fidgetry, I think I accidentally set the "drag" area on the border of the rectangle, which can be a bit hard to hit).
Then hit start.

Notes:
The retrigger delay is not timed perfectly, don't expect it to be.
I am not sure what bugs there are if any, if there are any they shouldn't be bad for your PC.
Only wave sound files can be played. I just used what was built into .NET, I saw that I might have been able to use some Windows Media Player dependent calls, but I didn't.

Improvements:
Most of the things you mentioned like multiple regions, different colors, sounds, etc
Better UI
Fix the dragging of the selection window (maybe add a cancel as well? At the moment you can only accept new areas if you accidentally hit the selection for it)
Tasks are probably being used inappropriately, as I haven't done any desktop application GUI work in ages and probably forgot a lot of things.
Change the sound player to something that can accept more sound types.
Maybe add tolerance for colors?

Put it through VirusTotal: https://www.virustot...analysis/1500138024/
Seems I am getting a false positive for git. And maybe because I am doing some pointer manipulation.

37


I have made this, is this about what you wanted in its simplest form?

edit: At the moment it can only play wave files, but that can pretty easily be changed, multiple files or checks isn't possible with how I set it up and the program would have to be done very differently (Although that is entirely possible to do with the code I have, I am just not that great at UI programming)

edit edit: I haven't tested it with very large resolution squares. Only in the 250x250 area. I am fairly certain that it won't perform very well at larger resolutions as it is checking every single pixel for a value at a frequency of 20 times a second.

edit edit edit: I also haven't tested it with multiple monitors as the monitors I have at the moment are way too ancient to interface with my videocard. But I am confident that way I am doing things can be fixed to work with multiple screens without too much work if it doesn't already.

edit edit edit edit: Tried it in a fairly large (1000x800'ish) area and it ran with no problems on my machine, but I am running a fairly beefy older generation i7.

38
I got the basic idea down, now I just need to wrap it in a UI.
bacon.pngwat.gif
(Disregard that I am hijacking the console window to draw the captured bitmap, this is just for testing)

I am not sure if I am handling this in the best way possible, I am basically taking a screenshot every X milliseconds, and running through the entire bitmap looking for a pixel with the color you want.

39
Doesn't the fifth amendment of the US allow people to not have to disclose something like a password to their electronic devices?

edit: Herpa derpa, should have read the entire thread.

40
DC Gamer Club / Re: Payday 2 - Steam giveaway
« on: June 08, 2017, 03:01 PM »
What are those moneygrubbing bastards trying to do? I still haven't forgotten the sting from their microtransactions and DLC power creep.

41
N.A.N.Y. 2017 / Re: Donating Prizes for NANY 2017?
« on: December 17, 2016, 11:23 AM »
I have some spare games from humble bundles if that can interest you

42
Community Giveaways / Re: TIS-100, a programming game
« on: December 09, 2016, 09:46 AM »
http://store.steampo...ered.com/app/370360/

It's a game where you solve programming puzzles with a bunch of boxes which each can communicate with each other, but have very limited resources available (I think it's something like 15 or 20 instructions, one register for saving values and one accumulator)

43
Community Giveaways / TIS-100, a programming game
« on: December 06, 2016, 05:39 PM »
Hey! I got an extra copy of TIS-100 due once more, to bundle overlap. If anyone is interested in solving some programming problems with something that can be be described as multithreaded assembly, give me a shout.

44
General Software Discussion / Looking back (Some of your first code)
« on: January 20, 2016, 08:02 PM »
So, I recently stumbled on my first real C project, back from high school. It is pretty bad. And I thought it would be fun to share with you guys and maybe get to see some of the first code you guys did in whatever capacity you can find. I also have code from the first major Lua project I did. Both were written around the same time.

C code:
The below code is for a master microcontroller that calculates game of life and sends the "game" field to another microcontroller that had a charlieplexed 8x7 led display that displayed it. A video of it in action can be found here
comments are translated from danish and I have commented on the comments in parentheses (pastebin link)
Spoiler
#include <htc.h> //PIC hardware mapping
#include <delay.c>
#include <I2CMaster.h>
#include <stdlib.h>
//config bits

__CONFIG(HS & PWRTDIS & WDTDIS & LVPDIS);

/////////// Constants ///////////
#define LEDPLADE8PIN 1 // Defines how many light plates with 8pins that's attached (Not ever actually used, was supposed to be able to handle more than one)

/////////// Bit manipulation functions ///////////

void clear_bit(unsigned char *x, char bitNum){
*x &= ~(1 << bitNum);
}
void set_bit(unsigned char *x, char bitNum) {
*x |= (1 << bitNum);
}
unsigned char get_bit(unsigned char x, char bitNum) {
return x & (1 << bitNum);
}

/////////////// Function prototypes for patterns //////////////////

void glider(void);
void lwss(void);
void toad(void);
void kasse(void);
void blinker(void);
void randompat(void);

/////////// Variables ///////////

////////// GAME OF LIFE ///////////

char LifeGameBuf[2][7];
char LiveCount;
char FirstEvol;
char Pattern;
char NewPattern;

///////////////////////////////////

char i; // Indexes
char j;

char I2C_Address; // Defines the i2c address we want to write to
char I2C_i; // Defines what type of byte we want to send (I don't remember what this is, and it is apparently unused)

/////////// Main program ///////////
void main(void){ // Start

srand(70);

/////////// Opsætning ///////////

/////////// Opsætning af SSP modul ///////////

TRISC = 0b00011000; // Sets port C pin 3 and 4 to be inputs
SSPADD = 39; // Defines the baudrate of the i2c communications
SSPCON = 0b00101000; // Configuration and start of SSP module
SSPCON2 = 0b00000000;
SSPSTAT = 0b11000000;
SSPIE = 1; // Enable interrupt on i2c communication start
SSPIF = 0;

/////////// Setup of interrupts ///////////

PEIE = 1;
GIE = 1; // Global interrupt enable

/////////// GAME OF LIFE ///////////

LiveCount = 0;
Pattern = 0;
NewPattern = 0;

glider();

/////////// Runs in a loop from here (Obviously not) ///////////

/////////// Pattern change ///////////
TRISD = 0b00000010; // Set pins on port D as input and output
while(!0){
PORTD = 0b00001000; // Drive current to RD3 pin
if(RD3 == 0){ // I HAVE NO IDEA WHY THIS WORKS (Basically, the code here sets a pin, then checks if it is set. It worked, I still have no idea why)
Pattern = Pattern + 1;
NewPattern = 1;
DelayMs(255);
}
if(NewPattern){
if(Pattern > 5) Pattern = 0;
if(Pattern == 0) glider();
else if(Pattern == 1) lwss();
else if(Pattern == 2) toad();
else if(Pattern == 3) kasse();
else if(Pattern == 4) blinker();
else if(Pattern == 5) randompat();
NewPattern = 0;
}

//////////////// Blink light to indicate when the next generations of game of life is calculated /////////////////
PORTD = 0;
DelayMs(50);
PORTD = 1;

//////////////// Game of Life /////////////////
if(!FirstEvol){
for(i=0; i<7; i++){
for(j=0; j<8; j++){
if(i == 0){
if(j == 0){
if(get_bit(LifeGameBuf[0][i],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],7)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],7)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],7)) LiveCount = LiveCount + 1;
}
else if (j == 7){
if(get_bit(LifeGameBuf[0][i],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j-1)) LiveCount = LiveCount + 1;
}
else{
if(get_bit(LifeGameBuf[0][i],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][6],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j-1)) LiveCount = LiveCount + 1;
}
}
else if(i == 6){
if(j == 0){
if(get_bit(LifeGameBuf[0][i],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],7)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],7)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],7)) LiveCount = LiveCount + 1;
}
else if (j == 7){
if(get_bit(LifeGameBuf[0][i],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j-1)) LiveCount = LiveCount + 1;
}
else{
if(get_bit(LifeGameBuf[0][i],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][0],j-1)) LiveCount = LiveCount + 1;
}
}
else{
if(j == 0){
if(get_bit(LifeGameBuf[0][i],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],7)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],7)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],7)) LiveCount = LiveCount + 1;
}
else if (j == 7){
if(get_bit(LifeGameBuf[0][i],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],0)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j-1)) LiveCount = LiveCount + 1;
}
else{
if(get_bit(LifeGameBuf[0][i],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i-1],j-1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j+1)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j)) LiveCount = LiveCount + 1;
if(get_bit(LifeGameBuf[0][i+1],j-1)) LiveCount = LiveCount + 1;
}
}

if(LiveCount < 2){clear_bit(&LifeGameBuf[1][i],j);}
else if(LiveCount == 2 && get_bit(LifeGameBuf[1][i],j) == 1){set_bit(&LifeGameBuf[1][i],j);}
else if(LiveCount == 2 && get_bit(LifeGameBuf[1][i],j) == 0){clear_bit(&LifeGameBuf[1][i],j);}
else if(LiveCount == 3){set_bit(&LifeGameBuf[1][i],j);}
else if(LiveCount > 3){clear_bit(&LifeGameBuf[1][i],j);}
LiveCount = 0;

}
}
for(i=0; i<7; i++){
LifeGameBuf[0][i] = LifeGameBuf[1][i];
}
}
FirstEvol = 0; // No longer first generation

////////////// SEND TO DISPLAY /////////////////

i2c_Start();
i2c_Address(15,0);
i2c_Write(LifeGameBuf[0][0]);
i2c_Write(LifeGameBuf[0][1]);
i2c_Write(LifeGameBuf[0][2]);
i2c_Write(LifeGameBuf[0][3]);
i2c_Write(LifeGameBuf[0][4]);
i2c_Write(LifeGameBuf[0][5]);
i2c_Write(LifeGameBuf[0][6]);
i2c_Stop();
}
} // End

static void interrupt isr(void)
{

if(SSPIF){ // Was it a i2c interrupt?
SSPIF = 0; // Clear SSP interrupt flag
}
}

/////////// Game of Life pattern funftions ///////////

void glider() {

LifeGameBuf[0][0] = 0b00100000;
LifeGameBuf[0][1] = 0b10100000;
LifeGameBuf[0][2] = 0b01100000;
LifeGameBuf[0][3] = 0b00000000;
LifeGameBuf[0][4] = 0b00000000;
LifeGameBuf[0][5] = 0b00000000;
LifeGameBuf[0][6] = 0b00000000;

LifeGameBuf[1][0] = LifeGameBuf[0][0];
LifeGameBuf[1][1] = LifeGameBuf[0][1];
LifeGameBuf[1][2] = LifeGameBuf[0][2];
LifeGameBuf[1][3] = LifeGameBuf[0][3];
LifeGameBuf[1][4] = LifeGameBuf[0][4];
LifeGameBuf[1][5] = LifeGameBuf[0][5];
LifeGameBuf[1][6] = LifeGameBuf[0][6];

FirstEvol = 1;
}


void lwss() {

LifeGameBuf[0][0] = 0b00000000;
LifeGameBuf[0][1] = 0b00000000;
LifeGameBuf[0][2] = 0b00110000;
LifeGameBuf[0][3] = 0b11011000;
LifeGameBuf[0][4] = 0b11110000;
LifeGameBuf[0][5] = 0b01100000;
LifeGameBuf[0][6] = 0b00000000;

LifeGameBuf[1][0] = LifeGameBuf[0][0];
LifeGameBuf[1][1] = LifeGameBuf[0][1];
LifeGameBuf[1][2] = LifeGameBuf[0][2];
LifeGameBuf[1][3] = LifeGameBuf[0][3];
LifeGameBuf[1][4] = LifeGameBuf[0][4];
LifeGameBuf[1][5] = LifeGameBuf[0][5];
LifeGameBuf[1][6] = LifeGameBuf[0][6];

FirstEvol = 1;
}

void toad() {

LifeGameBuf[0][0] = 0b00000000;
LifeGameBuf[0][1] = 0b00000000;
LifeGameBuf[0][2] = 0b00000000;
LifeGameBuf[0][3] = 0b00111000;
LifeGameBuf[0][4] = 0b00011100;
LifeGameBuf[0][5] = 0b00000000;
LifeGameBuf[0][6] = 0b00000000;

LifeGameBuf[1][0] = LifeGameBuf[0][0];
LifeGameBuf[1][1] = LifeGameBuf[0][1];
LifeGameBuf[1][2] = LifeGameBuf[0][2];
LifeGameBuf[1][3] = LifeGameBuf[0][3];
LifeGameBuf[1][4] = LifeGameBuf[0][4];
LifeGameBuf[1][5] = LifeGameBuf[0][5];
LifeGameBuf[1][6] = LifeGameBuf[0][6];

FirstEvol = 1;
}

void kasse() {

LifeGameBuf[0][0] = 0b00000000;
LifeGameBuf[0][1] = 0b00110000;
LifeGameBuf[0][2] = 0b01001000;
LifeGameBuf[0][3] = 0b01001000;
LifeGameBuf[0][4] = 0b00110000;
LifeGameBuf[0][5] = 0b00000000;
LifeGameBuf[0][6] = 0b00000000;

LifeGameBuf[1][0] = LifeGameBuf[0][0];
LifeGameBuf[1][1] = LifeGameBuf[0][1];
LifeGameBuf[1][2] = LifeGameBuf[0][2];
LifeGameBuf[1][3] = LifeGameBuf[0][3];
LifeGameBuf[1][4] = LifeGameBuf[0][4];
LifeGameBuf[1][5] = LifeGameBuf[0][5];
LifeGameBuf[1][6] = LifeGameBuf[0][6];

FirstEvol = 1;
}

void blinker() {

LifeGameBuf[0][0] = 0b01000000;
LifeGameBuf[0][1] = 0b01000000;
LifeGameBuf[0][2] = 0b01000000;
LifeGameBuf[0][3] = 0b00001000;
LifeGameBuf[0][4] = 0b00001000;
LifeGameBuf[0][5] = 0b00001000;
LifeGameBuf[0][6] = 0b00000000;

LifeGameBuf[1][0] = LifeGameBuf[0][0];
LifeGameBuf[1][1] = LifeGameBuf[0][1];
LifeGameBuf[1][2] = LifeGameBuf[0][2];
LifeGameBuf[1][3] = LifeGameBuf[0][3];
LifeGameBuf[1][4] = LifeGameBuf[0][4];
LifeGameBuf[1][5] = LifeGameBuf[0][5];
LifeGameBuf[1][6] = LifeGameBuf[0][6];

FirstEvol = 1;
}

void randompat() {

LifeGameBuf[0][0] = (char)rand();
LifeGameBuf[0][1] = (char)rand();
LifeGameBuf[0][2] = (char)rand();
LifeGameBuf[0][3] = (char)rand();
LifeGameBuf[0][4] = (char)rand();
LifeGameBuf[0][5] = (char)rand();
LifeGameBuf[0][6] = (char)rand();

LifeGameBuf[1][0] = LifeGameBuf[0][0];
LifeGameBuf[1][1] = LifeGameBuf[0][1];
LifeGameBuf[1][2] = LifeGameBuf[0][2];
LifeGameBuf[1][3] = LifeGameBuf[0][3];
LifeGameBuf[1][4] = LifeGameBuf[0][4];
LifeGameBuf[1][5] = LifeGameBuf[0][5];
LifeGameBuf[1][6] = LifeGameBuf[0][6];

FirstEvol = 1;
}

Fun things:
while(!0)
The "I HAVE NO IDEA WHY THIS WORKS" comment

Lua code:
The below code is for a randomized gun generation thing for the game Cortex Command, a video of which can be found here. If I recall correctly, it was also my first NANY.
removed a few new lines, otherwise did nothing (pastebin link)
Spoiler
function Create(self)

-- Initialize variables and timers

self.smgbodylist = {};
self.smgbarrellist = {};
self.smgmaglist = {};
self.smgbulletlist = {};
self.smgsoundlist = {};
self.smgsoundlist["fire"] = {};
self.smgsoundlist["reload"] = {};
self.smgmuzzlelist = {};

self.projectileteam = -1;
self.allmodulesfound = false;
self.ammocounter = 0;
self.reloading = false;

self.Body = {};
self.Mag = {};
self.Barrel = {};
self.Bullet = {};
self.FireSound = nil;
self.ReloadSound = nil;
self.MuzzleFlash = nil;

self.firingtimer = Timer();

-- Initial stats
-- Basic stats
self.rateoffire = 700;
self.ammocapacity = 20;
self.accuracy = 25;

-- Initial modifiers
self.rofmod = 0.8 + math.random()*0.4;
self.magmod = 0.8 + math.random()*0.4;
self.accmod = 0.8 + math.random()*0.4;
self.firevelmod = 0.8 + math.random()*0.4;
self.massmod = 0.8 + math.random()*0.4;
self.sharpnessmod = 0.8 + math.random()*0.4;

-- Load body modules
dofile("Brolands.rte/smg/bodymodules.lua");
BrolandsBodies(self);

-- Load barrel modules
dofile("Brolands.rte/smg/barrelmodules.lua");
BrolandsBarrels(self);

-- Load magazines modules
dofile("Brolands.rte/smg/magazinemodules.lua");
BrolandsMagazines(self);

-- Load bullets
dofile("Brolands.rte/smg/bulletmodules.lua");
BrolandsBullets(self);

-- Load muzzleflashes
dofile("Brolands.rte/smg/muzzleflashmodules.lua");
BrolandsMuzzleflashes(self);

-- Load sounds
dofile("Brolands.rte/smg/soundmodules.lua");
BrolandsSounds(self);

end

function Update(self)

-- Generate gun
if self.allmodulesfound ~= true then
-- Find the attachments
for i=1,MovableMan:GetMOIDCount()-1 do
local mo = MovableMan:GetMOFromID(i);
if mo.PresetName == "SmgBody" and mo.RootID == self.RootID then
self.Body["pointer"] = ToAttachable(mo);
self.Body["pointer"].GetsHitByMOs = false;
elseif mo.PresetName == "SmgMag" and mo.RootID == self.RootID then
self.Mag["pointer"] = ToAttachable(mo);
self.Mag["pointer"].GetsHitByMOs = false;
elseif mo.PresetName == "SmgBarrel" and mo.RootID == self.RootID then
self.Barrel["pointer"] = ToAttachable(mo);
self.Barrel["pointer"].GetsHitByMOs = false;
end
if self.Body["pointer"] and self.Mag["pointer"] and self.Barrel["pointer"] then
self.allmodulesfound = true;
break;
end
end

-- Body
for k,v in pairs(self.smgbodylist[math.random(1,#self.smgbodylist)]) do self.Body[k] = v end
-- for k,v in pairs(self.smgbodylist[15]) do self.Body[k] = v end
self.Body["pointer"].Frame = self.Body["sprite"];

-- Modify stat modifier with module modifier
self.rofmod = self.rofmod * self.Body["rofmod"];
self.magmod = self.magmod * self.Body["magmod"];
self.accmod = self.accmod * self.Body["accmod"];
self.firevelmod = self.firevelmod * self.Body["firevelmod"];
self.massmod = self.massmod * self.Body["massmod"];
self.sharpnessmod = self.sharpnessmod * self.Body["sharpnessmod"];

-- Mag
for k,v in pairs(self.smgmaglist[math.random(1,#self.smgmaglist)]) do self.Mag[k] = v end
-- for k,v in pairs(self.smgmaglist[16]) do self.Mag[k] = v end
self.Mag["pointer"].Frame = self.Mag["sprite"];
self.Mag["offset"] = self.Body["magoffset"];

-- Modify stat modifier with module modifier
self.rofmod = self.rofmod * self.Mag["rofmod"];
self.magmod = self.magmod * self.Mag["magmod"];
self.accmod = self.accmod * self.Mag["accmod"];
self.firevelmod = self.firevelmod * self.Mag["firevelmod"];
self.massmod = self.massmod * self.Mag["massmod"];
self.sharpnessmod = self.sharpnessmod * self.Mag["sharpnessmod"];

-- Barrel
for k,v in pairs(self.smgbarrellist[math.random(1,#self.smgbarrellist)]) do self.Barrel[k] = v end
-- for k,v in pairs(self.smgbarrellist[18]) do self.Barrel[k] = v end
self.Barrel["pointer"].Frame = self.Barrel["sprite"];
self.Barrel["offset"] = self.Body["barreloffset"];

-- Modify gun stat modifier with module modifier
self.rofmod = self.rofmod * self.Barrel["rofmod"];
self.magmod = self.magmod * self.Barrel["magmod"];
self.accmod = self.accmod * self.Barrel["accmod"];
self.firevelmod = self.firevelmod * self.Barrel["firevelmod"];
self.massmod = self.massmod * self.Barrel["massmod"];
self.sharpnessmod = self.sharpnessmod * self.Barrel["sharpnessmod"];

-- Bullet
for k,v in pairs(self.smgbulletlist[math.random(1,#self.smgbulletlist)]) do self.Bullet[k] = v end
-- for k,v in pairs(self.smgbulletlist[3]) do self.Bullet[k] = v end

-- Modify gun stat modifier with module modifier
self.rofmod = self.rofmod * self.Bullet["rofmod"];
self.magmod = self.magmod * self.Bullet["magmod"];
self.accmod = self.accmod * self.Bullet["accmod"];
self.firevelmod = self.firevelmod * self.Bullet["firevelmod"];
self.massmod = self.massmod * self.Bullet["massmod"];
self.sharpnessmod = self.sharpnessmod * self.Bullet["sharpnessmod"];

-- Fire sound

self.FireSound = self.smgsoundlist["fire"][self.Bullet["firesounds"][math.random(1,#self.Bullet["firesounds"])]];

-- Reload sound

self.ReloadSound = self.smgsoundlist["reload"][self.Mag["reloadsounds"][math.random(1,#self.Mag["reloadsounds"])]];

-- Muzzle flash

self.MuzzleFlash = self.smgmuzzlelist[self.Bullet["muzzleflash"][math.random(1,#self.Bullet["muzzleflash"])]];

-- Done generating gun, apply gun stat modifiers
self.rateoffire = Round(self.rateoffire * self.rofmod);
self.ammocapacity = Round(self.ammocapacity * self.magmod);

-- You can't be more precise than 100%
if self.accuracy > 100 then
self.accuracy = 100;
else
self.accuracy = Round(self.accuracy * self.accmod);
end

self.Bullet["firevel"] = Round(self.Bullet["firevel"] * self.firevelmod);
self.Bullet["mass"] = self.Bullet["mass"] * self.massmod;
self.Bullet["sharpness"] = Round(self.Bullet["sharpness"] * self.sharpnessmod);


-- Output gun stats to console
-- print("\nRate of fire: "..self.rateoffire.." Rounds Per Minute\nMagazine capacity: "..self.ammocapacity.." Rounds\nAccuracy: "..self.accuracy.."%\nProjectile type: "..self.Bullet["particle"].."\nProjectile mass: "..self.Bullet["mass"].."\nProjectile speed: "..self.Bullet["firevel"].."\nProjectile sharpness: "..self.Bullet["sharpness"].."\n");

self.ammocounter = self.ammocapacity;

-- Clear unneeded tables and variables
self.smgbodylist = nil;
self.smgbarrellist = nil;
self.smgmaglist = nil;
self.smgbulletlist = nil;
self.smgsoundlist = nil;
self.rofmod = nil;
self.magmod = nil;
self.accmod = nil;
self.firevelmod = nil;
self.massmod = nil;
self.sharpnessmod = nil;
end

-- Figure out what team is currently holding the gun
self.projectileteam = MovableMan:GetMOFromID(self.RootID).Team;

-- Move around attachables
if self.Body["pointer"].ToDelete ~= true and self.Body["pointer"].PresetName ~= "" then
if self.HFlipped then
self.Body["pointer"].Pos = self.Pos + Vector(self.Body["offset"].X * -1,self.Body["offset"].Y):RadRotate(self.RotAngle);
else
self.Body["pointer"].Pos = self.Pos + Vector(self.Body["offset"].X,self.Body["offset"].Y):RadRotate(self.RotAngle);
end
self.Body["pointer"].RotAngle = self.RotAngle;
self.Body["pointer"].HFlipped = self.HFlipped;
end

if self.Mag["pointer"].ToDelete ~= true and self.Mag["pointer"].PresetName ~= "" then
if self.HFlipped then
self.Mag["pointer"].Pos = self.Pos + Vector(self.Mag["offset"].X * -1,self.Mag["offset"].Y):RadRotate(self.RotAngle);
else
self.Mag["pointer"].Pos = self.Pos + Vector(self.Mag["offset"].X,self.Mag["offset"].Y):RadRotate(self.RotAngle);
end
self.Mag["pointer"].RotAngle = self.RotAngle;
self.Mag["pointer"].HFlipped = self.HFlipped;
end

if self.Barrel["pointer"].ToDelete ~= true and self.Barrel["pointer"].PresetName ~= "" then
if self.HFlipped then
self.Barrel["pointer"].Pos = self.Pos + Vector(self.Barrel["offset"].X * -1,self.Barrel["offset"].Y):RadRotate(self.RotAngle);
else
self.Barrel["pointer"].Pos = self.Pos + Vector(self.Barrel["offset"].X,self.Barrel["offset"].Y):RadRotate(self.RotAngle);
end
self.Barrel["pointer"].RotAngle = self.RotAngle;
self.Barrel["pointer"].HFlipped = self.HFlipped;
end

if self:IsActivated() and self.firingtimer:IsPastSimMS(60000 / self.rateoffire) and self.ammocounter > 0 and self.Magazine ~= nil then
self.ammocounter = self.ammocounter - 1;
self.firingtimer:Reset()

-- Decide which kind of particle to create depending on the bullets particle type
if self.Bullet["particletype"] == "MOPixel" then
self.particle = CreateMOPixel(self.Bullet["particle"],"Brolands.rte");
elseif self.Bullet["particletype"] == "MOSRotating" then
self.particle = CreateMOSRotating(self.Bullet["particle"],"Brolands.rte");
elseif self.Bullet["particletype"] == "MOSParticle" then
self.particle = CreateMOSParticle(self.Bullet["particle"],"Brolands.rte");
end

-- Decide which kind of particle to create depending on the muzzleflashs particle type
if self.MuzzleFlash["particletype"] == "MOPixel" then
self.particle2 = CreateMOPixel(self.MuzzleFlash["particle"],"Brolands.rte");
elseif self.MuzzleFlash["particletype"] == "MOSRotating" then
self.particle2 = CreateMOSRotating(self.MuzzleFlash["particle"],"Brolands.rte");
elseif self.MuzzleFlash["particletype"] == "MOSParticle" then
self.particle2 = CreateMOSParticle(self.MuzzleFlash["particle"],"Brolands.rte");
end

-- Figure out if the actor is sharpaiming or not.
local MO = MovableMan:GetMOFromID(self.RootID)
local Aiming = 1;
if MO then
local Actor = ToActor(MO)
if Actor:GetController():IsState(Controller.AIM_SHARP) then
Aiming = 0.5;
else
Aiming = 1;
end
end

-- Create a direction vector for the projectile depending on if the gun is HFlipped or not
if self.HFlipped == true then
self.particle.Pos = self.Barrel["pointer"].Pos + Vector(self.Barrel["muzzleoffset"].X * -1,self.Barrel["muzzleoffset"].Y):RadRotate(self.RotAngle);
if math.random() > 0.5 then
self.firingvector = Vector(-1,0):RadRotate(self.RotAngle + math.random() * (math.pi/8) * ((100 - self.accuracy)/100) * Aiming);
else
self.firingvector = Vector(-1,0):RadRotate(self.RotAngle - math.random() * (math.pi/8) * ((100 - self.accuracy)/100) * Aiming);
end
else
self.particle.Pos = self.Barrel["pointer"].Pos + Vector(self.Barrel["muzzleoffset"].X,self.Barrel["muzzleoffset"].Y):RadRotate(self.RotAngle);
if math.random() > 0.5 then
self.firingvector = Vector(1,0):RadRotate(self.RotAngle + math.random() * (math.pi/8) * ((100 - self.accuracy)/100) * Aiming);
else
self.firingvector = Vector(1,0):RadRotate(self.RotAngle - math.random() * (math.pi/8) * ((100 - self.accuracy)/100) * Aiming);
end
end
self.particle.Mass = self.Bullet["mass"]
self.particle.Sharpness = self.Bullet["sharpness"];
self.particle.Vel = self.firingvector * self.Bullet["firevel"];
self.particle.LifeTime = 1500;
self.particle.Team = self.projectileteam;
self.particle.IgnoresTeamHits = true;
MovableMan:AddParticle(self.particle);

-- Create firing sound emitter.
self.particle = CreateAEmitter(self.FireSound,"Brolands.rte");
self.particle.Pos = self.Pos;
MovableMan:AddParticle(self.particle);

-- Create muzzleflash
self.particle2.Pos = self.Barrel["pointer"].Pos + Vector(self.Barrel["muzzleoffset"].X * -1,self.Barrel["muzzleoffset"].Y):RadRotate(self.RotAngle);
self.particle2.Vel = self.Vel;
MovableMan:AddParticle(self.particle2);
end

-- Keeps track of the magazine
if self.Magazine == nil then
self.Mag["pointer"].Scale = 0;
self.ammocounter = self.ammocapacity;
self.reloading = true;
else
self.Mag["pointer"].Scale = 1;
self.Magazine.RoundCount = self.ammocounter;
end

if self.reloading == true and self.Magazine ~= nil then
self.reloading = false;
-- When the gun is done reloading, play reload sound
self.particle = CreateAEmitter(self.ReloadSound,"Brolands.rte");
self.particle.Pos = self.Pos;
MovableMan:AddParticle(self.particle);
end

end

function Destroy(self)
end

function Round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end

Fun things:
"pointers" in lua

45
Developer's Corner / Re: Dice analyzer machine project
« on: January 20, 2016, 08:30 AM »
If anyone comes up  with a good idea for hardware and is willing to put down some money (I'd of course spend some myself), I could probably try building it.

46
DC Gamer Club / Re: Fallout 3 (GOTYE) on Windows 10 Pro.
« on: September 23, 2015, 07:01 PM »
Fallout 3 is a pretty good game, it suffers the same fate as most Bethesda games though, the main story is shoddy and the game is buggy in general. But let yourself cut loose and just wander and there's a good chance you will wander into some interesting content. Just my two cents. Also, for the love of god, be sure to invest into a build (A good tip is to invest into a single weapon skill, a utility skill like lockpicking, science or speech and some more general purpose skills like medicine, sneak or repair). Don't try to be good at everything, you will end up not being able to do anything.

47
Living Room / Re: Recommend some music videos to me!
« on: July 24, 2015, 01:08 AM »
Hey! I am not sure if any of you guys are familiar with the Demoscene, they make some wicked cool stuff if you're into the whole abstract graphics aesthetic. These are just some random ones I grabbed off of Pouet or remembered off the top of my head:
Is That a Demo in Your Pocket?, a Game Boy Demo
Backscatter, a more modern 40k (meaning the executable is 40kilobyte or less) demo
Batman Forever, a Armstrad CPC demo.
8088mph, a demo running on a IBM 5150 PC.

While some of these aren't big in the demoscene , they show off the variety in my opinion while also showing some common traits. I love the aesthetic so much that I convinced my brother to help me produce this last christmas. Even if some of what you see might not look that impressive, thinking about the limitations of hardware or resources really makes me sit there with a sense of awe thinking about the weird stuff they had to pull off to do some of this stuff.

48
Living Room / Re: Your favorite cartoons of yesterday and today?
« on: July 23, 2015, 11:45 PM »
Maaaaaan, don't get me started on cartoons! I goddamn love cartoons, everything from the older Disney to modern french surreal cartoons. I can't get enough of them! Also one thing I learned to throw out the window pretty early is that demographics weren't that important. Something I kind of forgot until quite recently, I'll get into that later.

As some of you know I am a huge sucker for the modern reboot of the My Little Pony cartoons (MLP:Friendship is Magic), and while it might not be understandable from the outside, or hell, even the inside. It's a really good show with nice colors, animations and decent enough story arcs, while also being just generally entertaining. I mostly got into it for the lulz, as they say on the internet back when it was a huge fad. But I actually liked it in the end, it wasn't until later that I found out the some of the people working on it were also on the team that made The PowerPuff Girls, another cartoon I liked a lot as a kid, which is definitely not marketed to dudes.

There's also Sheep in the Big City, something that I only watched younger when it was dubbed in Danish, which made me loathe it. It's slow, looks bad and the story is non-sensical in a very unfunny way. BUT, I watched it YEARS later in English and figured out why some people liked it. It's entire premise is a series of puns and stupid wordplays, while the story can be overanalysed into being EVERYTHING. Something that you can't really enjoy as a kid. It also breaks the fourth wall in ways I find pretty funny, even if shoehorned in.

I don't think I saw anyone mention it either, but there's also Regular Show. A slice of life cartoon about two goofballs trying to do as little work as possible without getting fired from their park maintenance jobs. This doesn't sound very interesting, but every episode completely derails about halfway through into occult crazy stuff or the like. A lot of the time without all that much warning, which in it's absurd formularity makes it goddamn hilarious to me. You could see it as a bit of a stoner cartoon, but it's really good even if you are not intoxicated, at least in my opinion.

Edit:
Speaking of the french, there's Wakfu, which is pretty standard in terms of plot and characters. But it is beautiful for a flash cartoon, at least I think so. It took some time getting into it though and the French dubbing with English subs really put me off for a while. But character design is a breath of fresh air for cartoons in my opinion, because pretty much everyone is exaggerated in ways you wouldn't see in most mainstream cartoons. For example Evangeline who is pretty sexualized, something that may put some off as her and her love interest in the series is supposed around 16-18 or so IIRC.

MOVING ON, anime.
If you haven't seen Cowboy Bebop, DO SO NOW. It's basically Firefly before Firefly, a wild west space thriller/comedy/action thing with a ship and it's motley crew of not entirely good do-gooders. Neon Genesis Evangelion is also pretty good, but I haven't had the chance to watch it since I got older. Never saw it till the end, but it is filled with metaphors, symbolic imagery and entirely mindfuck visuals at some points. From what I read/remember a lot of the story, plot and imagery is purposefully made to mess with peoples expectations.

Edit edit:

Oh man, and I completely forgot about Samurai Jack, which Cartoon Network ran back in the day. It was slow paced as all hell with lots of establishing shots. Which only helped emphasize the fantastically choreographed action scenes. I don't remember that many of the episodes off the top of my head, but one thing ran through them all, it was damn beautiful and filled with subdued humour and lots of quirky character design.

I also bolded all the cartoon names in case anyone wants to just take the TL;DR route. Also I haven't slept today, in case I am rambling too much and that bleeds through into the post.

49
So, I am gonna pop in a make a small necro.

I recently tried actually programming some bezier curves, and to me that gave me a quite a bit better understanding of it. Not much on a mathematical level, or super intuitive level. But it really helped me actually understand what a bezier curve is (A series of control points to use in a parametric function). Even if it is pretty obvious from the various "pen" tools. The difference between bezier paths and higher order bezier curves was pretty cool to learn about. As I said, I recently programmed a bezier curve thing in Löve2d. Using this (really helpful) blog post to work off. And it was pretty fun and if you haven't done anything similar I highly recommend trying it out.

bezierCurves0.gifbezierCurves1.gif

The moving ball represents t going from 0 to 1 in the formulas for bezier curves.

50
I could go for some insurgency

Pages: prev1 [2] 3 4 5 6 7 ... 17next