Jump to content




RPG GAME! [V 1.0] [MASSIVE UPDATE!] [BETA]

game computer

  • You cannot reply to this topic
43 replies to this topic

#1 Tjakka5

  • Members
  • 256 posts

Posted 04 April 2013 - 11:16 PM

And we're in Beta guys :D

V 1.0.1 --Some bugfixes and such.
http://pastebin.com/mV94veBL

V 1.0
http://pastebin.com/bVh3Mepq

Done:

Movement
Able to click thingies.
UI
Multiple worlds
Different kinds of swords with description.
Different kinds of armor with description.
Leveling up system.

Planned:

Menu
Mobs
Magix :)
Bosses
Proper worlds
More armor/swords
Storyline maybe?
Save and load the game
More?


Older versions.


#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 April 2013 - 11:30 PM

Its good to see another game on the forums. Can't wait to see it finished.

You may benefit from using this function

local function centerWrite(msg, y, yOffset)
  local sw, sh = term.getSize()
  local yPos = y or sh/2 + (yOffset or 0) -- if y is not provided make it the middle of the screen, the yOffest variable is to move the text around the center, so if -1 is provided it will be 1 line above the center of the screen, if 2 is provided it will be 2 below the center
  local xPos = sw/2 - #msg/2 + (#msg % 2 == 0 and 1 or 0) -- find the start position of the text, if the text is an even size shift the position by +1 so that is still looks as though it is in the center
  term.setCursorPos(xPos, yPos)
  write(msg)
end

You can then just do this
centerWrite("P R E S S   A N Y   K E Y") -- this will be printed in the middle
centerWrite("T O   C O N T I N U E", nil, 1) -- this will be printed 1 line below the center
-- your code to wait for key press
centerWrite("R P G   G A M E", nil, -4) -- this will be printed 4 lines above the center

-- another example
centerWrite("S O M E  S E T  T E X T", 4) -- this will be printed at line 4
centerWrite("S O M E  S E T  T E X T", 4, 1) -- this will still be printed at line 4, offset is ignored when you provide a y position

Edited by theoriginalbit, 04 April 2013 - 11:31 PM.


#3 Tjakka5

  • Members
  • 256 posts

Posted 05 April 2013 - 12:25 AM

View Posttheoriginalbit, on 04 April 2013 - 11:30 PM, said:

-snip

Thank you sir, I, however do not think about using this function, as I do not yet fully understand it.
I also do not need it for no, but if I find that I will need it later, I will definatly use it.


Next plan BTW is to make it Auto Update, as I am working on this on various places.

#4 LuaEclipser

  • Banned
  • 220 posts
  • LocationCleveland, Ohio

Posted 05 April 2013 - 10:40 AM

if you don't understand print Center, then you probably should work on that before you make an updater. (unless you are better with PHP) im not stopping you though. learn from your mistakes. right?

#5 mikey53591

  • Members
  • 7 posts
  • LocationUSA

Posted 05 April 2013 - 02:38 PM

Hey there! I've actually wanted to do the same type of project myself, but with the raw Lua Language and i've been doing my fair share of research to get started.

First off, I'd recommend learning tables and how to use them.
They're super useful.

Second, as a demonstration of using a table to make it easier to index and recall data, I'll change this:
local playerName = "Steve"
local xpGained = 0
local xpLevel = 0
local inventory = {"nil", "nil", "nil", "nil", "nil"}
local weapon = "nil"
local health = 20
local hunger = 20
local armor = 0
local damage = 1,5

To this:
player={
name="Steve"
xpLevel = 0
inventory={
  [1]=nil,
  [2]=nil,
  [3]=nil,
  [4]=nil,
  [5]=nil
},
weapon={
  damage={
   min_dam=1,
   max_dam=5
  }
},
armor={
  protection=0
},
}

With this, you'll be able to recall any information very easily whenever you need it, as well as set the data to a new value when an event happens, such as getting more XP, a new weapon, etc.

#6 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 05 April 2013 - 02:42 PM

View Postmikey53591, on 05 April 2013 - 02:38 PM, said:

Hey there! I've actually wanted to do the same type of project myself, but with the raw Lua Language and i've been doing my fair share of research to get started.

First off, I'd recommend learning tables and how to use them.
They're super useful.

Second, as a demonstration of using a table to make it easier to index and recall data, I'll change this:
local playerName = "Steve"
local xpGained = 0
local xpLevel = 0
local inventory = {"nil", "nil", "nil", "nil", "nil"}
local weapon = "nil"
local health = 20
local hunger = 20
local armor = 0
local damage = 1,5

