Jump to content

  • Log In with Google      Sign In   
  • Create Account

SillyCow

Member Since 03 Sep 2008
Offline Last Active Apr 20 2016 04:25 AM

#5264811 Concept of abstraction in programming

Posted by SillyCow on 03 December 2015 - 04:52 PM

At the moment Scala is a very "naughty" language that tries to push the limits of the JVM. I have mixed feelings about it, but it's a real mind bender.

 

PROLOG is one of the most abstract languages I've ever used. It's quite old, but basically what you write is very loosely coupled with what actually runs. It is way more abstract than any notion of classes and pointers... Even the order of the commands (the instruction register?) is decoupled from how you write your code. Although it is not heavily used in the industry, it is very well studied in Academia. If you want to experience highly abstract code, try some  Prolog.

 

I've also heard interesting things about ERLANG. (never used it).




#5263056 HTML Spacing

Posted by SillyCow on 21 November 2015 - 05:45 PM

Your articles are not aligned on the left side either...

It just happens that your "left" div is taller than your "right" div (the one with twitter). 

 

The problem is that you are aligning each "article" div separately. Just create a center div and put all of your "articles" in that.




#5255659 Reducing the number of octaves in a song

Posted by SillyCow on 05 October 2015 - 09:45 AM


freely transpose the whole piece by the same number of semitones to make it fit in your feasible note range

But the pieces take up 4 octaves, whereas I only have 2.5. I can't see how moving the entire piece around would help. Geometrically speaking (for lack of musical lingo), the piece is too wide, moving it left or right will not make it fit in a narrow box...




#5255609 Reducing the number of octaves in a song

Posted by SillyCow on 05 October 2015 - 01:07 AM


would be simpler to arrange the pieces yourself than it would be to design an algorithm to make complex aesthetic judgments

That's what I feared...

Is there a way to obtain midi files that are intended for a certain instrament?

I am looking for pretty standard stuff, like famous classical works and fanfare.

I don't mind paying.

 

If not, is this "arrangement" process something that I could pay a reasonable amount of money to a freelance to carry out? This is a non profit hobby, so I'd say reasonable is <100$ for several famous pieces. Am I being optimistic here? I have no musical training, so I have no idea if this is a task for a highschooler, or something that requires Beethoven himself :-)




#5255568 Reducing the number of octaves in a song

Posted by SillyCow on 04 October 2015 - 02:55 PM

Hi,

I am a programmer and have very limited knowledge in music. 

I am building a robotic glockenspiel that can play midi files.

My problem is that most midi-files I encounter are for a piano.

A piano has a lot of octaves. My 27 note glock has 2.5 octaves.

Most midi that I want to play require more than 2.5 octaves, and as a result I am missing a bunch of notes.

 

Looking around on you-tube I have deduced 2 facts:

1. Some piano music uses redundant notes to sound more robust: I have encountered ferrere-jeaques played with bass chords, whereas all beginner xylophone tutorials teach it with single notes on 1.5 octaves.

2. I have seen some compositions of monster pieces like Tocatta and Fugue altered to be played on a xylophone. They were missing some notes, but they sounded allright.

 

 

As a programmer, I am guessing that there is some sort of musical transformation that I can make on a piano piece to make playable on only 2.5 octaves. As I am not trained in music, I do not know what that process is called, so Google is not helping out. What should I search for?

 

Also, is there some magical music program that could do this for me, and save me the trouble of writing my own algorithm?




#5252431 Linux c++ debugging

Posted by SillyCow on 15 September 2015 - 04:37 PM

Netbeans has a pretty good UI for gdb, and it also has the best graphical source control client for Linux. I think they purposely try to rip off VS. It also has some refactoring capabilities for C++.

Same goes for eclipse (although I personally prefer netbeans)

Nost importantly, there are some scripts you can install that will let you view inside STL containers in gdb.

 

I'm actually a VS junkie myself... If I can, I just use C++11 or boost, and debug as much as possible in Visual studio, then run on Linux as late as possible.

 

And +1 for valgrind. It's not my "go-to" debugger, but there's nothing quite like it for finding memory leaks.




#5232457 An unsual idea for a casual MMORTS

