Log In  

Cart #flappy_zombie-0 | 2019-12-13 | Code ▽ | Embed ▽ | No License
3

Made this game for fun to learn Lua Programming Language.

My first game in Pico-8. My first game in Lua. One day challenge fun!

Made this in about 4 and half hours of my time. Although I am a seasonal programmer and also a Game Development Instructor in which my job requires me to make new Video Games on a daily basis. On average I have to make 3 mini-games a week. During summer up to 5 a week. It took me 10+ years to get to this point so please do not feel discouraged I used to suck at programming at one time.

I am used to huge languages like C++ and also C#/Java.
Analysis of Lua is that its a descent small language that can be learned entirely by a seasonal professional like me between 30-60 minutes. Its pretty amazing how awesome this language is how awesome Pico-8 is. I am impressed. C# takes about 5 years to master. C++ almost 9 years. This was not an easy task compared to Lua. It took me longer to learn Scratch (drag and drop programming is not quite there yet).

P#70952 2019-12-13 02:01 ( Edited 2019-12-13 02:05)

1

Not a bad start, needs quite a bit of work though!
From a player's standpoint, this game is very frustrating to say the least. There's a lot of instant death scenarios where the player can die as soon as pressing start, there's no small safe segment for them to start out in. Also, I've encountered quite a few glitches. Such as the money distance counting negative and then looping back around to overflow max. Another time i got a single $ and it sped up the game to about 30 times it's current speed, which was just far too much to even keep up with if I were a robot.

Not bad for your first project through! Stick with it and you'll be making real good Pico-8 games in no time!

Side note: Lua is no small language, friend! It's actually quite comprehensive and is growing in use rapidly! I'd argue that outside of Elm it's one of the fastest growing languages out there! An it's POWERFUL and FAST, LuaJIT has shown to outperform c/c++ in certain speed trials! Definitely a nice tool for a seasoned programmer such as yourself to have under your belt!

P#70967 2019-12-13 05:27
:: dw817
1

Pretty good, @Amac. I'm really liking your game.

You get my star for this feature.

If you want to see a REALLY relaxed version of Flappy I made a helicopter game some time ago. Quite a bit different.

https://www.lexaloffle.com/bbs/?pid=57988#p

... and yes, I think Pico-8 will be more than enough to challenge you. I'm a long time video game writer from the dark ages and Pico-8 so far is the most powerful language I have ever come across.

Not for graphics, not for sound, but for unbelievable depth of core coding ability.

A few things to remember. These arrays are all possible.

a={}
a[-5]=17

--and

a={}
a["apple"]="delicious"

Something many programming languages would never permit.

See a game you're interested in ? Click on CODE beneath to see the source for it.
Load with pound sign and the ID name to bring it up.

load #flappy_zombie

I think you're really going to like your Pico-8 journey ... :)

P#70968 2019-12-13 06:10 ( Edited 2019-12-13 06:12)
:: Amac
1

Lua by itself is small by default. I understand what you mean that the library is not small but that is actually the source of the problem. The problems I find is Lua is strongly dependent off of the community which provides a big legal problem. Even downloading a library from a source that claims it is Licensed under free license does not guarantee that person will maintain it as a free license. Even if they are not legally able to win a court battle the cost to go to court is expensive in itself for both parties. It can cost yourself or your company a lot of money if your not careful.

So in my perspective it is always good to analyze how actually big a language is by itself rather than size of the language via its community. Its safer to look at Lua as a small language and use it to extend your own programs or for the company you work for.

P#70969 2019-12-13 06:46 ( Edited 2019-12-13 06:58)
:: Amac

I do however Love Lua mostly for its scripting abilities. To extend to my C, C++, and C# libraries. Which is Lua's sole purpose in my opinion.

P#70970 2019-12-13 06:53 ( Edited 2019-12-13 06:56)
:: dw817

Err ... ???

Pico-8 costs $15. Far as I know it's mine since I paid for it. If I write game in it, I can sell 'em. Others have before me already. Pico-8 can also make true executables and I imagine that would be difficult to reverse-engineer for courts decrying LUA.

As for libraries and tools I'm writing stuff all the time for Pico-8.

[0x0]

I incorporate the rainbow "C" symbol in the sprite table for most of my difficult work meaning basically (at least for me) if you're gonna use my stuff commercially or in a group project then have "dw817" appear somewhere. Doesn't need to appear in the credits - you could even hide it sideways or upside-down in a busy logo-screen. Just enough pixels to be legible.

I'm good even if I'm the only person that can find it to let me know and remind me that my hard work paid off and helped someone else accomplish their major project. :)

On a different note you may see me on the board a lot, I'm retired and stay home most days.

Currently I'm working in a gamer's group called Sorcery. We plan to release good thinking games for Pico-8 this coming year, that's the primary goal.

P#70972 2019-12-13 07:17 ( Edited 2019-12-13 07:25)

I think a bit of lost in translation is happening here for the word "small" but all is well.

To add to what dw817 said of arrays, a lot can be said for functions as well!

--functions can have baked in recursion support like so
echo_number = 10

foo = function(n,f) 
    if(n>0)then
        print("Echo!")
        n = n-1
        f(n,f)
    else
        print("No more echoes!")
    end
end

