generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Lua Project

Previous Thread :: Next Thread 
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
29 Oct 2012 10:32 PM
I'm working on a project. It's going alright so far.
I really don't know how to explain it, so I'll just show you.

First, download/extract the project so far.
https://dl.dropbox.com/u/10434417/BlockGameTest.zip

Now, double-click the run.bat or the run.sh file, depending on your operating system.
You will notice that a window pops up with three cubes of the colors red, blue, and green. You can walk around the cubes with the arrow keys and ASWD. You can also float up and down with O and P.

Next, close out the window. Notice that there is a "script" folder. Open up the script folder and you will find a "script.lua" file. This file will contains the code:

GAME:windowProperties("Lua Test",600,400)

GAME:createBox(0,0,-6,1,1,1,1,0,0)
GAME:createBox(1,0,-6,1,1,1,0,1,0)
GAME:createBox(2,0,-6,1,1,1,0,0,1)

while true do
if KB:isKeyDown(KB.KEY_SPACE) then
GAME:ALERT("hi");
end

GAME:UPDATE();
end


If you cannot tell what this is already, it basically is Lua embedded into a world-designer. Much like ROBLOX itself, although, no where near as advanced. :P

The "createBox" function goes like this:

GAME:createBox(x,y,z,width,height,depth,red,green,blue)


So, so far, it will run Lua just fine and you can also create blocks anywhere of your choosing.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
29 Oct 2012 10:40 PM
Cool!
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
30 Oct 2012 06:15 AM
This is nice....

Free bump...

Wondering what you could do with it...
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
30 Oct 2012 06:31 AM
@Prehistoric
I really kinda wish I was better at geometry and physics and what-not. I've always wanted to create a universe creator. Basically, you add spheres, balls, models, etc, and when you add them, they start acting like they would in real life. Such as, if you make two small spheres, they will slowly move towards each other extremely slowly. If you make one giant sphere, everything will get sucked onto it.

My problem is that I really don't know physics/geometry that well to code all this. :<
Hopefully I will understand better after colegio. I mean, I might be able to make one object move to another, but to actually collide and have the object rotate and settle on the surface isn't exactly something I know how to do.

Currently, I'm trying to figure out collision. Collision in a 3D world isn't exactly easy stuff.

Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
30 Oct 2012 11:33 AM
what is this alt thing why do people post on alts like seriously


or did you just join ROBLOX for the forum and not the game (if so that's totally OK)?
Report Abuse
terminator213 is not online. terminator213
Joined: 22 May 2009
Total Posts: 20222
30 Oct 2012 12:28 PM
@SN0X

The ones that usually post stuff like this are people who just joined for the forum I believe.
Report Abuse
Prehistoricmanthe2nd is not online. Prehistoricmanthe2nd
Joined: 15 Jan 2009
Total Posts: 193
30 Oct 2012 12:43 PM
@SN0X

I really don't know.
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
30 Oct 2012 03:14 PM
Right now, I'm working on four things (order in which I'm doing them):

1. Gravity
- The larger a box is and the closer one box is to another, the stronger that box will be pulled towards another one. So, a really big box would suck in all smaller boxes. But if a lot of smaller boxes pull together, they'll, as a group, have a much stronger gravitational pull, and would be able to pull in larger boxes.

2. Collision
-Basically, blocks can't go inside of each other.

3. Momentum Transfer
-I'll also have it that if one block hits the second from gravity, both boxes will begin moving in that direction but much slower. For example,

Box 1 is pulled towards box 2 at 10 points/per sec
[] -> []

Box 1 hits box 2 and causes box 1 and 2 to start moving in the same direction. But since, in real life, some of the speed is lost as heat and it takes more energy to move larger objects, the speed the two boxes will be moving at now will be much lower. The new speed will be lower depending on the size of the object it hits.
[][] ->

