Author Topic: Lemmings in C#  (Read 15546 times)

0 Members and 1 Guest are viewing this topic.

Offline oskar12345

  • Posts: 39
    • View Profile
Lemmings in C#
« on: March 13, 2014, 08:08:50 PM »
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>
« Last Edit: May 13, 2015, 10:15:47 AM by oskar12345 »

Offline LJLPM

  • Posts: 402
    • View Profile
Re: Lemmings in C#
« Reply #1 on: March 27, 2014, 11:32:43 PM »
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)

Offline mobius

  • Posts: 2747
  • relax.
    • View Profile
Re: Lemmings in C#
« Reply #2 on: March 29, 2014, 04:19:47 PM »
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  :)
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


Offline LJLPM

  • Posts: 402
    • View Profile
Re: Lemmings in C#
« Reply #3 on: March 31, 2014, 10:18:18 AM »
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, ...).

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: Lemmings in C#
« Reply #4 on: April 03, 2014, 10:35:22 PM »
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

Offline oskar12345

  • Posts: 39
    • View Profile
Re: Lemmings in C#
« Reply #5 on: March 17, 2015, 07:44:19 PM »
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.
« Last Edit: March 19, 2015, 05:52:20 AM by oskar12345 »

Offline Ben H

  • Posts: 38
    • View Profile
Re: Lemmings in C#
« Reply #6 on: March 21, 2015, 12:53:07 PM »
Nice.  :thumbsup:

Offline LJLPM

  • Posts: 402
    • View Profile
Re: Lemmings in C#
« Reply #7 on: March 21, 2015, 11:00:32 PM »
I tried your .exe: the result is very nice, and it's promising. Well done!

Offline EricLang

  • Posts: 464
    • View Profile
Re: Lemmings in C#
« Reply #8 on: April 07, 2015, 11:26:41 AM »
Nice! Where do the graphics come from?

Offline oskar12345

  • Posts: 39
    • View Profile
Re: Lemmings in C#
« Reply #9 on: April 13, 2015, 02:07:41 PM »
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.
« Last Edit: May 13, 2015, 10:18:39 AM by oskar12345 »

Offline oskar12345

  • Posts: 39
    • View Profile
Re: Lemmings in C#
« Reply #10 on: May 13, 2015, 11:49:13 AM »

Offline LJLPM

  • Posts: 402
    • View Profile
Re: Lemmings in C#
« Reply #11 on: May 13, 2015, 04:44:36 PM »
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...)

Offline oskar12345

  • Posts: 39
    • View Profile
Re: Lemmings in C#
« Reply #12 on: May 13, 2015, 05:56:47 PM »
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#
« Last Edit: May 13, 2015, 06:30:44 PM by oskar12345 »

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: Lemmings in C#
« Reply #13 on: May 19, 2015, 07:02:26 PM »
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 Lemmings 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)

Offline oskar12345

  • Posts: 39
    • View Profile
Re: Lemmings in C#
« Reply #14 on: May 20, 2015, 04:35:30 PM »
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...
« Last Edit: May 20, 2015, 04:42:45 PM by oskar12345 »