foo(echo_number,foo)
--prints "Echo!" echo_number of times.

And of course, just as you can pass functions to functions, you can also tuck those functions away into tables.
Then begin to pass the tables around in functions and unpack THEIR functions into other table's functions.
It all gets very malleable and elastic as you get further down.

P#70978 2019-12-13 10:26
:: Amac

Very Good argument Cabledragon

you had me try to recreate the equivalent code with anonymous methods in C# and I learned something it can not do by default.

I love Lua but I will not use it as a replacement language for a statically typed language.

--dynamically typed variable
a = 5

function _init()

  --[[
      no type safety
      the variable gets converted into
      a string 
  --]]
  a = "hello world"

  --prints hello world
  print(a)

end

In comparison to C# a statically typed language that does support type safety

int a = 5;

//automatically this will cause an error and the program will not run
a = "Hello World";

Console.WriteLine(a);

I believe statically typed languages should always be used for projects with what is considered a medium or large project. For Some a medium project can be 1000 lines of code. For some 30,000 lines of code. Whatever it is statically typed code ends up makes your code easier to read and prevents uneccessary mistakes from occuring. Then again this is a matter of opinion.

I think Lua in overall is a better language for prototyping small ideas.
I think C# in overall is better languages for implementing those prototypes.

P#70995 2019-12-13 19:19
:: Amac

dw817

Your absolutely correct that it is perfectly legal to use Pico-8 code. I was more talking about Lua as a programming language as being small. As Lua is mostly dependent on its community for its size. Lua by itself is tiny. Pico-8 only adds a small library to an existing small language. In general though speaking Lua may be huge at the cost of downloading libraries from other sources made by the community outside of pico-8. Which may or may not be from a shady source.

P#71000 2019-12-13 19:29
:: Amac

In all the community on Pico-8 is great. The programming language of Lua is amazing. You two are awesome. In all I think the purpose of forums and a community is to learn new things. I know I learned some new things from you two but I also stand by my views as well because that makes me an individual. I also inherited some new ideas and views from both of you as well.

P#71001 2019-12-13 19:34
:: dw817

Just realized that:

f(n,f)

Is an abbreviation of:

foo(n,f)

You mentioned you can tuck functions into tables, can you please post an example of this, @Cabledragon ?

P#71003 2019-12-13 19:54
:: dw817

@Amac:

We've had the same problems in the past with dynamic libraries for other languages (DLL) like GFA-Basic.

While they can be easy to use and may accomplish what we want, we are also still a little uneasy about what exactly it =IS= doing outside of what we need.

Now I'm not going to say they're all full of viruses and keyloggers but the POTENTIAL is there to put them in.

In many ways I'm glad Pico-8 is open-architecture, that is, you cannot create dynamic libraries because then as a user we might not entirely know what it is doing outside of what we requested.

Now I would not mind in the least if @zep made some DLLs or what have you to expand the system, for instance just a few ideas:

pixel-collisions, fade, 3-dimensional, and graphic transformation routines.

So your point is a valid one. LUA being dependent upon outside libraries for basic functions for videogames from some possibly shady sources - may not be the best way to go.

It just encourages me all the more to embrace and enjoy Pico-8 which has always been fresh, fast, and fun. :)

P#71005 2019-12-13 20:00 ( Edited 2019-12-13 20:01)

Yeah because f is the argument being passed during:

foo(echo_number,foo)

So I just use the local f instead of the global foo, but either would work just fine.

As for functions inside of tables!
It's exactly as simple and as useful as you would think dw817.

foo = {} --table

foo.bar = function(t)
    return t*t
end --function inside of table

print(foo.bar(8)) --function inside of table inside of function
--prints 64

generic_table = {4,5,6,7,8,9} -- generic table

foo.print_function_of_table = function(t,f)
    for i=1,#t do
        print(f(t[i]))
    end
end -- a function in a table that uses a function and a table as arguments
-- ... and then uses them in another function

foo.print_function_of_table(generic_table,foo.bar)
--prints 16,25,36,49,64,81

Once I learned this. It literally blew my mind.
I'm always glad to help, I actually just learned lua recently despite dabbling with Pico-8 a while back.
I'm still learning for sure, but I've got quite a few more tricks up my sleeve now.

Also @Amac, lua has 8 default types: nil, boolean, number, string, function, userdata, thread, and table. You can check these at will with:

var = true 
if(type(var)=="boolean")then
    print("is a boolean!")  
end

So while it may not be by default, you can bake in type checking, though in Pico-8 this is often a waste of precious tokens.
Also, lua can very easily redefine a lot of it's own language WITH it's own language. So you can add C/C++ style syntax, logical operators, and more! One big thing I miss from C-style languages that lua cannot do is using ++ as an incremental operator.

In lua you always have to do:

var= var+1
--instead of just
var += 1
--or 
var++

This isn't so bad with short variable names but with very long ones like "pixel_shader_left_horizontal_offset" things can get tedious quickly.

Great discussion here guys, it seems we all come from various professional backgrounds with the common goal of making games on this wonderful fantasy console!

EDIT: @Amac
Check out Moonscript for an example library of C stylings in lua!

P#71014 2019-12-14 10:30 ( Edited 2019-12-14 10:38)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-05-23 14:32:04 | 0.025s | Q:32