4. Lighting
-I'm either going to have a default light source, or the ability to create boxes and designate them as "light sources." Lighting is difficult and I've been having a lot of trouble on it. So I don't know how well this would go.
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
30 Oct 2012 05:53 PM
There's a similar engine called AGen aka Agenoria. Keep improving yours, good work.
Report Abuse
kirkyturky12 is not online. kirkyturky12
Joined: 30 Apr 2010
Total Posts: 1915
01 Nov 2012 05:37 AM
Umg. Nice job. But I have a question. Why are the boxes generated in relativity to where you are located?
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
02 Nov 2012 07:44 PM
@kirky
Because the camera is the center of the universe. There really is no "camera" per se. When you move, the entire universe is actually moving around you.


And... GUESS WHAT! I DID IT. I got lighting working, collision working, and gravity working!

Very difficult. But here is the next version:

https://dl.dropbox.com/u/10434417/BlockGameTest.zip

Another thing I added, is now you can run Lua code in-game. Like, how you write the "script.lua" file, you can also press TAB in-game and type in Lua code. Such as:

ROOT:createBox(0,0,0,3,3,3,0,1,0)

That will create a green box 3x3 box at (0,0,0), which, since it creates stuff relative to where you are, that will create it with the center exactly where you are (meaning, it creates it around you.

Currently, I'm working on making lighting a bit better. But right now, it basically acts if you are the light source. It lights up the sides facing you and dims the sides that aren't based on how much you aren't facing it.

Hard to explain. But it works kinda so far.

When you run the game, you will notice how the little blocks slowly get attracted to the two bigger blocks. The bigger blocks, if you look veeeery closely, are also being pulled towards each other, just very slowly. The bigger the block, the faster it pulls things towards it.
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
03 Nov 2012 11:29 AM
Aw yeah! Redownload it. I added:

1. You can now turn on/off your light with the shift key.

2. You can now create material blocks!

- root:createBox(0,0,0,3,3,3,"crate") will create a crate
- root:createBox(0,0,0,3,3,3,"dirt") will create a dirt block
etc... (notice how I changed "ROOT" to "root")

All material blocks have different densities. For example, a stone block would have a much higher gravitational pull than a hallow crate.

The current material blocks are:

- wood
- dirt
- crate
- stone

If you want to create a normal block, just do this:

root:createBox(0,0,0,3,3,3,1,0,1)

With the "1,0,1" being "RGB". You don't specify the RGB for material blocks because they have textures so color doesn't matter.

3. Mouse control! You can now control with your mouse instead of just your keyboard. Move the cursor left/right to turn your head left/right and scroll the mouse wheel up/down to move your player up/down. You can also disable/enable mouse control with the built-in function "setMouseControl". For example, this will disabled mouse controls:

root:setMouseControl(false)

So press TAB in-game, type in that command, and see how it disabled mouse control.

4. Player gravity! Now, due to my collision system currently being very buggy, player gravity isn't something that's automatically there, because when you collide with a block, it gets buggy. So to test out this "beta" player gravity, type in this code in-game:

root:setPlayerGravity(true)

Report Abuse
kirkyturky12 is not online. kirkyturky12
Joined: 30 Apr 2010
Total Posts: 1915
03 Nov 2012 12:12 PM
... I downloaded it, but when you run it, it opens a window, but closes it instantly.
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
03 Nov 2012 12:56 PM
@kirkyturky

1. What is in the script.lua file? If that file does not have the correct stuff in it, it won't work.

2. If that doesn't work, try this in order:

a. Delete the run.bat file.
b. Rename the "run.sh" file to "run.bat".
c. Replace all of the colons in the new "run.bat" file to semicolons.
e. Run the new run.bat file.
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
03 Nov 2012 01:05 PM
It starting then crashing is most likely the results of the script.lua file.

I made a video demonstration of it:

http://ow.ly/eZMOh
Report Abuse
BobaBuffet is not online. BobaBuffet
Joined: 15 Sep 2012
Total Posts: 112
03 Nov 2012 01:06 PM
Oh, @kirky, sorry, my bad. I think the script I made that came with it was bad.

Redownload it now. The script.lua file was bad.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image