Welcome to the bikiniverse!

It’s about time I did a dev diary as it would be useful for me to keep track of the project and be able to see my progress a little more clearly. Although I do worry about the number of dev diaries i see with a total of one entry…

I started playing with a programme that i think was called Game Maker in about 2001 (the icon was a red ball). One of the first things I did was create a top down character that could move in four directions (after “hello world”, I think that is the first thing everybody does…) and, after playing around for a little while, I discovered a fun mechanism, where you control two top-down characters at the same time. Then nothing happened for a long time. And about two years ago I started working with Stencyl, in order to bring my idea to life (my band had recently broken up). And that’s when I made the first version of Welcome to the Bikiniverse!

http://www.stencyl.com/game/play/35569

The game works and is basically finished, but I had a lot of trouble making the graphics look nice and lost faith in the programme “stencyl” a little bit… and it was when i started looking for alternative software that i found defold.

I’ve been with defold for almost three weeks, (mostly inspired by the competition), and I’ve started working with a graphic designer as well in order to get it looking more professional. I’ve never done any coding before so I am asking for a lot of help (…thanks everyone).

So far I have:

  1. Firstly and foremostly, a hard-working and foolproof movement system for the two characters. Synchronised, grid-based movement was a really interesting programming challenge and I’d be curious to see how other people would tackle it. It only uses triggers for collisions.
  2. A working menu and level select screen, which you can scroll around, and in general looks neat.

…and that’s it. It seemed like more before I wrote it down. Next on my list I have to

  1. Learn about animation and put animated sprites into the game (and music!)
  2. programme the tutorial levels and the first 2 worlds.
  3. learn about saving and loading
  4. make it look impressive
  5. submit it to the competition
  6. ???
  7. profit.
4 Likes

Cool! The synchronised grid based movement for two characters is pretty neat and can provide interesting game play challenges. Good luck with your game!

Today I have decided to learn about saving and loading. This is a vital part of the controls tutorial (checking if a player has already completed the tutorial, for example) as well as allowing players to unlock levels based on their progress.

There are two important variables that need to be saved:

  1. If a level’s donut has been collected already
  2. the total number of donuts that have been collected.

The best way to achieve this is a table with one entry for each level. Then I can check the contents for each table entry by number. It’s gonna be a long day!!

1 Like

FIRST SUCCESS!!

Tables are apparently very simple. I can create one, and access a specific number

function init(self)
weekdays = {"Sunday", "Monday", "Tuesday", "Wednesday", "BONERday", "Friday", "Saturday"} --this is a table
print(weekdays[5]) --this accesses the 5th entry in the table called weekdays
local my_file_path = sys.get_save_file("my_game", "weekdays") --this saves
if sys.save(my_file_path, weekdays) then
print("I JUST SAVED MYSELF") --this prints on a sucessful save
end
end
1 Like

SECOND SUCCESS!

arithmetically adding all the values is as easy as:

saveddonuts = {2, 2, 2,} --makes a table with three numerical entries (each entry is the number 2)
totaldonuts=0 --defines localdonuts so we can do arithmetic on it later
for key, value in pairs(saveddonuts) do --this means "do for every entry in the table 'saveddonuts'"
totaldonuts= totaldonuts+value
end
print(totaldonuts) --prints 6, which is the result of 2 + 2 + 2

and changing a value in a table is as easy as:

saveddonuts[2]=1 --sets the second entry in saveddonuts to 1

First problem:

This code loads a table, prints the contents of the table, overwrites the table with new data, then prints again, and then saves.

The problem is that the table never loads, it just comes out blank. Any help?

function init(self)
saveddonuts=sys.load("bverse")

--prints the table
pprint(saveddonuts)

--creates table
saveddonuts = {2, 2, 2,} 

--prints the table
pprint(saveddonuts)

--saves the saveddonuts table
local my_file_path = sys.get_save_file("bverse", "saveddonuts")
if sys.save(my_file_path, saveddonuts) then
print("I JUST SAVED MYSELF") 
end

