The Really Great RPG PC thread!
IAmRalseiCreated:
Actually wait a second
Edit: additional z-sorting image! Look at this! It's really easy to implement! Extremely elegant, too!
The Explanation. This is cool and all, but what's going on here?
cool stuffPlease stop with the unnecessary spoilers and cryptic trash. I want to know actual information, not vague hype for something that will most likely die before it reaches my screen.
Alright, fine. I have completely abandoned the idea of the code snippet from the previous post. That's a disgusting way to do things, especially when you're going to add the setup-update-draw loop back anyway. I'm going to integrate SmileBASIC-style features into Love2D in a neat way. Here's a ***WORKING*** code sample.function setup() fishes = {} for i = 1, 64 do fishes[i] = Sprites.new(math.random() > .5 and 244 or 245) if math.random() > .5 then fishes[i]:toggleAttribute(Sprites.Attributes.FlipH) end if math.random() > .5 then fishes[i]:toggleAttribute(Sprites.Attributes.FlipV) end if math.random() > .5 then fishes[i]:toggleAttribute(Sprites.Attributes.Rot90) end if math.random() > .5 then fishes[i]:toggleAttribute(Sprites.Attributes.Rot180) end fishes[i]:toggleAttribute(Sprites.Attributes.Additive) fishes[i]:home(8, 8) fishes[i].variables[2] = (window.screen.width / 8) + (i * 2) fishes[i].variables[3] = (window.screen.height / 8) + (i * 2) fishes[i].variables[4] = i * 2 fishes[i]:addCallback(becomeFunky) end end function update() for i = 1, #fishes do fishes[i]:update() end end function draw() love.graphics.clear(0, 0, 0) Sprites.startBatch() for i = 1, #fishes do fishes[i]:draw() end Sprites.endBatch() end function becomeFunky(sprite) sprite:offset( sine(window.frames + sprite.variables[1], 120 + sprite.variables[4], sprite.variables[2], true) + (window.screen.width / 2), cosine(window.frames + sprite.variables[1], 90 + sprite.variables[4], sprite.variables[3], true) + (window.screen.height / 2) ) sprite:rotation( sprite:rotation() + 2 ) sprite:color( sine(window.frames + sprite.variables[1], 120 + sprite.variables[4], .5, true) + 1, sine(window.frames + sprite.variables[1], 180 + sprite.variables[4], .5, true) + 1, sine(window.frames + sprite.variables[1], 240 + sprite.variables[4], .5, true) + 1 ) sprite:scale( sine(window.frames + sprite.variables[1], 90 + sprite.variables[4], 2, true) + 3, sine(window.frames + sprite.variables[1], 90 + sprite.variables[4], 2, true) + 3 ) endWhile it is working, you can't run it right now, as you don't have the API. Pranked!!! Anyway, the screenshot. It shows off map importing, (from my dumb map format) the code I just wrote above, and z-sorting in my SmileBASIC API. All running at 60 FPS, with a minimal amount of draw calls. I'm thinking of calling my API Smiley, (Smiley2D? Smiley 2018 Pro Edition?) to carry on the legacy of TUTORIAL.PRG. Also, I'm working off of another API I made for Love2D that adds a lot of boilerplate, such as program flow, window.screen, pixel perfection, and sine functions. This is not part of RGRPG2, it's just a graphics demo. Think of it as the Super Mario 128 to RGRPG's Super Mario 64. Also, Minit's OST is extremely good, please listen to it.
Sprites.startBatch() for i = 1, #fishes do --' Dumb hack if fishes[i].type ~= "sprite" then Sprites.endBatch() Sprites.startBatch() end fishes[i]:draw() end Sprites.endBatch()
Progress Update! Text has been added to this API!
function setup() t = Text.new(50, 30) end function update() t:locate(math.floor(math.random() * t.width), math.floor(math.random() * t.height)) t:color(math.floor(math.random() * 16), math.floor(math.random() * 16)) t:print("Heck!", false) end function draw() love.graphics.clear(0, 0, 0) t:draw() endThe text cursor exists too, so this works!
t:print("I am on the first line!") t:print("I am on the second line!")Text coloring is also hardware-accurate, and if you clear the screen it fills the screen with background color. Then if you scroll the screen, you also see that it doesn't fill the screen with the background color! I also stole data from otyaSmileBASIC to make the text characters accurate to the SmileBASIC font GRP! Instead of using lazy "just calculate it on the fly" technology, I have decided to use the "GENERATE 4,000 QUADS AT STARTUP" technique! wait Never mind i found an edge case and I can safely say I hate COLOR 0, [any non-zero color here].
Progress Update! Text has been added to this API!oh coolfunction setup() t = Text.new(50, 30) end function update() t:locate(math.floor(math.random() * t.width), math.floor(math.random() * t.height)) t:color(math.floor(math.random() * 16), math.floor(math.random() * 16)) t:print("Heck!", false) end function draw() love.graphics.clear(0, 0, 0) t:draw() endThe text cursor exists too, so this works!t:print("I am on the first line!") t:print("I am on the second line!")Text coloring is also hardware-accurate, and if you clear the screen it fills the screen with background color. Then if you scroll the screen, you also see that it doesn't fill the screen with the background color! I also stole data from otyaSmileBASIC to make the text characters accurate to the SmileBASIC font GRP! Instead of using lazy "just calculate it on the fly" technology, I have decided to use the "GENERATE 4,000 QUADS AT STARTUP" technique! wait Never mind i found an edge case and I can safely say I hate COLOR 0, [any non-zero color here].
wait Never mind i found an edge case and I can safely say I hate COLOR 0, [any non-zero color here].Fixed... but at a cost. I now have an inverted copy of the font along with the font. I might try to use a shader to invert the font while drawing, so I don't have to use this copy. Nice! Edit: Heck yeah, I used a shader and it works! now time to sleep
Today I spent five hours on fixing sprite attributes. Anyway, everything's going pretty well other than that. Tomorrow I'll get a GitHub repository up for both my Template and SmileBASIC library. Anyway here's all my current progress:
https://youtu.be/TEZd4dWmKWM
https://youtu.be/H7CwEYJltgQ
Here's the repository, if anyone wants to see my horrible code. Not much progress, but I'm having a lot of fun with shaders. (Extremely basic shaders, but still funky)
I think your readCharacterListing function can be written as:
function readCharacterListing(filename) Text.Characters = {} local file = love.filesystem.read(filename) for character, x, y in file:gmatch("(%d+),(%d+),(%d+)") do Text.Characters[tonumber(character)] = love.graphics.newQuad(tonumber(x), tonumber(y), Text.Size, Text.Size, Text.Sheet:getDimensions()) end endEDIT: also why is gray called "DarkGray"? There aren't even any other grays
I'm going to change the color names to the ones listed in the Instruction List, as that is always the most reliable source of information free from errors.
Currently developing SPDEFs and readDefinitionListing, which does a similar thing, but is different enough that it needs its own function. SPDEFs will probably be the last thing stopping me from making the animations module thing. (aside from energy and school and real life) school isn't real
This is a cool project and I hate to be a Debbie downer, but I should mention a few things.
- Oracle vs. Google. https://en.wikipedia.org/wiki/Oracle_America,_Inc._v._Google,_Inc. Oracle sued Google over their use of the Java API in Android. It went back and forth for a while, but it looks like Google lost (personally I don't think APIs should be copyrightable). Re implementing SmileBasic's graphics API in Lua could be troublesome. Truthfully it probably would never go past a Cease and Desist, but still it is something to consider.
- Use of the SmileBasic fonts, graphics, and presumably down the line music and sound effects. These are owned by SmileBasic under copyright, and they could easily get you in legal trouble too.
Good luck, it looks like a cool project.Yeah, maybe uploading a few Spriter's Resource pngs wasn't a good idea. Anyway, 12Me21 helped with two things (fonts and spdef) but most of it is my awful code. The project sort of ran out of steam over the past 3 days, mainly because I fear all the awful hacks and uncommented code. Still might be useful to newbies. Heck, I'm wondering if I should port this to MonoGame or Haxe or something. I'm trying to find something that isn't SmileBASIC and something I can comfortably program in. Also, yeah Love2D has shaders now. They're actually pretty useful.
Leaked RGRPG Script:
Bonus: