Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Harkins

Pages: [1] 2 3 ... 18
1
How many rows did you test with? How long did the query take to execute?

2
Coding Discussion / Re: [MySQL] order of fields modification question
« on: March 12, 2014, 03:12:24 PM »
They don't look like the same query to me because the second one assumes that power == basepower beforehand. But if that's the case...

They are equivalent because of non-standard behavior on the part of MySQL. The manual says:

Quote
If you access a column from the table to be updated in an expression, UPDATE uses the current value of the column. For example, the following statement sets col1 to one more than its current value:

Code: [Select]
UPDATE t1 SET col1 = col1 + 1;
The second assignment in the following statement sets col2 to the current (updated) col1 value, not the original col1 value. The result is that col1 and col2 have the same value. This behavior differs from standard SQL.

Code: [Select]
UPDATE t1 SET col1 = col1 + 1, col2 = col1;
Single-table UPDATE assignments are generally evaluated from left to right. For multiple-table updates, there is no guarantee that assignments are carried out in any particular order.

MySQL has done this for a long time, but they could change their mind anytime. Between that and how easy it would be to drift into undefined behavior if you ever change this to a multi-table update, I'd avoid the ambiguity.

3
I have no idea, sorry.

Because this has to create a temporary table (that it fills with the new position numbers and ids), I would not be surprised if it was an awful solution for large tables. You should stress test it with a realistic-sized table.

4
This is probably the most complicated MySQL query I've ever written. Thank you for this fun puzzle, Chris.

Code: [Select]
update claims c, (select id, @N := @N + 1 as pos from claims i, (select @N:=0) dummy order by i.pos) newpos set c.pos = newpos.pos where c.id = newpos.id;

if anyone wants to play with it, here's the setup. Note that I'm deliberately inserting claims out-of-order; an early attempt failed because MySQL happened to sort the subquery temporary table by insertion order - always something to check for when doing weird things.

Code: [Select]
create database if not exists test;
create table claims (id int auto_increment not null, pos integer, PRIMARY KEY(id));
insert into claims (pos) values (17);
insert into claims (pos) values (25);
insert into claims (pos) values (46);
insert into claims (pos) values (99);
insert into claims (pos) values (5);
insert into claims (pos) values (45);
insert into claims (pos) values (140);
select * from claims order by pos asc;

5
Coding Discussion / Re: Session timeout
« on: March 06, 2014, 11:02:52 AM »
http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime

But that's probably overkill. Just set $_SESSION['last_page_at'] = time(); and then check
Code: [Select]
if ($_SESSION['last_page_at'] < time() - 10)

6
Revenue & Promotion / Re: $100 per day with online games?
« on: March 03, 2014, 02:27:10 PM »
Congratulations on your success, that's great.

Can you talk about your free to play store? What do you sell, what's worked and what hasn't?

7
Game Design / Re: Tutorial techniques
« on: February 06, 2014, 12:02:08 PM »
This feature is called a "tour", and you can find many Javascript libraries to do it. Intro.js and Tourist.js are both good.

8
Coding Discussion / Re: Brace Styles
« on: February 01, 2013, 07:39:31 PM »
I use languages without braces to delineate flow control.

9
Game Design / Re: Raiding and Plunder
« on: September 10, 2012, 09:39:10 AM »
[blockquote]A lot of us here are old geezers that do not enjoy games anymore :)[/blockquote]

Heh. Though in this case, it's that I'm tired of seeing the broken game design for 15 years. So I over-react to the vague description that started the thread with "Oh no it's the same crap again" even if hey, maybe they'll do something brilliant. I think there probably is an awesome no holds PVP design out there waiting to get discovered, but right now I've seen so much of the rich-get-richer abuse-fests that I'll never be the one to find it. Or probably even to recognize it for the first few years.

But meanwhile I couldn't be happier about loving games. I'm nuts about playing Realm of the Mad God; it's the first time I've put some money into a freemium game. And I'm also playing a lot of Spelunky and Flash Duel this weekend, though neither is a browser game.

Anyways. Sayid: good luck with your game. I hope you find a way to break out of the bad designs. I gripe and link doomsaying blog posts because I've seen it go bad so many times, but I hope you can learn from it and make an awesome game.

10
Game Design / Re: Raiding and Plunder
« on: September 08, 2012, 10:27:18 AM »
Don't. In a persistent game it's nearly impossible to make fun for anyone except sociopathic teenage boys.

11
Introductions / Re: Hello!!!
« on: July 17, 2012, 11:23:40 AM »
isabel is a spammer. They posted one or two extra useless comments so their link to a domain seller would stay up.

12
Coding Discussion / Re: New post notification (shoutbox)
« on: June 07, 2012, 11:26:14 AM »
Are the three shoutboxes fixed types? Like Alliance, Location, Group?