Posted by SillyCow on 02 June 2015 - 02:26 PM


 it closed down because it became boring after building your army (and some buildings) for the 50th time.
 
http://en.wikipedia.org/wiki/Majorem

That's why the building part is separate and persistant. You build your lander (base)  and landing crew (army) in orbit, and recycle it throughout the game.

 

 

 


You could even further extend this by allowing ground players to offer bounty on ground targets for reward, this could be balanced by saying there is some kind of governing body who adds funds to the bounty of weaker players.

That's a cool idea. I could also add some AI players that add a bounty on the strong players. That way there is always motivation to attack the bigger players. Maybe something like ransom: You "kidnap" an enemy unit, and demand a ransom for it. The strong player is handicapped until the ransom is paid (or until he kills you). Anyhow, a mechanic that adds motivation for attacking strong players sounds good.




#5232233 An unsual idea for a casual MMORTS

Posted by SillyCow on 01 June 2015 - 03:22 PM

I had a cool idea for an MMORTS.

I had a look at " Curiosity – What's Inside the Cube". The game was not that fun, but it had one element which really got me:

It was a "near real time" game (RT)

A single persistent map that everyone can play on simultaneously. (MMO)

But... No waiting rooms, no lost matches upon disconnect. You just turn the game on and play (Casual)

 

I thought about how I could go about applying these mechanics to a more serious, and more interesting game. A casual MMORTS game, that you could just turn on and play when you have 5 minutes.

 

Let's ignore the MMO-engeneering technical difficulties. (I have some cool cloud algorithms I'm aching to try)

 

Game Setting:

Imagine a setting similar to Dune. There is a single giant planet map. The planet holds a rare resource that everyone wants.

 

Lobby:

Each player starts out orbiting the planet. At this pre-mission stage they can build their lander and landing crew.

The lander is a giant vehicle, that serves as a base.

The landing crew are your units.

Once you are ready to land, you can view an overview map of the planet. On this map resources show up spontaneously every once in a while. (Meteor strikes/ Volcanic eruptions, etc...). The map is a giant zommable map of the entire world (sort of like google maps). You pick an area where there are some resources and you land. You can see other players who have landed, and you can chose a good spot: One that has lots of resources, or one that doesn't have many adversaries.

 

MMO Planet surface:

Once you land on the surface, you get your crew to mine the resource, and carry it back to your lander. Of course, there are other players in your area, and they can steal resources from your harvester units by destroying them. So you have to protect them using fighters. Your objective is to get the resources to your lander and take off. The server will make sure there are less resources than players, in order to force conflicts to happen. example: If there are 700 players on the suface, there will only bee 200 resource-meteor strikes at a time. Thus forcing everyone to fight
 
Casual:
If for some reason you disconnect, your units will automatically return to your lander and take off. As such, a disconnection is not very harmful.
The building stage (oufiting your lander) takes place in orbit in non-real time. So a disconnect will not set you back. In fact you can purchase a new unit for your lander when you have 2 minutes between classes, but only play the mission in the afternoon.
Space on your lander is limitted. This will prevent players from getting too powerful to fight. Advanced players will be considered advanced by the total amount of resources that they have harvested. Not necessary by single army strength. Perhaps a strong army will require a large upkeep, causing the army to "decay".
 
Social:
Since everyone is connected (hopefully without needing to register), it would be nice to experiment with some innovative social stuff. Example: Find a game mechanic to encourage co-located users (through ip-trace or GPS) to land on the same areas of the map. That way, if there are two random players riding on the same real world bus, there is a good chance that they will fight eachother (or team up). All done transparently though...
 

That's the basic idea. (I have some cool algorithms about distributed quadtrees, to dynamically host the planet's surface)

What do you guys think?

Also, I'd like to know if you know of anything similar which has been done before?




#5193523 Java - Maximum Recommended Threads At One Time ?

Posted by SillyCow on 18 November 2014 - 04:31 PM

Most answers are ignoring the word  "JAVA" in the title. Java has executors. If you want to use alot of threads, use a threadpool executor( or possibly a "stream" if you are using java 8).

 

Those are nice ways to obscure the fact that you are using threads. If you can subdivide whatever it you are doing into a bunch of short tasks, you can let the system manage how many threads you are using.

 

