6 posts (Page 1 of 1)

MAY 17, 2017

Making o: LD38 recap

As is tradition, I participated in ludumdare last month, and made o. If you haven't played it yet, go play it!

o.

Time

I was actually busy most of the time during LD weekend. I had my laptop with me, so when I wasn't doing anything I worked on LD. I had an idea: make a simple world building game. You are probably shaking your head, because this is so complex, but I hadn't thought of it. Basically I spent the whole weekend trying to make something, and only got to an inventory. no actual gameplay.

Yes, I spent the whole weekend on this

I got home on Sunday, and booted up my desktop (a proper computer, at last!) I decided I was going to start from scratch. On the last day for compo, and I had classes the next day. Was it a bad idea? No.

Created a new git repo, opened up vim and made a circle. That was going to be a planet. I was going to put a character on it, but due to the lack of time I just settled with a smaller circle as a temp graphic. Turns out, this actually looks quite good, so I kept it. I had to think of a way to keep position. X and Y would be pretty hard to do calculations with, so I didn't know what to do. Turns out there's this very useful thing, called radians. They're easy to do maths with, you can just use sin and cos to get its position on the circle! So, radians it was.

-- circle_size = the radius of the planet
-- height = how high you are jumping
-- pos = your position, in radians.
love.graphics.ellipse("line", love.graphics.getWidth()/2+math.cos(pos)*(circle_size+height), love.graphics.getHeight()/2+math.sin(pos)*(circle_size+height), 10, 10, 50)

I refined it much more

It was already very early monday at this point, so I shut off my computer and went to bed, returning at ~3PM.

The next day!

I started off by adding particles. I did this by creating a certain number of circles around the player, and shrinking them each frame. It actually looks quite nice! Of course, explosions need screenshake too, so I added that (pretty proud of this one, I used a variable to control how long the screenshake should last. Pretty simple, but nice)

for i=0, love.math.random(5, 20) do
    local px = love.math.random(-10, 10) + love.graphics.getWidth()/2+math.cos(pos)*(circle_size+height)
    local py = love.math.random(-10, 10) + love.graphics.getHeight()/2+math.sin(pos)*(circle_size+height)
    local psize = love.math.random(0, 10)
    table.insert(particles, {x=px, y=py, size=psize})
end

In the meantime, I also made the planet shrink. I also had an idea of how I should make this: You shoot enemies to keep the planet from going too small.

Boom!

Alright, this is nice, but there's no actual game yet. So, off to that!

First, I added bullets. I decided these ...

Read more
APR 24, 2017

o

gameplay

your goal is to keep the planet from shrinking for as long as possible

when you kill an enemy, the planet grows, but the shrinking speed also increases

arrows to move

z to jump

x to shoot

made for LD38 in around 1 day

play here

FEB 2, 2017

One month of pixel art

In Januray 1st 2017 I challenged myself to do pixel dailies every day for the rest of the year. It's been a month and I've done every one of them, so here they are!

Toast Rock pool Curse Bunker Gauntlet Miner Angry human mage Computer Massive Cemetery Bridge Raft Beetle #1 Skater beetle #2 Sea serpent Bombermen Volcano Desk Bishop Food Willy wonka Power rangers Lighthouse Shrine Coin Skyline + superman Clone Tavern Police car aka police spaceship OW Bastion Kiosk

Hope you like them :D

OCT 29, 2016

Bugs

As you might have noticed, I recently switched to disqus for comments. It was working fine, until today the site was taking around THIRTEEN seconds to load. That's a lot. And I'm only talking about the HTML.

However, I noticed that the admin pages, site pages, static files and unpublished articles loaded just fine. Here are the average times for each:

  • Admin: 100ms
  • Static: 70ms
  • Page: 70ms
  • Unpublished post: 80ms
  • Published post: 6s
  • Home page: 13s

Woah, what's going on there?

The only difference between unpublished and published posts is a little DRAFT notice and the lack of comments. Since I doubt that it's the draft notice, I went on to disable comments... but I couldn't ssh to the VPS. After a few reboots I realized my IP had changed, and that's why I couldn't login. However, I also noticed that right after rebooting, the home page was down to about 600ms. Still a lot, but definitely an improvement. Happy with my success, I just left it, only to come back later and notice it's now taking around 2 seconds to load.

Fuck

So, it increases over time. Great. Well, I disabled comments and come back.

  • Home page: 600ms
  • Published post: 300ms

As of writing, there are 2 posts, so I assumed it was taking ~300ms to fetch each post from the database. So, I added another post. Home page still 600ms.