end

…okay the correct code (in my play-around that is just to show how saving works) is

function init(self)
local my_file_path = sys.get_save_file("bverse", "saveddonuts")
saveddonuts = sys.load(my_file_path)

--prints the table
pprint(saveddonuts)

--creates table
saveddonuts = {2, 2, 2,} 

--prints the table
pprint(saveddonuts)

--saves the saveddonuts table
local my_file_path = sys.get_save_file("bverse", "saveddonuts")
if sys.save(my_file_path, saveddonuts) then
print("I JUST SAVED MYSELF") 
end

end

Is saving limited to 194 entries in a table or something? for me everything after 194 is just cut off.

The limitations of sys.save() are listed in the documentation:

“Internally, this function uses a workspace buffer sized output file sized 128kb. This size reflects the output file size which must not exceed this limit. Additionally, the total number of rows that any one table may contain is limited to 65536 (i.e. a 16 bit range). When tables are used to represent arrays, the values of keys are permitted to fall within a 32 bit range, supporting sparse arrays, however the limit on the total number of rows remains in effect.”

1 Like

http://forum.defold.com:/uploads/default/original/2X/9/9a33fd60b7d65761b9c88b2b6ed900ad18cc62af.mov

Particle effects (it’s a jetpack, i just haven’t drawn the jetpack in yet)

5 Likes

more fun with particles!!

(using 3 particle emitters within different game objects, and then offsetting the position of those gameobjects by camera position mulitplied by x, it’s possible to get a cute 3D effect:

http://forum.defold.com:/uploads/default/original/2X/a/a57211b7fea8a878fb2c0c41175a433734fa0a01.mov

4 Likes

https://forum.defold.com:/uploads/default/original/2X/6/650340823c409b18e81690b6dd3f71c060f6d158.mov

fun with particles part 3: i made this very subtly glowing pink star. I’m REALLY happy with it because it tends to take me a long time to get graphics that I am happy with.

3 Likes

Hey… is there any way to simulate a key press/release?

edit: I sorted this out with a local function, because I believed it to be impossible.

1 Like

You want to know what is hard? Character design and animation.
edit: another mini question. Is it possible to change the default background colour, and where can you do it?

Yes, the default render script can receive a clear_color message. Like this: https://github.com/britzl/minimegaparty/blob/master/main/main.script#L62

It is also documented here: clear_color

1 Like

thanks @Mathias_Westerdahl and @britzl.

I just want to celebrate the most complicated equation in my game until now. It’s

alpha == (cos(y/127.32406202)*10) -9

And it is going to fade in/out some text based on the position of the camera ( i say going to because it currently only exists on paper)

2 Likes

I think I want to make a custom easing curve. I understand the concept of easing, but I don’t understand what the 0s and 1s mean here. Or why there are so many of them. Can anyone provide me an explanation (or a link to an explanation?)

local values = { 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1 }
local square_easing = vmath.vector(values)
go.animate(“go”, “position.y”, go.PLAYBACK_LOOP_PINGPONG, 100, square_easing, 2.0)

EDIT: I believe I know understand easing. I would be curious to see what the default defold curving vectors look like, though. Could anyone tell me where they are stored?

They are stored internally in the engine. Each easing type consists of 64 values in a lookup table. All of them are calculated from a set of easing equations, something like these: https://gist.github.com/gre/1650294

1 Like

@britzl once again your help has been invaluable.

https://forum.defold.com:/uploads/default/original/2X/1/1d7434798577686c3d3581642b972b938519efd1.mov

Quick shot of the animation that I’ve made. When the player walks, the body tilts forward, the face lowers, and the little legs go round in a kind of triangle pattern. All of it is done with go.animate with position for the various different sprites.

One thing that I would greatly appreciate would be the ability to interact with a sprite’s position, rotation and scale without having to put it into a game object. Many times I have added a sprite, only to realise that in order to utilise it I have to change the whole structure of the GO and collection, and it is making my level.collection waaaay more complicated than it needs to be.

1 Like