Poll: lua is
You do not have permission to vote in this poll.
yes
50.00%
3 50.00%
no
50.00%
3 50.00%
Total 6 vote(s) 100%
* You voted for this item. [Show Results]

Using Lua to create games in PR3R
#1
Recently (actually a bit over a month ago), there has been a significant breakthrough in PR3 lua. The user gasterskyRAW has figured out an easy to implement optimization of block.getblock.teleportto. This optimization is highly effective, increasing the speed by about four to five times. 

This breakthrough has allowed the creation of a gaming console (also by gasterskyRAW), and perhaps the most advanced use of Lua in Platform Racing 3 yet.

The console provides only a few simple commands and variables to use.
Code:
draw_pixel(x, y, color) -- draw a pixel of defined color at (x,y)

draw_square(x1, y1, x2, y2, color) -- draws a rectangle of defined color between (x1,y1) and (x2,y2)

control_horizontal -- horizontal speed of player, used for controls

control_up -- is 1 when player is pressing up

r_frames -- frames since the console was turned on.

The console also originally only gave access to 16 colors.
Code:
0  - #000000 (black)
1  - #7f0000 (dark red)
2  - #007f00 (dark green)
3  - #00007f (dark blue)
4  - #7f7f00 (dark yellow)
5  - #007f7f (dark cyan)
6  - #7f007f (dark pink)
7  - #7f7f7f (dark gray)
8  - #bfbfbf (gray)
9  - #ff0000 (red)
10 - #00ff00 (green)
11 - #0000ff (blue)
12 - #ffff00 (yellow)
13 - #00ffff (cyan)
14 - #ff00ff (pink)
15 - #ffffff (white)
This was quite limited, but it was enough, and with internal structure to only use teleportto for changed pixels, it was very easy for even those not very good with Lua to make simple games. Shortly after, draw_line(x1,y1,x2,y2,color) would become a thing, and I personally made several libraries for more advanced drawing. (mainly text and circles)

Making a game isn't particularly difficult as long as you know what you're doing and refer to the lua documents enough. This led to me making several, including

Bucket
[Image: UvXkwtr.png]

Super Ball

[Image: GhXaHW1.png]


Asteroid game

[Image: FP0t829.png]

Snake
[Image: pxyHRvK.png]

Revamped bucket
[Image: Ak6nmo9.png]

Tetris was also made, but not by me, and it's breaks for no reason.

Several colors were later added to fill gaps in the color specturm. Hopefully, this gets remade in ROP, which should run significantly faster than PR3 does, possibly allowing us to do far more than just these simple games. For now though, a couple more will be made in PR3 in the last few months before the game dies for good. Currently, I'm working on Super Ball 2, and eventually I'll also fix Tetris, and maybe make a quick operating system. There's a bit of hope that a few features (sound pitch and faster getblock) could help us make a few more games.

Main benefits of ROP would probably be

Larger display
60 FPS gameplay
Probably more colors because why not


eventually I'll simulate infinite rollers with one of these. Actually, I might do it now.
i failed the mario twitter challenge
The Following 4 Users Say Thank You to ThePizzaEater1000 For This Useful Post:
  • Camer the Dragon, Dangevin, Mia, Northadox
Reply


Messages In This Thread
Using Lua to create games in PR3R - by ThePizzaEater1000 - 22nd September 2020, 8:26 PM
RE: Using Lua to create games in PR3R - by Camer the Dragon - 23rd September 2020, 4:22 PM
RE: Using Lua to create games in PR3R - by ThePizzaEater1000 - 23rd September 2020, 10:03 PM
RE: Using Lua to create games in PR3R - by Mia - 23rd September 2020, 11:15 PM
RE: Using Lua to create games in PR3R - by Northadox - 24th September 2020, 10:12 AM
RE: Using Lua to create games in PR3R - by ThePizzaEater1000 - 26th September 2020, 2:46 PM
RE: Using Lua to create games in PR3R - by Camer the Dragon - 30th October 2020, 11:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)