Author Topic: Coding Competition 10 Jan - 24 Jan  (Read 7403 times)

scourge

  • Guest
Coding Competition 10 Jan - 24 Jan
« on: 10 Jan 2006, 12:55 »
The Rules:
1. Must be open-source. We can hardly inspect your coding if we cant see it.
2. Must contain instructions for how to add to an existing game, this will obviously be easier if the scripting is done as a module
3. Only use of the 3D, TCP/IP and maths plugins are allowed
4. Must provide sample game using your code.
5. Team efforts are allowed, and you're probably expected to get help for sprites, etc from elsewhere.
6. As far as possible, entries will be judged on their scripting and gameplay rather than GFX, SFX, music, etc.
7. Winner will be decided by 1 week of voting at the end.

I also have problem thinking up ideas and at first i wanted to take one from the list of wanted modules, but it seems the people are covering them quite quickly. So i thought of this one, though it may have been done on certain levels, i thought maybe make a meal of it.

Environment Modules:

Make an environment module that covers as many environment issues as you want, from a minimum of 1 feature to 20, you decide. Environment feature examples include:
* weather (snow, rain, hail, etc)
* footsteps
* lanterns being carried
* wind
* a player shadow (with code not pictures)
* anything you can think environment related and that adventure game makers may require

Deadline:
I think 2 weeks would be long enough, but if someone wants is doing something elaborate this could be increased a bit.


I hope this topic is not too unoriginal, i just don't have any ideas.

[EDIT]: People with snow modules etc may of course submit then, but it would be cool if they could expand them too include other features.
« Last Edit: 10 Jan 2006, 13:11 by buloght »

Re: Coding Competition 10 Jan - 24 Jan
« Reply #1 on: 10 Jan 2006, 21:24 »
It sounds hard, but guess I will participate.
Games are art!
My horror game, Self

Re: Coding Competition 10 Jan - 24 Jan
« Reply #2 on: 10 Jan 2006, 23:01 »
This topic is great! I'm in.

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #3 on: 11 Jan 2006, 00:38 »
I have begun the creation...  And it's name shall be called EnviornmentCreator, and it shall probably not but maybe somehow beat Ashen, Gord 10, khrismuc, and the other entries, but not likely.  It will likely be shamed and hated for it's simplicity or something like that... but we will see... won't we?..........no..... we won't.... I WILL, but YOU might not..... err..... The Creation Has Begun!!!  :-X
"Power is not a means - it is an end."

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #4 on: 11 Jan 2006, 23:59 »
BOOYAH!!!  First person to enter third time in a row!!!  Okay... I present to you, in all it's splendor:
Akumayo's Weather Module!!!  (-fake audience cheers-)

----------------------------------BEGIN UPDATE

UPDATE:  Akumayo's Weather Module now contains, the CastLightningBolt!!! function!!!  Now... who wants to get fried?  Here's the specs on the CastLightningBolt function and it's affiliate.

Code: [Select]
function CastLightningBolt(int boltseed_x, int boltseed_y, int boltstop_y, int boltstrike_speed, int boltstrike_xoffset, int bolt_color)

This is CastLightningBolt.  CastLightningBolt does just what it says, but works off Raw functions instead of overlays, meaning you can Cast lightning bolts when it is raining, snowing, etc.
-boltseed_x:  The x position of where the lightning bolt will begin
-boltseed_y:  The y position of where the lightning bolt will begin
-boltstop_y:  The y position of where the lightning bolt will end
-boltstrike_speed:  How fast the lightningbolt will fall (must be > 0)
-boltstrike_xoffset:  How much the lightning bolt will waver as it grows (must be >= 0)
-bolt_color:  The color of the lightning bolt

*NOTE:  Never, Never, Never call a CastLightningBolt function while one is already running, doing so will result in the bolt that was running sticking to the background, and a new one starting.  That's where this function comes in:

Code: [Select]
function IsLightningGoing()

This returns 1 or 0.  1 means a lightning bolt is playing, so DON'T call CastLightningBolt.  0 means no lightning bolts are playing, so you can CastLightningBolt if you want to.

Now, by merging these together, we can create a Lightning Storm!!!  (Demonstrated in the demo game):

To start up the storm, place this in any interaction:
Code: [Select]
Display("Let the reign of lightning begin!");
lightninggoing = 1;
hlight.Enabled = false;
CastLightningBolt(Random(319) + 1, 0, 200, RandomBoundries(5, 15), RandomBoundries(1, 5), 65472); 

