Coding Competition 10 Jan - 24 Jan

Started by scourge, Tue 10/01/2006 12:55:04

Previous topic - Next topic

scourge

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.

Gord10

It sounds hard, but guess I will participate.
Games are art!
My horror game, Self

Khris


Akumayo

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

#4
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: ags

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: ags

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: ags

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: ags

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: ags

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: ags

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: ags

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: ags

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: ags

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
"Power is not a means - it is an end."

Mordalles

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

 :-[  Thanks for pointing that out, it's fixed now...  sorry for that.
"Power is not a means - it is an end."

strazer

Btw, it's "Environment", not "Enviornment"... :P

Akumayo

Oh well, I spell like I like too...
"Power is not a means - it is an end."

scourge

Look's really impressive akumayo, i'll check out the code a bit. Really nice from the demo sample i saw :)

Akumayo

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

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

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...
12

antineff

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

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."

antineff

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

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."

antineff

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

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.
12

SSH

Last day today! I hope someone else will enter...
12

SMF spam blocked by CleanTalk