To this:
player={
name="Steve"
xpLevel = 0
inventory={
  [1]=nil,
  [2]=nil,
  [3]=nil,
  [4]=nil,
  [5]=nil
},
weapon={
  damage={
   min_dam=1,
   max_dam=5
  }
},
armor={
  protection=0
},
}

With this, you'll be able to recall any information very easily whenever you need it, as well as set the data to a new value when an event happens, such as getting more XP, a new weapon, etc.

Yea, going object oriented is a very good way to go in general. Especially with an RPG.

#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 05 April 2013 - 04:27 PM

View Postoeed, on 05 April 2013 - 02:42 PM, said:

Yea, going object oriented is a very good way to go in general. Especially with an RPG.
And or game engine. It allows multiple instances of game objects without having to do some serious coding and duplication to do so.

#8 Tjakka5

  • Members
  • 256 posts

Posted 05 April 2013 - 08:01 PM

View Postmikey53591, on 05 April 2013 - 02:38 PM, said:

-snip

With this, you'll be able to recall any information very easily whenever you need it, as well as set the data to a new value when an event happens, such as getting more XP, a new weapon, etc.

I was actually planning to make that a table right now!
I dont know why I though of that when I made those variables... It would have been much smarter, 'cause I can store it in files pretty easialy then!

BTW: I think I have though of a nice layout, which I hope will be made pretty soon!

#9 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 07 April 2013 - 12:15 AM

View Posttheoriginalbit, on 04 April 2013 - 11:30 PM, said:

Its good to see another game on the forums. Can't wait to see it finished.

You may benefit from using this function

local function centerWrite(msg, y, yOffset)
  local sw, sh = term.getSize()
  local yPos = y or sh/2 + (yOffset or 0) -- if y is not provided make it the middle of the screen, the yOffest variable is to move the text around the center, so if -1 is provided it will be 1 line above the center of the screen, if 2 is provided it will be 2 below the center
  local xPos = sw/2 - #msg/2 + (#msg % 2 == 0 and 1 or 0) -- find the start position of the text, if the text is an even size shift the position by +1 so that is still looks as though it is in the center
  term.setCursorPos(xPos, yPos)
  write(msg)
end

You can then just do this
centerWrite("P R E S S   A N Y   K E Y") -- this will be printed in the middle
centerWrite("T O   C O N T I N U E", nil, 1) -- this will be printed 1 line below the center
-- your code to wait for key press
centerWrite("R P G   G A M E", nil, -4) -- this will be printed 4 lines above the center

-- another example
centerWrite("S O M E  S E T  T E X T", 4) -- this will be printed at line 4
centerWrite("S O M E  S E T  T E X T", 4, 1) -- this will still be printed at line 4, offset is ignored when you provide a y position

I always use this, And I think it would be simpler for him..
w,h = term.getSize() --Gets the size of the monitor/terminal