Then place this under repeatedly_excecute:
Code: [Select]
if (lightninggoing == 1) {
  if (IsLightningGoing() == 0) {
    if (timerone == 0) {
      SetTimer(1, Random(40) + 1);
      timerone = 1;
    }
  }
}
if (IsTimerExpired(1) == 1) {
  timerone = 0;
  CastLightningBolt(Random(319) + 1, 0, 200, RandomBoundries(5, 15), RandomBoundries(1, 5), 65472);
}

And BOOM!!!  A lightning storm is born!!!  Check it out in the demo!!!  And remember, don't get caught in the lightning!

----------------------------------END UPDATE

Akumayo's Weather Module sports two functions that have literally no limit on their usage!  The possibilities are endless I tell you!  Now, allow me to clarify each function (This module uses functions from the Advanced Randoms Module, which is included in the download):

Code: [Select]
BeginEnviornmentalEffect(int slota, int slotb, int slotc, int slotd, int slote, int slotf, int slotg, int sloth, int envfallingspeed, int envwindspeed)
slota through sloth are the integers representing the sprite slot number of each weather piece.  This means you can have eight different designs of snowflake/raindrop/leaf, etc.  envfallingspeed is the integer representing how fast and what direction the weather pieces will fall.  Passing a positive direction will result in weather from the sky.  Passing a negative one will result in weather from the ground up (like bubbles).  The higher the absolute value of the integer, the faster the effect happens.  envwindspeed is the integer which controls how fast and what direction the weather pieces will move.  Passing a positive integer will result in movement to the right.  Passing a negative integer will result in movement to the left.

Code: [Select]
ChangeEnviornmentSpeeds(int newenvfallingspeed, int newenvwindspeed)
This function allows you to reset the speeds of an enviornmental effect, withough resetting it.  (Like for changing the direction of the wind.)  newenvfallingspeed allows you to redefine how fast and what direction weather piecies fall.  newenvwindspeed lets you redefine how fast and what direction weather piecies move left or right.

Now for examples:
Code: [Select]
BeginEnviornmentalEffect(8,9,10,8,9,10,9,8,3,-2);
Assuming 8, 9, and 10 are spriteslots of snowflakes, the above function would make slow falling snow moving slightly to the left as it falls.

Code: [Select]
BeginEnviornmentalEffect(8,9,10,8,9,10,9,8,5,-4); 
This, however, would make snow falling pretty fast and moving pretty sharply to the left as it falls.

Now, if you were to integrate the other function in, then through repeatedly_execute you could make something more complex.  After creating a variable called weathergoing and setting it to one after calling BeginEnviornmentalEffect from elsewhere in the script, and making another integer called "w" and setting it to 0 by default:

Code: [Select]
if (weathergoing == 1) {
  if (w == 5) {
    w --;
  }
  else if (w == -5) {
    w ++;
  }
  else if (w != -5 && w != 5) {
    w += RandomWeightedDice(-1, 10, 1, 10, 0, 80, 0, 0);
  }
  ChangeEnviornmentSpeeds(2, w);
}

This would end in weather that was moved left and right by gusts of wind, rather than having a constant windspeed.

IMPORTANT:  To end weather effects, pass BeginEnviornmentalEffect with all the "slot" integer values as 0, or a spriteslot that is blank.  Don't worry, the game runs at a normal speed still.

The demo game included in the download has the following effects to preview:
Rain
Snow
Heavy Rain
Heavy Snow
Sea Bubbles
Sandstorm
Meteor Shower (more like an apocalyptic doom of a meteor shower...)
Option to switch on code for varying windspeeds

A note on the side, and the only downside I've noticed so far, effects look sort of clumped together their first time across the screen, but they get better and more realistic quickly after that.

This module would also be ideal for leaves falling slowly, or something of that nature.

Download Akumayo's Weather Module Plus the Lightning Function (Advanced Randoms Module included) and the demo game previewing some of the possibilities:
http://www.2dadventure.com/ags/EnvModuleLightningUpdatePlusDemo.zip


Download the README which contains all the stuff in this post here (before Lightning update):
http://www.2dadventure.com/ags/AkumayosWeatherModuleREADME.zip

-Regards and good luck to all other entrants, Glacies Akumayo
« Last Edit: 15 Jan 2006, 17:40 by Glacies Akumayo »
"Power is not a means - it is an end."

Re: Coding Competition 10 Jan - 24 Jan
« Reply #5 on: 12 Jan 2006, 00:04 »
wow, akumayo, thats a lot of effects. however, i cant seem to download it. it just takes me to a page with "file uploads" but nothing else on it.
im really interested, because i actually need rain for my mags entry game. so, i have real interest in this contest.