That is when I decided to write this post.

Since I began writing, the time to load the home page increased by about 200ms.

I have absolutely no idea what's causing this.

The code is available here, if you want to take a look (I wasn't able to reproduce it on my home pc). Good luck.

UPDATE: I published this, and it's taking 80ms to load... Again, no idea what's wrong here. Same thing with comments. So yeah, comments aren't the cause. They're back now.

OCT 1, 2016

Making a quizz website - Part 1

About a week ago, I decided to make a quizz website, because I wanted something free, and also so I could get the experience from it. Oh boy what did I get myself into...

Note

This isn't going to be a tutorial, it's just showing how the website works.

Set up

I decided to use Django for this, because it's my favourite web framework, written in my favourite language. That's it on the back-end, at least for now.

Starting out

Being Django, I had to create a few models to hold the quizz information.

Quizz model

This will hold information about the quizz (author, title, description, url). It's pretty simple:

class Quizz(models.Model):
    quizz_uid = models.SlugField(max_length=32, default=generate_uid, unique=True)

    author = models.ForeignKey(User, null=True, blank=True)
    quizz_name = models.CharField(max_length=140)
    quizz_description = models.TextField(blank=True)

    pub_date = models.DateTimeField(default=timezone.now)

    def __str__(self):
        return self.quizz_name

    class Meta:
        verbose_name_plural = "Quizzes"

Notice how we use a SlugField instead of a CharField for the url: This is just to make sure the quiz_uid will convert well to a url. You can find more information about it here.

generate_uid is a simple function that generates a random 32 character long string:

def generate_uid():
    uid = "".join([random.choice(string.ascii_letters+string.digits+"_") for _ in range(32)])
    return uid

Later, I need to make this check if the uid is already in use.

We also set a verbose_name_plural, to make the admin call it Quizzes instead of Quizzs.

Question model

This will hold information about a specific question (duh), such as: - Points for correct - Points for incorrect - Question name - Question description

class Question(models.Model):
    quizz = models.ForeignKey(Quizz)

    question_title = models.CharField(max_length=256)
    question_description = models.TextField(blank=True)
    points_correct = models.IntegerField(default=5)
    points_incorrect = models.IntegerField(default=-2)

    def __str__(self):
        return self.question_title

I don't think this needs much explaining.

Option model

This will hold information about... you guessed it, the options for a particular question!

class Option(models.Model):
    question = models.ForeignKey(Question)

    option_text = models.CharField(max_length=140)
    correct = models.BooleanField(default=False)

    def __str__(self):
        return self.option_text

Noticed how we didn't set a correct answer on the Question model? That's because we are setting if an option is correct on the option model. This allows us to set multiple correct options!

I also made admin pages for each of these models, but I think you can do that yourself.

Showing the quizzes

This is where things start to get interesting, we're making a front-end!

I wrote my own CSS for this, but that doesn't matter much so I won't be showing it here (also, it's over 140 lines long...)

For the initial page, which will be at /quizz/[uid]/, I'm just showing the title, the description and a simple 'Start quizz' button:

Template:

<h1>{{ quizz.quizz_name }}</h1>
<p>{{ quizz.quizz_description }}</p>
<a href="{% url 'quizzes:startquizz ...
Read more
SEP 11, 2016

New website, new hosting

Hello there! Welcome to my new website! This is made using Django, and runs on a VPS on DigitalOcean (that might or might not be my referral link) instead of the all-in-one shared hosting I had before.

Why?

Well, first of all setting up anything other than php on my old hosting was a mess. I even tried setting up this website on it, and I gave up after 2 days because it was just so complicated.

Using a VPS means I can host everything I want to, including:

  • Game servers
  • IRC bots
  • Shitty projects
  • Pretty much anything really

Couldn't you do that from your home with a spare PC?

I could, but my upload speed is actually rather slow (5Mbps :I) compared to my download speed (150Mbps). Not only that, the only spare PCs I have are very old, slow and noisy. The specs are worse than my 5$/month plan (plus, the VPS doesn't make any noise!)

Also, given that I don't have a static IP, I'd have to be reconfiguring the DNS every so often and I just can't be bothered to do that.

How long did this take to set up?

About a day, mostly because I couldn't figure out how to use python 3 instead of 2!

Is the source code available?

Yep!

Will you be adding

--Soon!-- They've been added!

I have a suggestion, where can I send it to you?

Email it to pta2002@pta2002.com! I'll try to reply ASAP.

That's all I have, I should also note that the old website is archived and I'll put it up soon!

« Older Newer »