Jump to content

  • Log In with Google      Sign In   
  • Create Account


EvincarOfAutumn

Member Since 04 Nov 2005
Offline Last Active Aug 19 2014 02:06 PM

#5114261 Game Engine, How do I make one

Posted by EvincarOfAutumn on 04 December 2013 - 03:00 AM

My question is what really is a game engine and how do you make one?

 

A game engine is a system for making games—an application, or more commonly a library, providing services such as audio & video output, controller input, timing, physics, and so on. How do you make one? You don’t. If you want to make a game, you should make a game. You will not accomplish that goal, nor really improve as a software developer, by creating middleware without specific goals and requirements in mind.

 

Just pick an engine (or less—a basic graphics+audio+input library such as SDL is fine) that’s compatible with your style of thinking and/or your preferred programming language. Use it to make something. If you encounter limitations, take the time to understand and work with them. Working under constraints will help you think more creatively. Keep a diary of these situations and maybe next time try a different engine.

 

You can learn a lot by making an engine—about systems programming, graphics, audio, input, API design, and infrastructure in general—but it’s best to fight on a single front. Want to make a game? Take advantage of the work that others have done. Interested in engine design? Do it as a learning exercise. And anyway, you can learn all of those skills in other ways, incidentally, in the process of creating useful software.




#5093717 unique_ptr

Posted by EvincarOfAutumn on 12 September 2013 - 10:16 PM

unique_ptr owns the object that it points to. move() can be used to transfer that ownership to another unique_ptr. You will find that after your call to move(), vFoo.front() will be a null unique_ptr; ownership of the object has been transferred to p using its move-assignment operator.




#5053257 Hap: a simple concurrent programming language.

Posted by EvincarOfAutumn on 14 April 2013 - 03:53 PM

Well, I’ve gone and done it again—written a language when nobody asked me to. This one might be interesting to game developers, and I’m interested to hear feedback from anyone with an opinion about what ought to be done with it.

The language is called Hap and is designed as a readable dynamic language for game prototyping. It uses single-threaded cooperative multitasking to support simple event-based concurrency. The example from the README sums it up nicely:

 

var health = 100;

when (health <= 0) {
  print("Goodbye, cruel world!");
  exit;
}

print("Hello, sweet world!");

while (true)
  health = health - 1;

 

This code prints:

 

Hello, sweet world!
Goodbye, cruel world!

 

Hopefully that’s enough to get your attention. Another example shows how you can use the asynchronous control flow statements to write surprisingly readable code:

 

fun make_cycler(start, end) {

  var current = start;

  whenever (current > end)
    current = start;

  ret lam() {
    var previous = current;
    current = current + 1;
    ret previous;
  };

}

 

This function returns a function generating a cycle of values in the given range. For instance:

 

make_cycler(0, 2)

 

Will produce the sequence:

 

0, 1, 2, 0, 1, 2, …

 

Hap can be used on its own, but the idea is to support embedding in larger systems, much like Lua or JavaScript. Being only a few weeks old, the language naturally has some issues that would need to be addressed before it could be used in production. In particular:

 

  • There is no standard library, and thus no way to perform a number of common math and container operations.
  • Embedding the language is not as simple as it should be.
  • Asynchronous control flow is not first-class, i.e., there is no way to refer to or halt a “whenever” statement.
  • The prototype interpreter is not designed with performance in mind.

 

I will gladly address these and any other issues if there is interest in the general concept. Tell me what you think!




#5030976 Protodata—a language for binary data

Posted by EvincarOfAutumn on 11 February 2013 - 03:20 AM

I recently rewrote and improved some old software of mine, and figured the next step is to put it in the hands of people who might use it.

 

Protodata lets you write binary data using a textual markup language. I’ve found this really useful in game development when I want a custom format, would rather not use plain text or XML, and don’t want to invest the time to make a good custom editor. Protodata supports signed and unsigned integers, floating-point numbers, and Unicode strings, all with a choice of bit width and endianness.

 

Edit: here’s an example document describing a cube mesh.

 

# File endianness and magic number
big u8 "MESH"

# Mesh name, null-terminated
utf8 "Cube" u8 0

# Using an arbitrary-width integer for zero padding
u24 0

# Vertex count
u32 8

# Vertex data (x, y, z)
f32
+1.0 +1.0 -1.0
+1.0 -1.0 -1.0
-1.0 -1.0 -1.0
-1.0 +1.0 -1.0
+1.0 +1.0 +1.0
-1.0 +1.0 +1.0
-1.0 -1.0 +1.0
+1.0 -1.0 +1.0

# Number of faces
u32 6

# Face data (vertex count, vertex indices)
u32
4 { u16 0 1 2 3 } # Back
4 { u16 4 5 6 7 } # Front
4 { u16 0 4 7 1 } # Right
4 { u16 1 7 6 2 } # Bottom
4 { u16 2 6 5 3 } # Left
4 { u16 4 0 3 5 } # Top

 

Please tell me what you think and offer suggestions for improvement. smile.png




PARTNERS