"It's a fairy! She's naked! Curse these low-res graphics!" - Duty and Beyond

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #6 on: 12 Jan 2006, 00:07 »
 :-[  Thanks for pointing that out, it's fixed now...  sorry for that.
"Power is not a means - it is an end."

Re: Coding Competition 10 Jan - 24 Jan
« Reply #7 on: 12 Jan 2006, 00:11 »
Btw, it's "Environment", not "Enviornment"... :P

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #8 on: 12 Jan 2006, 00:14 »
Oh well, I spell like I like too...
"Power is not a means - it is an end."

scourge

  • Guest
Re: Coding Competition 10 Jan - 24 Jan
« Reply #9 on: 14 Jan 2006, 19:50 »
Look's really impressive akumayo, i'll check out the code a bit. Really nice from the demo sample i saw :)

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #10 on: 14 Jan 2006, 20:19 »
Thanks man.
BTW, I was going to implement more weather pieces, but the game slowdown wasn't worth it, this way it still runs smooth.

-Regards, Glacies Akumayo
"Power is not a means - it is an end."

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #11 on: 15 Jan 2006, 17:41 »
UPDATED my module, CastLightningBolt and IsLightningGoing are now available, see original posts for specs and an example.

-Regards, Glacies Akumayo
"Power is not a means - it is an end."

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #12 on: 18 Jan 2006, 14:49 »
Good job, but with my snow module, I used Rawdraw to create dynamic sprites to have various different snowflakes onto one sprite and then moved them all together on one overlay. This allowed more stuff visible but only using a smaller number of overlays...

Re: Coding Competition 10 Jan - 24 Jan
« Reply #13 on: 18 Jan 2006, 16:08 »
How very nice and easy to use!

Though, I'd like to increase the number of raindrops falling drastically, since what you call a heavy rain wouldn't let me use an umbrella in real life. Except, the drops are that big as they are displayed in the game. Why is that? Where can I change the script for making it using only the original size of the sprites.

Could you help me with those two points?

Thanks in advance!
coming soon (or later, sorry!)

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #14 on: 18 Jan 2006, 23:02 »
You can't change the sprite size of the used sprite, or, you shouldn't need to, just change the sprite slot into a newer, more .... effective, raindrop.  BTW:  I know the rain was the weakest feature by far, but I thought the other effects ended up looking nice....
"Power is not a means - it is an end."

Re: Coding Competition 10 Jan - 24 Jan
« Reply #15 on: 19 Jan 2006, 10:10 »
I don't know if I was understood correctly. So let me explain in more detail:

I use the same sprite in all 8 slots. It's a thin white slash. When the game runs and I let it rain, few of the raindrops are displayed in the original size but most of them are displayed much bigger which I think has something to do with your script. What I want is to have them all in the same (, the original) size.

And yes, for the case I didn' cheer enough: I find the script is a really great one and I really love the bubble feature. But the rain really won't make the player wet.
coming soon (or later, sorry!)

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #16 on: 19 Jan 2006, 22:47 »
Hrm... that is extreemely strange  :o
Nothing like that ever happened when I was working on it...  I haven't the slightest why it would do such a thing...  the sprite size is never rescaled, in my code that is.  Check to make sure your background is the same bit as your sprites (both 16-bit, both 24-bit, etc).  The only other thing I can think of is that perhaps if the sprites are moving slowly on one variable, and very fast on another (like 1 windspeed, 100 fallingspeed) that would distort the sprites a little.  Maybe if you could show your code so I can test it out?

Sorry for the inconvenience... and whatever's causing it...  :(
"Power is not a means - it is an end."

Re: Coding Competition 10 Jan - 24 Jan
« Reply #17 on: 20 Jan 2006, 09:24 »
Oh yes, sorry, but you are completely right! I must have messed something with the sprites resolution or the way I imported them. I filled the slots anew with the same sprite and the same way of importing them and now they all have te same correct size. Sorry for making you worry about your code.

So the only prob remaining is that my player character won't get wet from those few drops. I guess it could help to increase the number of sprites displayed. But I don't know if that would slow down the game too much.
coming soon (or later, sorry!)

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #18 on: 20 Jan 2006, 13:55 »
SSH's SimpleRain module

OK, since there doesn't seem to be a perfect rain solution (pun unintended, for once) here's SimpleRain and  demo game. It is really just a modification of the Snow module, but with variable speed of precipitation.

Documentation is in the module header.

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
Re: Coding Competition 10 Jan - 24 Jan
« Reply #19 on: 24 Jan 2006, 10:22 »
Last day today! I hope someone else will enter...