Lemmings in C#

Started by oskar12345, March 13, 2014, 08:08:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

oskar12345

I'm working on a Lemmings version in c#and i need help from someone to design animations,code help, etc. i'm noob in c#
I have all the sprites and levels and i'd like to work on mechanics and logic engine. I do this for practice c#

<a href="http://youtu.be/kK2PKpe2m9M" class="bbc_link" target="_blank">http://youtu.be/kK2PKpe2m9M</a>

LJLPM

Well, have you made some progress on your project?
What is the format of your levels? (a single image for a whole level, or are the levels tile-based, which is the way Lemmings works)
About the game logic, you will have to loop through a list of Lemmings and update their behaviour depending on the task they were assigned to perform: so, in your Lemmings class, you'll need to store the x,y position of a Lemming, its walking direction, its current action, its alive/dead state, its current fall height (may be 0, when walking), its floater/no_floater state... well, everything you would find useful to make a Lemming walk, fall, die, etc...
About the collisions: you can first try to test the x,y position of your Lemmings against the blue color of your level's background (as seen in your video). If you detect the background's blue color at a Lemming's x,y feet-position, then update your Lemming's y position to make it fall, until you no longer detect this blue color (which means your Lemming has reached the ground). About wall-collisions, well, check the color ahead of your walking Lemming (is it blue or not?).
Later, you may want to create a separated image-mask of your level, in order to detect special objects or steel (for example, your mask may be mainly in black&white, and you would use another color to code the steel pieces)

mobius

aw shame you chose C# as I just begun learning C++. If I could help I would try but I can't tell you how long it will take me to learn it. I'm a quick learner but my motivation is very poor.

Here is a topic that may help you;
http://www.lemmingsforums.com/index.php?topic=569.0

Simon made the program lix, in C++, but some of the things there might be helpful anyway. Lemmings is a game prone to an infinite amount of glitches.

will this program be for the computer if it's finished? -Those Lemming graphics look good so far  http://www.lemmingsforums.com/Smileys/lemmings/smiley.gif" alt=":)" title="Smiley" class="smiley" />
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


LJLPM

Your video shows a nice animated sprite working with perfect collisions. Having a lot of Lemmings is just a matter of looping through a list ; and now that you know how to handle collisions, then codings bashers, miners, and diggers will require you to simply draw the background's blue color over the actual landscape. If you really want to code a Lemmings-clone, you'll need a mask of your level for easily detecting the objects (collisions with traps, exit doors, 1-way arrows, ...).

ccexplore

http://www.lemmingsforums.com/index.php?topic=955.msg19760#msg19760">Quote from: oskar12345 on 2014-04-03 09:26:27
and make the mask like a copy in png,for example rose color for picture bits,grey for traps,red for steel,blue for water and let it open for future staffs.

Keep in mind that you may want some elements to overlap.  For example, exit and trap trigger areas typically overlap with some terrain pixels (though it doesn't have to be that way).  Supporting that would put some constraints into the scheme you use for the mask.

=====================

I was going to write something here about generally how the code for most games/simulations are typically structured conceptually, but I'm thinking you probably know the basic ideas anyway, I'm not too good a writer, and the internet likely has better written materials that can explain those concepts and ideas better than I ever could.  That said, if you do have any general or specific troubles with implementing the game logic I'm happy to try to help.  However, I'm also not that familiar with C# and more particularly with the libraries/APIs you may be using for things like graphics and sound, so for those kind of deeply technical things I may not be all that helpful unfortunately.  You can try researching the web for boards/forums that are more dedicated to that kind of questions.

Additional semirandom sidenote: in the original Lemmings game, in terms of game logic each lemming is effectively treated as a single pixel even though its graphics is of course larger than that.  One obvious motivation for that treatment is of course performance, as collision detection is much faster when you only need to check a few pixels.  But this also gives rise to the quirky aspect where a lemming can walk and fall through the narrowest of gaps, something which most longtime lemmings player have become quite accustomed to.  Of course there is nothing that says you have to follow this tradition, there are

oskar12345

#5
GameName5.exe is the exe inside Debug.RAR,it's programed with c# in monogame-xna for this reason i think u need net framework to run it
if someone want the source code for me it's no problem to share,i'm really noob with c# and classes too. :lix-smile:

Exit, doors, traps, digger finish now
Can put sprites in any order u want
Trigger áreas are used like rectangle regions
Can put any picture as level

Monogame is cross-platform and can be ported to android,linux, etc. Easyly but i dont't know.


LJLPM

I tried your .exe: the result is very nice, and it's promising. Well done!

EricLang

Nice! Where do the graphics come from?

oskar12345

#9
beta 1 finished. i can´t upload it ,i don´t know why.it's 12mb size the exe and 100mb the graphics and styles.


LJLPM

just tried the beta1 executable: it's a good job, with nice visuals, indeed! Keep up the good work!
By the way, during the game, I noticed that you can't assign new skills to already-working Lemmings (diggers could be turned into bashers, and then could be turned into builders, and then...)

oskar12345

#12
the skills works ok now,  i forget a few if variables...

from now the EXE size is 85 kb-> fun001.exe 85kb...fun002.exe 85kb...etc until 156 levels or whatever. All the exes shares the same content dir
i'm planning to do one exe for one level , it's so easy to code a diferent level with others graphics,traps,etc... only change a few lines

i don't know really good how to implement all in one only exe in c#

namida

Are the levels hardcoded into the EXEs, or loaded from a file? And, does an EXE support restarting a level from the beginning, or would a player have to close and restart the EXE? If it's loaded from a file and restarting is supported, all you'd have to do is load a different level then restart, I'd imagine. Of course that's just one way of doing it, and you'd need some kind of menu to select a level (but this shouldn't be a very hard task).
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

oskar12345

#14
i'll see to implement restarting, the problem is the xna-monogame method for initialize variables in the begin of the exe. i'm sure it'll be possible but i don´t know.
the levels loading are from the files no problem.

i'm finishing 60 more levels images and then upload all the graphics and the source code too.
i think i have to recode all the source,for me it's more easy to write one exe for any level i want.

then i'll try to translate it to android...