function centerPrint(y,text)
   term.setCursorPos(w/2 - #text/2, y) --Sets the cursor position to the middle
	  write(text) --Writes the text
  end

centerPrint(h/2,"This is some centered text!")


#10 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 07 April 2013 - 05:19 AM

View PostHellkid98, on 07 April 2013 - 12:15 AM, said:

I always use this, And I think it would be simpler for him..
The only main difference between yours and mine is this bit
(#msg % 2 == 0 and 1 or 0)

Which just insures that it always LOOKS like it is in the centre of the screen. Even length strings require that offset of 1 to look good.

#11 Tjakka5

  • Members
  • 256 posts

Posted 08 April 2013 - 07:38 AM

Okay, I wasnt working on it this weekend, but I just added the centerprint function, and I have to admit...

Its pretty awesum.

#12 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 08 April 2013 - 07:39 AM

View PostTjakka5, on 08 April 2013 - 07:38 AM, said:

Okay, I wasnt working on it this weekend, but I just added the centerprint function, and I have to admit...

Its pretty awesum.
Told you :P it does make it very easy.

#13 Tjakka5

  • Members
  • 256 posts

Posted 08 April 2013 - 10:06 PM

So... Yesterday evening.. damn...


I was like "Lets just add this function, and then go to sleep"
It became "Ya know, I feel like programming, lets just get this map going. [...] Okay, thats good, but I realy need to sleep now... But I would realy like to see the player run around... [...] ...But then I need this function... [...] Oh, and this needs to be added too... [...] Hm, why wont this work and- WAIT, IS IT THIS LATE?!"

So now I'm tired and there will hopefully be a new version out this evening, which has:

-First testing map done...
-Map properties.
-Key clicking options.
-Tick is done.
-And the basics for the player to run around...

Also, what is the best way to 'store' a map, this is how I'm doing it now:
-- testMap1
-- ''[]'' is a block, ''  '' is air.
local testMap1x1 = {"[]", ''[]'', ''  '', ''  '', ''[]''}
local testMap1x2 = {''  '', ''  '', ''  '', ''[]'', ''[]''}

local testMap1x1Props = {''solid'', ''solid'', ''air'', ''air'', ''solid''}
local testMap1x2Props = {"air'', ''air'', ''air'', ''solid'', ''solid''}

And how I load it for now...

-- Load testMap1
for i = 1, 5 do
  term.write("" ..testMap1x1[i]
end
print("")
for i = 1, 5 do
  term.write("" ..testMap1x2[i]
end

I have a better Idea for storing the properties, and loading it, but how do I save it better?

#14 Tjakka5

  • Members
  • 256 posts

Posted 10 April 2013 - 12:28 AM

Woopsy, something went wrong, now there a bugs, and some things arent implemented...

Expect a v 0.4 soon, maybe tonight, but dont expect to much.

#15 Jian

  • Members
  • 15 posts

Posted 10 April 2013 - 07:41 AM

View PostTjakka5, on 08 April 2013 - 10:06 PM, said:

Also, what is the best way to 'store' a map, this is how I'm doing it now:
-- testMap1
-- ''[]'' is a block, ''  '' is air.
local testMap1x1 = {"[]", ''[]'', ''  '', ''  '', ''[]''}
local testMap1x2 = {''  '', ''  '', ''  '', ''[]'', ''[]''}

local testMap1x1Props = {''solid'', ''solid'', ''air'', ''air'', ''solid''}
local testMap1x2Props = {"air'', ''air'', ''air'', ''solid'', ''solid''}


I would recommend changing the setup you have here. Instead of having two separate tables for the map with one map defined inside of it, have a table with possible items across all maps and then a table to represent them on a map.

So basically right now you have 2 possibilities.. a box which is solid or air...

you could display those like this

mapProps = {
	box = { render = "[]" , solid = true } ,
	air = { render = " " , solid = false } ,
}

which allows you to do more things, like color for example..

mapProps = {
	"box" = { render = "[]" , solid = true , bgColor = colors.brown , fgColor = colors.orange } ,
	"air" = { render = " " , solid = false , bgColor = colors.lightBlue  } ,
}

You should also consolidate the maps into one table. You can use the labels as your xPos and then the labels inside of that as your yPos..

testMap1 = {
[1] = { "box" , "box" , "air" , "air" , "box" } ,
[2] = { "air" , "air" , "air" , "box" , "box" }
}


If you can make it a single character instead of "air" or "box" , it would be really easy to make maps with a few strings in a table. Sort of how paint and the .nfp format works.
Not sure if any of this is actually useful but I hope I helped steer you in the right direction.

#16 Tjakka5

  • Members
  • 256 posts

Posted 11 April 2013 - 06:29 AM

^ I was planning on doing that, but wasnt sure how to do that, so thanks for that.

Also, since I didnt have time yet, I will now update the program! Expect it withing 20 minutes!

EDIT: Incase I'm not able to upload it now, here is V 0.3 (Sloppy and dumb, but it has progress): pastebin.com/hRvepdnV

#17 Tjakka5

  • Members
  • 256 posts

Posted 11 April 2013 - 06:57 AM

Yay! v.04 is out!
Sadly, there is a game breaking bug, and I dont have time to fix it right now, so if anyone could figure it out for me, cake will be given!

v.04:

http://pastebin.com/XGqEjKD3/

#18 Tjakka5

  • Members
  • 256 posts

Posted 12 April 2013 - 03:28 AM

HumpedieBUMPdum.

Okay, I can't figure out why it ain't working D:
I need help! Posting this in 'Ask a Pro' now!

#19 dmitchell94

  • Members
  • 19 posts

Posted 15 April 2013 - 06:14 PM

love to see some screenshots

#20 Tjakka5

  • Members
  • 256 posts

Posted 15 April 2013 - 09:50 PM

View Postdmitchell94, on 15 April 2013 - 06:14 PM, said:

love to see some screenshots

I'll try to make v 0.5 and upload it together with some screenshots.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users