Shoutbox table: id, name, type
Subscription table: player_id, alliance_id, location_id, group_id, alliance_new, location_new, group_new;

When someone chats, 'update subscriptions set ${type}_new = true where ${type}_id = $shoutbox_id'.

(Don't see why you'd need timestamps at all.)

13
Game Design / Re: First browser game.....PLEASE HELP!
« on: May 04, 2012, 06:31:30 PM »
If you have a couple bucks, you could sign up for a VPS at <a href="http://linode.com">Linode</a> and install PHP there. They have a web-based console, so nothing would be installed on your computer.

In any case, the fact that you're making a game, whatever the limitations you have to deal with, bodes well for your success. Stick to it, and good luck. :)

14
Coding Discussion / Re: java script problem
« on: April 18, 2012, 03:12:49 PM »
Code: [Select]
setTimeout(function() { display("l", 500, 1000, 7); }, 2000);
In your original code, you are running display and passing whatever it returns to setTimeout. This passes an anonymous function to setTimeout that calls the function. It'd be even better to give this a useful name:

Code: [Select]
var display_whatever_this_displays = function() {
  display('l', 500, 1000, 7);
};
setTimeout(display_whatever_this_displays, 2000);


15
Game Design / Re: Concept: No visible usernames
« on: March 25, 2012, 10:43:45 PM »
Why are you considering doing this?

16
In PHP, yes, this is how you do it. I even wrote a blog post about how a few years ago.

17
Game Design / Re: Planets with many players fighting each other
« on: February 06, 2012, 10:14:20 AM »
Change theme from noble houses to corporations. They're fighting over control of the media and lobbying to reach their markets. So there's no temptation for violence, they just want to accumulate radio stations, tv shows and channels, movies, and eventually level up to buying legislators and other elected officials. The more they buy, the more they can sell in products, but there's a fairly zero-sum supply of these resources.

18
Web Design & Graphics / Re: Find free icons for your game
« on: January 22, 2012, 10:36:29 PM »
http://www.thenounproject.com has lots of nice, free black and white icons

19
Coding Discussion / Re: Strange MySQL float behaviour
« on: December 27, 2011, 08:08:07 PM »
http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Floats accumulate error. You really want to be using decimal or integer for currency values.

20
Coding Discussion / Re: Server performance (2011)
« on: December 17, 2011, 06:03:02 PM »
http://www.NewRelic.com can make a huge difference - you drop their plugin into to your code and their website will track performance and highlight problems. It doesn't give you more hours in the day, but it means you spend a hell of a lot less time wondering where problems might be.

21
Coding Discussion / Re: Methods That Break Mysteriously
« on: November 17, 2011, 09:37:15 AM »
Write automated tests and use version control software and these problems will quietly vanish. I spent the first ten years of programming plagued by them, now I don't know the last time I saw stuff randomly break.

I'm guessing you're using PHP, SimpleTest looks like a straightforward tool. If you're on Windows, git is probably a big pain in the ass, but TortoiseSVN makes Subversion easy to use.

Let your tools do all the boring, tedious bookkeeping so you can write code.

22
Game Design / Re: Farming
« on: October 12, 2011, 10:42:54 PM »
As for unploved fields for livestock, in the past they were leaving 1/4 of the land "unoccupied" to let the ground "rest". I guess this could be used as pasture? Later they invented 1/3 system (rotation of crops) where no land had to rest, which would mean no more free land for grazing...
Nowadays, the land has classes (based on fertility) and the worse one is used as pasture. That's how it goes for history and realism, not sure if usable for a game.

You could use Conway's Game of Life to iterate which fields grow and which don't. Make it so player's can't choose every individual field they get to plant, they have to click groups at once, like a stamp. Then the players who best envision the way the field will grow and evolve will get more crops - player skill, not character skill.

23
Game Design / Re: Farming
« on: October 12, 2011, 10:37:50 PM »
For a medieval themed game. The basic mechanic is standard energy bar which replenish over time, you use it to perform actions.

I like to call these fun meters. When the meter runs out, you're not allowed to enjoy the game anymore.

24
Hosting & Domains / Re: Which VPS host do you recommend?
« on: October 06, 2011, 12:13:41 AM »
(To be honest, we don't need that big of a database server... with 250 active users, during the most active time, we don't get past 7% CPU.) The 6 micros each run at about 20% cpu.

Wow. Why so many web app instances? Do you use a lot of ram/disk? I've heard a number of people say I/O is their real limiting factor on EC2, has that been the case for you?

25
Coding Discussion / Re: Currency (variable)
« on: September 29, 2011, 09:09:22 AM »
Store everything as cents, show dollars and cents to users. Floats will have rounding errors, yes.

Pages: [1] 2 3 ... 18

SimplePortal 2.3.3 © 2008-2010, SimplePortal