Since you are looking to "wait" for timers, may I suggest you use:

1. A timer thread: To push events into the executor. (don't actually run them, just schedule them to run later in the executor)

2. A threadpool executor: To execute the events.

 

Then you can play with the treadpool size. Notice that the timer thread is not bogged down, because it is not doing any real work.

 

All of these classes are supplied with Java. You don't have to write anything yourself




#5193304 Polygonzing a mesh

Posted by SillyCow on 17 November 2014 - 02:53 PM

You are right. I was a bit sloppy in my description.

1. I wrote convex, but meant concave. You can see a Concave polygon in the example set.

2. There are no floating verticies, or floating edges for that matter. (no holes are allowed either, so no islands exist)

3. There are no duplicate verticies. (I run a preprocessing step and "weld" all vertices within a threshold).

4. No two edges overlap. (I run a preprocessing step and split all overlapping edges). 

5. All of the lines in the example above, including the borders, and the diagonals that you see are created by the artist

 

So the vertices are not random with regard to the edges. They are related in that every vertex is part of an edge. And if the artist draws two colliding edges, a vertex is automatically inserted at the intersection and the edges are split along it.




#5116924 Many to one relation in an SQLite database

Posted by SillyCow on 14 December 2013 - 01:57 PM


select * from Class where Race like '%Elf%';

This has terrible performance. It is an unindexed query. This means that you are reading your entire table every time you retrieve a line.

 

If you ever want to make the "who is an elf" query, you should definetly normalize your database.




#5104892 Where can I learn software engineering, for free?

Posted by SillyCow on 27 October 2013 - 05:27 PM

How much do you already know?

Do you know the basics: MVC, etc...?




#5101648 Transfer (Trade) System?

Posted by SillyCow on 15 October 2013 - 03:31 PM

Learn about the standard library containers,

Specifically, look for a tutorial on "STL maps" to get started.

Then learn about the rest of stl.




#5100851 Trying to simulate the flamethrower from GTA2

Posted by SillyCow on 12 October 2013 - 01:30 PM

Do you mean that the near part of the flame in GTA is straighter, then the far part of the flame?

 

If so, make your flame decelerate as it get farther from your gun.

 

I will assume you are currently multiplying your flame's direction by the time elapsed.

Change it so that the more time elapsed, the farther & slower your flame should be.

 

instead of multiplying by time, multiply by some root of time.

 

Instead of: 

Position = FlameDirection * Time

Do either:

Position = FlameDirection * sqrt(Time)

or:

Position = FlameDirection * Math.pow( Time , float_number_smaller_than_one)

The smaller float_number_smaller_than_one is, the more "bending" you will have.




#5097552 space wars

Posted by SillyCow on 28 September 2013 - 11:26 PM

Switch the order of your rotate and translate.

When you want to rotate an object on it's axis, rotation should come first.

However, since openGL transforms are a stack, what happens first is what is closest to the code.

So the order of transforms of opengl is actually resversed.

 

This is kind of confusing at first, but is really logical when you need heirerchial animations (like a skeleton). It's also required because of the linear-algebra behind openGL.

 

So what you should be doing is:


void DrawShip(GLfloat position_X,GLfloat position_Y, GLfloat position_Z, GLfloat rotation,GLfloat color)
{
glPushMatrix();
glColor3f(color,0.0f,0.0f);
glTranslatef(position_X,position_Y,position_Z); //move only after the ship is rotated.
glRotatef(rotation,0.0f,0.0f,1.0f); //Now rotation will happen before movement
glBegin(GL_LINE_LOOP);glVertex3f(0.0f,-0.25f+position_Y,0.0f); glVertex3f(-0.25f,-0.5f+position_Y,0.0f); glVertex3f(-0.5f,-0.5f+position_Y,0.0f); glVertex3f(-0.0f,0.5f+position_Y,0.0f);
glVertex3f(0.5f,-0.5f+position_Y,0.0f);
glVertex3f(0.25f,-0.5f+position_Y,0.0f);
glVertex3f(0.0f,-0.25f+position_Y,0.0f);
glEnd();
glPopMatrix();
 }





PARTNERS