Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Vino
Aug 11, 2010

brian posted:

It's to get on the course not to get a job, there's no junior designer job that would ever present a list and say 'please show 3 of the 6 things here'. Presumably they teach you an actual skill on the course although it seems somewhat unlikely given that it's for game design and is so short.

Ooooooh right, I think maybe my brain wasn't applied to that entire post the way it should have been.

Adbot
ADBOT LOVES YOU

pastorrich
Jun 7, 2008

Keep on truckin' like a novacane hurricane

brian posted:

It's to get on the course not to get a job, there's no junior designer job that would ever present a list and say 'please show 3 of the 6 things here'. Presumably they teach you an actual skill on the course although it seems somewhat unlikely given that it's for game design and is so short.

http://www.dawsoncollege.qc.ca/continuing-education/aec-programs/video-game-level-design/video-game-level-design-courses

Those are the courses. There's a 45 hour scripting class and another on 3D animation and I would put my own hours on learning code and whatnot. It's a 1320 hours program. Is that good? I just want to get started, so I need to have a decent portfolio ready in one month so I can have some basic knowledge and grow on it.

Physical
Sep 26, 2007

by T. Finninho

Paniolo posted:

http://www.youtube.com/watch?v=QZxRauOpfwo

I've been working on a voxel-based procedural level generator, loosely inspired by this article from GPU Gems 3:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html

While they do everything on the GPU and use perlin noise as a density function, I'm doing it on the CPU and sampling a voxel map + filtering for the density function. Eventually I will add noise to displace the vertices slightly, so the edges aren't quite so straight.

The voxel map generation algorithm is stupidly simple. Eventually I want to feed it data from a roguelike-style dungeon generator. My long term goal is to see how far I can push the kind of procedural level generation you see with roguelikes into the realm of hi-fi graphics.

Looks great! And my jaw hit the ground because you are doing the same thing I am using the same article. It looks like you understand it better. I need help understanding in which order the dx10 shaders get called so that I can convert it to the CPU. Can you help me out?

Paniolo
Oct 9, 2007

Heads will roll.

Physical posted:

Looks great! And my jaw hit the ground because you are doing the same thing I am using the same article. It looks like you understand it better. I need help understanding in which order the dx10 shaders get called so that I can convert it to the CPU. Can you help me out?

I do everything on the CPU, I don't use geometry shaders (using DirectX 9.) I would recommend first getting a working marching cubes implementation that just spits out positions and normals to a vertex buffer from an arbitrary density function (a good one to test is the function for a sphere.) Once that's working then you can work on a density function that samples your voxel map, and then finally you can improve you shaders to add lighting and texturing.

I am not actually using any code from that article, I developed my marching cubes implementation based on this: http://paulbourke.net/geometry/polygonise/ and my voxel sampling function was entirely custom. I guess you could say I took inspiration from the GPU Gems article but I don't like their implementation since it gives you very little control over your geometry and no way of accessing it from the CPU to extract collision data.

Physical
Sep 26, 2007

by T. Finninho
Ohh ok. Then that makes my question null. I thought that you had used the code from that article. I am interested because I am trying to wrestle with it too but my problem is that I too don't use geometry shaders because I don't have DirectX 10 or above. I have DirectX 9c and thought that If I could walk through the code (without being able to run it_ I would be able to translate it to a singular function or linear progression that could run on just a CPU. Following the code through the DX10 shaders without being able to run it just made me confused to the point where I thought that the pixel shader was getting executed first (totally wrong).

So one thing that I just realized about the marching cubes algorithm and the GPU Gems article and from your screenshot is how smooth the surfaces are. At first I saw someone elses project and thought that they were just really small cubes beacuse it kind of looked like that (minecraft-ish), but reading this http://users.polytech.unice.fr/~lingrand/MarchingCubes/algo.html and having it explained in 2d with pictures helped me realize that its actually about inferring polygon data from "invisible" or "theortical" cubes that are only represented by values that represent densities at their corners. I was stuck thinking in terms of minecraft and didn't realize that this method is different. Minecraft just makes a cube for each pixel in a noise map. Marching cubes makes "smoothish" connected polygons. Is that a correct line of thinking?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Gerblyn posted:

Are you talking about collision detection here? I'm a bit confused how you got from this sentence to questions about pixel shaders...
Hah I can understand the confusion. I didn't mean to infer one directly lead to the other. I don't even necessarily imply that collision detection is particularly a thing. I am more thinking about being able to have meshes of significant complexity and detail and be able to have them interact with stuff. It's one thing in my mind to understand them all as different entities and know how to move them around and stuff, but it's something else to go that last bit and have meshes representing them doing their thing. That's where I was getting overwhelmed.

Blender's been a real pain in the butt, but it has been useful to, say, add bones to a model and move it around, and apply UV texture coordinates and the like. Another example would be the idea of putting a weapon in a model's hand. Conceptually it's easy enough to imagine assigning the weapon and such, but making it really work is something else. So seeing how they do that in a modeler has gone a long ways towards knowing how I should approach it in a game.

Paniolo
Oct 9, 2007

Heads will roll.

Physical posted:

Marching cubes makes "smoothish" connected polygons. Is that a correct line of thinking?

Yeah, marching cubes is not actually a voxel algorithm, it operates on a density field. It's just relatively trivial to sample a voxel map as a density field by interpreting filled cells as some positive value and empty cells as some negative value.

The GPU gems article is misleading as hell because it refers to the cubes in the marching cubes algo as voxels but really nothing in that article has anything to do with voxels as a way of representing the world.

Rocko Bonaparte posted:

Hah I can understand the confusion. I didn't mean to infer one directly lead to the other. I don't even necessarily imply that collision detection is particularly a thing. I am more thinking about being able to have meshes of significant complexity and detail and be able to have them interact with stuff. It's one thing in my mind to understand them all as different entities and know how to move them around and stuff, but it's something else to go that last bit and have meshes representing them doing their thing. That's where I was getting overwhelmed.

Collision engines generally simplify the world into simple primitives like axis-aligned bounding boxes, spheres and cylinders. Doing collision detection against an arbitrary mesh is only needed for things like hit testing in a FPS. Even then the mesh is usually simplified into a convex hull.

Paniolo fucked around with this message at 07:13 on Apr 7, 2011

Physical
Sep 26, 2007

by T. Finninho

Paniolo posted:

Yeah, marching cubes is not actually a voxel algorithm,
What would be a voxel algorithm?

Paniolo posted:

it operates on a density field. It's just relatively trivial to sample a voxel map as a density field by interpreting filled cells as some positive value and empty cells as some negative value.
How is it trivial? Do you mean easy or there is no point to do it?

Physical fucked around with this message at 07:42 on Apr 7, 2011

Paniolo
Oct 9, 2007

Heads will roll.

Physical posted:

What would be a voxel algorithm?

The voxel rendering algorithms I'm aware of either involve raycasting/raytracing (this is what Carmack thinks the future of 3D graphics is), generating a quad for each voxel face that is next to an empty cell (Minecraft) or sampling the voxel map as a density field and using a isosurface generation algorithm like marching cubes or dual contouring.

Physical posted:

How is it trivial? Do you mean easy or there is no point to do it?

Easy.

Physical
Sep 26, 2007

by T. Finninho
http://en.wikipedia.org/wiki/Voxel
Under computer gaming it says crysis uses voxels. Where the hell does it use voxels? Also, it says that minecraft uses polygon rendering and not actual voxels. I don't get what the difference is. What is an actual voxel? I mean besides a volumetric pixel? How would minecraft "correctly" use voxels? How could a game rely on voxels without using polygons to represent them?

speng31b
May 8, 2010

Physical posted:

http://en.wikipedia.org/wiki/Voxel
Under computer gaming it says crysis uses voxels. Where the hell does it use voxels? Also, it says that minecraft uses polygon rendering and not actual voxels. I don't get what the difference is. What is an actual voxel? I mean besides a volumetric pixel? How would minecraft "correctly" use voxels? How could a game rely on voxels without using polygons to represent them?

Crysis uses voxels for the terrain. Basically the distinction is that a a true voxel renderer will using marching cubes for surface extraction from the underlying voxel data. Minecraft doesn't internally represent its data as voxels, but rather as actual polygonal cubes. I guess it's a fine distinction, but minecraft doesn't need to use surface extraction because the surfaces are already polygons and there's nothing to extract. Minecraft uses cubes as units of terrain, but they aren't voxels in the sense of being volumetric pixels.

Hope that makes sense.

gwar3k1
Jan 10, 2005

Someday soon

Mr.Hotkeys posted:

Did you add it, in Visual Studio, to your content project? If VS doesn't know it's there, the content importer won't compile it into a texture and your program won't be able to find it. XNA can't use raw PNG files as textures, they have to be run through the content importer first.

I added the file to the Content project by right clicking the folder in solution explorer and add existing item.

MonsterUnderYourBed posted:

You can load images from a file in XNA, it's just done a little differently, I do it in my current project so my artist can just have the compiled game + texture folders to mess around in rather than having to have VS installed.

I'm guessing though due to the fact that he specified a name for the texture as opposed to a filename, he almost certainly has added it to the project in VS.

edit: is there any chance you're doing the Content.Load call in either the constructor or Initialize method? Because from memory if you call Content.Load before the game hits the LoadContent() function it spazzes as content isn't fully initialized yet.

The line was in my LoadContent method but before my call to create a new sprite batch. I swapped the lines and the code builds. I'm not saying that's the solution here, but I'm happy with that.

Thanks for the help.

GirlBones
Jun 10, 2007
I am not very good at the internet
Back in the day, when I was in middle/high school, I used to gently caress around with RPG Maker 2000/2003. I had a lot of fun starting games and never finishing them and hanging out with the dudes in the RM community.

These days, I'm almost out of school and I work overnights at a hotel. My job involves hours and hours of doing literally nothing, so I have started putting together a new RPG project. It is pretty drat ambitious, and I will probably never see it through but that's what I enjoy so DON'T HATE.

For anyone who gives a poo poo:
[don't care]
It is loosely based on the mythology of the Pueblo peoples of the southwest United States, and takes place in an area similar to the four-corners region of the U.S. The story follows MODERN CONSUMER GUY as he searches for the cure to his terminal illness. In order to do so, he must unravel the secrets of several ancient cultures etc... etc... etc...
[/don't care]

So far, other than putting together the story and setting, all I have done is the art for the game. It is my intention to use no digitally made images for the game (except maybe text, - I haven't decided) All background images, level maps, menus, characters etc... will be hand-drawn in ink and water-colored, scanned, and thrown together in the game engine.

So My Question/Request Is:Help me figure out what sort of code or game engine to use to make this thing!

At this point, my coding experience amounts to making text adventures in BASIC on my T.I. 83, and working around the limitations of RM2K to make custom menu and battle systems. (I.E., ZILCH) Beyond these things, I have no idea what proper coding entails so unless there's something out there that I can learn well enough in two or three months to efficiently make an RPG, I guess I'm probably better off with a Game-Making Engine.

I do know that I don't want to make it with any of the RMs or Game Maker. Firstly, The Battle and Menu systems I want to create would just be the biggest pain in the rear end to make with these tools. Also, since I am hand-drawing all of this crap, I don't want to deal with the image-size limitations of these programs. I want to make something that can run at the natural resolution of my laptop.

Obviously, I don't know what the heck I'm talking about, so help me out! Set me on the right path and all that jazz...

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

GirlBones posted:

So My Question/Request Is:Help me figure out what sort of code or game engine to use to make this thing!
That sounds like a job for Flash, to me. It has both the flexibility and simplicity you want.

GirlBones
Jun 10, 2007
I am not very good at the internet

roomforthetuna posted:

That sounds like a job for Flash, to me. It has both the flexibility and simplicity you want.

Is flash suitable for what I want to do graphically? My only experience with flash is stuff like the flash tub and cartoony browser games, etc...

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

GirlBones posted:

Is flash suitable for what I want to do graphically? My only experience with flash is stuff like the flash tub and cartoony browser games, etc...
You're not wanting anything *complicated* graphically, are you? Just scanned images? Flash can do that just fine. You can delay loading on the images too, so you don't need to worry about having the whole memory eaten by large image files.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

gwar3k1 posted:

I've started following a guide to learn 2D game development and I've followed it to the letter aside from using XNA 4 when the book is targeting 3. I've spent ages Googling this problem and the only solution I can find is what I'm doing anyway which is infuriating because this is like the Hello World of the book and it refuses to work.

I'm using the following code and getting a ContentLoadException was unhandled error: File not found.

code:
  Content.RootDirectory = "Content";
...
  Content.Load<Texture2D>("p1")
p1 is definitely the asset name and p1.png exists in the folder Content is pointing to (C:\Users\gwar3k1\Documents\Visual Studio 2010\Projects\XNATutorial1\XNATutorial1\XNATutorial1Content\).

Any suggestions?

It doesn't solve this particular problem, but if your book is targeting XNA 3 and you're using 4, you might find this helpful: http://www.nelxon.com/blog/xna-3-1-to-xna-4-0-cheatsheet/

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Paniolo posted:

http://www.youtube.com/watch?v=QZxRauOpfwo

I've been working on a voxel-based procedural level generator, loosely inspired by this article from GPU Gems 3:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html

While they do everything on the GPU and use perlin noise as a density function, I'm doing it on the CPU and sampling a voxel map + filtering for the density function. Eventually I will add noise to displace the vertices slightly, so the edges aren't quite so straight.

The voxel map generation algorithm is stupidly simple. Eventually I want to feed it data from a roguelike-style dungeon generator. My long term goal is to see how far I can push the kind of procedural level generation you see with roguelikes into the realm of hi-fi graphics.

I'd be interested in following this project. You should blog about it so we can all watch. :D Procedural content like this is so fascinating.

Paniolo
Oct 9, 2007

Heads will roll.
Added texture blending - each voxel has a material assigned and the sampling function filters blending weights based on the surrounding voxels. Up to four materials per level are supported right now, and the pixel shader is definitely starting to cause some slowdown, since I'm sampling each texture 3x for the triplanar projection. Time to add visibility culling and geometry sorting!



Here's a shot showing the boundaries of the voxels on the y=1 plane (the ground plane), so you get an idea of how easy pathing and collision is.



And here's a birds eye view of the voxels:



edit: Video with the new stuff in: http://www.youtube.com/watch?v=LeISMAg_XgA

Paniolo fucked around with this message at 20:23 on Apr 7, 2011

Vino
Aug 11, 2010
Think that could be done using hex grids and simplex noise instead of those obvious boxes?

Paniolo
Oct 9, 2007

Heads will roll.

Vino posted:

Think that could be done using hex grids and simplex noise instead of those obvious boxes?

Definitely possible but just thinking about the sampling equations makes my head hurt.

Physical
Sep 26, 2007

by T. Finninho
drat you are killing it.

How would I get content into an XNA game that wasn't there at compile time?

brian
Sep 11, 2001
I obtained this title through beard tax.

pastorrich posted:

http://www.dawsoncollege.qc.ca/continuing-education/aec-programs/video-game-level-design/video-game-level-design-courses

Those are the courses. There's a 45 hour scripting class and another on 3D animation and I would put my own hours on learning code and whatnot. It's a 1320 hours program. Is that good? I just want to get started, so I need to have a decent portfolio ready in one month so I can have some basic knowledge and grow on it.

Well the value of any of these courses is in the skills learned and the portfolio produced as a result of it or by doing it and that course seems to be heavily themed around level design. Level design isn't really game design in the typical sense, it's more like 3D modelling but using the software for whatever engine you're using and either reusing existing assets or making a minimal amount of them yourself in a more typical 3D package, there's obviously more design that goes into it with regards to making it fun for whatever the game's mechanics are, but it's more a case of level architecture and engine specific scripting. This course definitely seems oriented around the commercial 3D engine level editors over indie/handheld 2D sort of stuff.

I'd try making a level in UDK or Hammer (HL2 map editor), see if it's the thing you want to do or not and if it is then I imagine this course will be great. Just remember that you get out what you put in, you'll get a job based on your portfolio and skills demonstrated within it, not based on any degree or qualification in general.

Nalin
Sep 29, 2007

Hair Elf

Physical posted:

drat you are killing it.

How would I get content into an XNA game that wasn't there at compile time?
For textures, this may help.
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.texture2d.fromfile.aspx

For models, I think you are out of luck. There are resources that talk about it, but I believe you have to have Visual Studio/XNA Game Studio installed in order for it to work.

pastorrich
Jun 7, 2008

Keep on truckin' like a novacane hurricane

brian posted:

Well the value of any of these courses is in the skills learned and the portfolio produced as a result of it or by doing it and that course seems to be heavily themed around level design. Level design isn't really game design in the typical sense, it's more like 3D modelling but using the software for whatever engine you're using and either reusing existing assets or making a minimal amount of them yourself in a more typical 3D package, there's obviously more design that goes into it with regards to making it fun for whatever the game's mechanics are, but it's more a case of level architecture and engine specific scripting. This course definitely seems oriented around the commercial 3D engine level editors over indie/handheld 2D sort of stuff.

I'd try making a level in UDK or Hammer (HL2 map editor), see if it's the thing you want to do or not and if it is then I imagine this course will be great. Just remember that you get out what you put in, you'll get a job based on your portfolio and skills demonstrated within it, not based on any degree or qualification in general.

that sounds totally fair to me, there's a whole 300+ hours devoted to building an actual game with other artists to get a portfolio, and I can put some spare time hours in there too, so I should have a pretty decent portofolio to build skills on. I think one can definitely work up to game design from level design, so I feel great about picking that path. thanks for the tips man.

Vinterstum
Jul 30, 2003

pastorrich posted:

that sounds totally fair to me, there's a whole 300+ hours devoted to building an actual game with other artists to get a portfolio, and I can put some spare time hours in there too, so I should have a pretty decent portofolio to build skills on. I think one can definitely work up to game design from level design, so I feel great about picking that path. thanks for the tips man.

If you want to get an entry-level designer job, level-design and mods is really the main way forward. Designing actual games (the high-level concepts) is something you could maybe get to do after you've worked in the industry for many years, it's not something you get hired for.

Just be very realistic about what you're getting into: Getting an entry-level designer job is *hard*. There's few positions available, and oceans of people after them. Especially here in Montreal :). Getting into the industry as an artist or (especially) a programmer is much easier, but... then you'll be doing art/code and not design.

Working your way through QA is an option yes, but 1) It really depends on the company (we hire designers from our QA guys, but I hear of companies that don't), 2) There'll still be plenty of competition, and 3) If you're working in one of the "QA sweatshops" like VMC or Bugtracker, try to get a studio QA position ASAP :).

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

HappyHippo posted:

The problem is that the equation for the force of gravity has a singularity at r = 0, so the force gets huge when things get close together. There are many fancy ways to solve that, but collision detections should do the job by preventing anything from getting too close. Resistance wouldn't do much to fix it. You could try putting a hard cap on the force that's allowed but again the collision detection should do it.

As for the collision detection, don't work it out based on forces. If you use forces you need to know things like the impact time and everything. Much easier to use the conservation of momentum. There's an alright introduction here: http://www.engin.brown.edu/courses/en4/notes_old/oblique/oblique.html
The coefficient of restitution defines how hard the objects are. If e = 1 they'll act like pool balls, if you make it close to zero they'll lose a lot of speed each impact.

Sorry, but I'm having no luck with this. Besides that site being a bit hard to read, I'm having trouble reconciling what I'm getting out of it with the way I'm currently doing things:

This is in Flash, and each planet has a separate velocity on the x- and y-axis (xv, yv) and each frame these are modified by any gravity acting on the planet, and then each planet's x coordinate has xv added to it and it's y coordinate has yv added to it.

So now I want to detect when two planets come into contact with each other and make them collide and bounce off of each other, but I can't figure out how arrive at separate modified velocities. Should I rework everything so everything just have a speed and an angle that it's moving at? Gravity and such seems to work fine with things the way they are but this particular problem seems a lot easier to solve that way.

pastorrich
Jun 7, 2008

Keep on truckin' like a novacane hurricane

Vinterstum posted:

If you want to get an entry-level designer job, level-design and mods is really the main way forward. Designing actual games (the high-level concepts) is something you could maybe get to do after you've worked in the industry for many years, it's not something you get hired for.

Just be very realistic about what you're getting into: Getting an entry-level designer job is *hard*. There's few positions available, and oceans of people after them. Especially here in Montreal :). Getting into the industry as an artist or (especially) a programmer is much easier, but... then you'll be doing art/code and not design.

Working your way through QA is an option yes, but 1) It really depends on the company (we hire designers from our QA guys, but I hear of companies that don't), 2) There'll still be plenty of competition, and 3) If you're working in one of the "QA sweatshops" like VMC or Bugtracker, try to get a studio QA position ASAP :).

haha! I AM working the VMC sweatshop and I love it. That's why I'm thinking I have a good future in this industry, I'm working at mcdonalds and flipping burgers while whistling and dancing around. I think I didn't explain myself properly, I want to get a junior job as a level designer, then work my way into game design. I heard that's possible? Thanks for the good advice, and are you guys hiring by any chance? :)

thanks man, will do.
vvvvvvvv

pastorrich fucked around with this message at 04:20 on Apr 8, 2011

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.
Pastorrich, you really need to cut/paste your first post in this thread into the Game Jobs Megathread to get the advice you're looking for. This thread is mostly filled with hobbyists who just program games for fun (plus a few pros). That other thread is chock full of game industry professionals who can give you much more detailed advice and some of them have likely hired (or tossed away the resumes of) people from the exact school you're looking at.

Just to be clear, I'm not trying to push you out of this thread - you're more than welcome to hang around and ask all the questions you want. Rather, I'm trying to let you know that you're missing out on an AMAZING opportunity by not also posting in that other thread. Those folks really know what it takes to break into the game industry because they've done it.

zapateria
Feb 16, 2003
I don't know if this is the right thread, but since it is kind of game related, I'll try here. I'm using PHP btw. I've bolded the question for tl;dr.

I've made a few classes:

Object
Room extends Object
Player extends Object

basically they are like this:

code:
class Object {
private $name;
private $env;

public function set_name($what) {
  $this->name = $what;
}
public function get_name() {
  return $this->name;
}
public function move($where) {
  $this->env = $where;
}

}

I create an instance of Room, Player and Object:

code:
$room1 = new Room;
$room1->set_name("Room1");
$player>1 = new Player;
$player1->set_name("Player1");

// and move a Player into a Room:

$player1->move($room1);
This is all simple and works like intended.

Now I want these objects/instances to interact with different browser sessions, how do I accomplish that?

Example: room.php
User loads page, is assigned a player object, is moved to a new room object.
Another user loads page, is assigned a player object, is moved to the existing room object and I can tell user2 that there are 2 player objects in this room.



My thoughts are: I need to use a SQL DB, make a table for each class with columns matching variables. Then when an object is updated, I need to write that to the row, and same with reading variables, I need to query the DB first. If this is the right approach, should I use an ORM like Propel/Doctrine?

Are there other easier ways to do this? There are thousands of browser games built on this concept, how do they do it?

Mr.Hotkeys
Dec 27, 2008

you're just thinking too much
I'm currently working on an Advance Wars/Civilization mashup kind of thing in XNA and was wondering, what is the best way to go about scripting, like, cutscenes? Like if at the start of the mission, I just wanted to move some units around, nothing crazy complicated. Should I just be handling moving and stuff when the objects update, and then when they get to the correct position, go on to the next step? Or should I multithread and put the draw code on the other thread and have the logic for the cutscene continuously running on the other?

I know this is probably going to vary a lot from game to game, but I figured situation was generic/simple enough that someone who's done anything like this before might be able to weigh in. And it's still pretty far down the line before that will ever come up, I just don't want to make any design decisions now that will back me into a corner. I can see some ways going about it, but in general I'm pretty stumped about how to do it without it becoming a huge confusing clusterfuck. And I want to keep it all in C# if that's reasonable, don't want to learn or have to deal with LUA/etc.

But now I have to go write a natural number class in Java for class, so if I don't get back to you soon, thanks in advance.

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe

Mr.Hotkeys posted:

I'm currently working on an Advance Wars/Civilization mashup kind of thing in XNA and was wondering, what is the best way to go about scripting, like, cutscenes? Like if at the start of the mission, I just wanted to move some units around, nothing crazy complicated. Should I just be handling moving and stuff when the objects update, and then when they get to the correct position, go on to the next step? Or should I multithread and put the draw code on the other thread and have the logic for the cutscene continuously running on the other?

If your cutscenes run in engine, then it's probably a good idea to design the engine so it can be put into "Cutscene Mode". This typically involves:

- Disable most user input
- Hide UIs
- Save a copy of the game state in memory so you can restore it later (optional, but needed if you don't want things that happen in cutscenes to effect the game world)

As for the cutscene system's architecture, you typically want to have a queue of cutscene events that the system processes sequentially. So you'd have a base Event class, and you'd derive various event types from it (e.g. StartAudioStreamEvent, MoveUnitEvent, etc.). Given the fact you're making a TBS game, it's probably best to have the events start and then run until they're finished before starting the next event.

So, a cutscene sequence might look like this:

pre:
- Enter Cutscene Mode (camera position stored, UI hidden, player control disabled)

  - MoveCameraEvent 
    - Camera centers on the player's city
  - StartAudioStreamEvent
    - Cutscene music starts playing
  - TalkingHeadEvent
    - Bad guy's head appears, with a text box "I will crush you!"
  - TalkingHeadEvent 
    - Good guy's head appears, with a text box "You will never defeat us!"
  - TalkingHeadEvent 
    - Bad guy "Let's see how brave you are when my tanks have flattened your precious empire!"
  - SpawnUnitsEvent
    - A number of tanks appear around the player's city
  - TalkingHeadEvent
    - Good guy: "Noooooooooooo!"

- Leave Cutscene Mode (camera position restored, UI shown, player control enabled)

Finally, you really don't want to hard code these cutscenes into the program, so you'll want a way of loading these event lists from a file. A simple XML structure would probably be best:

pre:
<cutscene name="Baddy Attacks City">
  <events>
    <movecamera target="City_01"/>
    <startaudiostream filename="dramamusic.mp3"/>
    <talkinghead faceid="badguyface">
      I will crush you!
    </talkinghead>

    ... blah blah blah ...

  </events>
</cutscene>

Mr.Hotkeys
Dec 27, 2008

you're just thinking too much
Makes sense, but should I set it up so that whatever object is doing something in the cutscene does its thing continuously and split the graphics into another thread or have the object do a step towards its goal every update loop and leave the threads together?

Like say an object needs to move from (0, 100) to (100, 300), should it move by some (100/n, 300/n) every time Update() is called until it gets to the right spot, or just loop in its Update() until it gets to the right spot while the graphics, on another thread, update to reflect its position?

Just trying to get down the best practice, I'm mostly just doing this for academic purposes. Though I might have answered my own question, now that I think about it; having more than one object move with the latter would be a pain in the rear end. Also having to worry about objects talking over threads...nevermind, actually. I've got my answer. Thanks!

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe
Yeah, if your cutscene system can take advantage of your engine to make/move/animate things then you save yourself a lot of hassle. Depending on your requirements you may want to derive cutscene versions of core game classes, so you might make a cutscene specific type of unit that has extra functionality for doing cutsceney things like playing custom animations and stuff.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

zapateria posted:

My thoughts are: I need to use a SQL DB, make a table for each class with columns matching variables. Then when an object is updated, I need to write that to the row, and same with reading variables, I need to query the DB first. If this is the right approach, should I use an ORM like Propel/Doctrine?

Are there other easier ways to do this? There are thousands of browser games built on this concept, how do they do it?
The DB way is the most common. The only other ways I can think of that you can do it are you could have a browser extension that keeps the data in memory, which would be crazy, or you could memory-map a file if your data is amenable to that sort of a structure. That would probably be preferable for 'flat' data, like a map, but for things like players that move around and stack up the DB is almost certainly the way to go.

Use an ORM if it will make it easier for you!

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Mr.Hotkeys posted:

I want to keep it all in C# if that's reasonable, don't want to learn or have to deal with LUA/etc.

You can load and compile C# files at runtime using the CodeDomProvider class so you can just use C# as the scripting language if you want to avoid LUA. Create a folder somewhere and fill it with Script001.cs, Script002.cs, etc files but don't add them to your VS project. Load and build each file at runtime and attach them to your game objects just like any other script.

I did this about a year ago for a game jam type event, I had a ScriptManager class that handled the load/build stuff and exposed a set of methods that the scripts were allowed to use. The important bits for doing the compliling are here if you want to take a look. (Warning: this code is of game jam quality and was likely written at 2AM after a couple of beers, no idea why I thought it would be neat to use an iterator to get one item out of a collection containing one item, etc.)

This might not work if you are targeting Xbox systems, I don't think they allow live compiles for security reasons.

Mr.Hotkeys
Dec 27, 2008

you're just thinking too much

PDP-1 posted:

You can load and compile C# files at runtime using the CodeDomProvider class so you can just use C# as the scripting language if you want to avoid LUA. Create a folder somewhere and fill it with Script001.cs, Script002.cs, etc files but don't add them to your VS project. Load and build each file at runtime and attach them to your game objects just like any other script.

That's very cool that can be done since I'd rather make my own scripting language that compiles into bytecode any day of the week over xml (stubborn as gently caress), but what is the reason that I shouldn't compile them until runtime? So they can be easily edited? So they don't bog down compiling the main program itself?

Also, I thought compiling at runtime wasn't going to be available until C# 5.0, or are they just making it easier?

Gerblyn posted:

Yeah, if your cutscene system can take advantage of your engine to make/move/animate things then you save yourself a lot of hassle. Depending on your requirements you may want to derive cutscene versions of core game classes, so you might make a cutscene specific type of unit that has extra functionality for doing cutsceney things like playing custom animations and stuff.

Yeah I was considering having the objects have a state that determines the logic they execute (eg cutscene vs your turn vs their turn, or something like that), and have them each have a field that contains some IScript object they execute when they're in the cutscene mode. My game's not crazy complicated (or at least the unit classes shouldn't be), so I think it'd be better than way, but I'll look into doing it the other way and see which works better, thanks for the suggestion. You've been very helpful.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Mr.Hotkeys posted:

That's very cool that can be done since I'd rather make my own scripting language that compiles into bytecode any day of the week over xml (stubborn as gently caress), but what is the reason that I shouldn't compile them until runtime? So they can be easily edited? So they don't bog down compiling the main program itself?

Also, I thought compiling at runtime wasn't going to be available until C# 5.0, or are they just making it easier?

If you compile all your scripts at build time you have to re-build the whole project every time you make a modification to any one script. Changing a character's name from Ted to Fred requires a full re-build. Then you launch the program and navigate your character from wherever the default start location is over to Ted/Fred and test the script. It's not very interactive and your testing iterations will be slow.

If you set your scripting system up to load/build at runtime you can have your game running in one window and the script open in another window. Change the character script's Name property from Ted to Fred and save the changes, then switch to the game window and trigger some kind of ReloadScripts() method. Your in-game character is still standing right next to Ted/Fred and you can try out the new script right away. Iterations are fast and easy.

I don't know anything about the C# 5.0 changes, maybe they are making it simpler. I did my scripting stuff on 3.5 so I know it's definitely available in some form today.

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe

Mr.Hotkeys posted:

Yeah I was considering having the objects have a state that determines the logic they execute (eg cutscene vs your turn vs their turn, or something like that), and have them each have a field that contains some IScript object they execute when they're in the cutscene mode.

I'm actually writing a TBS game at the moment and the approach I've chosen for this is to have a Unit controlled by little command data structures, which instruct it to do things like "Move to X" or "Attack Y". So, instead of calling a function like:

pre:
unit.MoveTo(position)
You have:

pre:
class MoveToCommand : public UnitCommand
{
 ... blah blah blah ...
};

MoveToCommand moveCommand(position);
unit.AcceptCommand(moveCommand);
These commands can be generated by the UI for player units, by the AI or by the cutscene system. The advantage of this approach is that your commands can come from anywhere, you can send them as messages over thread boundaries, through network connections for multiplayer games, or load them from replay files.

Adbot
ADBOT LOVES YOU

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

BizarroAzrael posted:

Sorry, but I'm having no luck with this. Besides that site being a bit hard to read, I'm having trouble reconciling what I'm getting out of it with the way I'm currently doing things:

This is in Flash, and each planet has a separate velocity on the x- and y-axis (xv, yv) and each frame these are modified by any gravity acting on the planet, and then each planet's x coordinate has xv added to it and it's y coordinate has yv added to it.

So now I want to detect when two planets come into contact with each other and make them collide and bounce off of each other, but I can't figure out how arrive at separate modified velocities. Should I rework everything so everything just have a speed and an angle that it's moving at? Gravity and such seems to work fine with things the way they are but this particular problem seems a lot easier to solve that way.

No need to rework things. First, once you have decided that two objects are colliding, find the normal and tangential vectors:
code:
nx = (O1.X - O2.X) / Distance;
ny = (O1.Y - O2.Y) / Distance;
tx = -ny;
ty = nx;
Where Distance is of course the distance between their centers. Next, project the velocities onto these vectors:
code:
Vn1 = O1.Vx * nx + O1.Vy * ny;
Vn2 = O2.Vx * nx + O2.Vy * ny;
Vt1 = O1.Vx * tx + O1.Vy * ty;
Vt2 = O2.Vx * tx + O2.Vy * ty;
Now if you solve the equations on that page you find that Vt1 and Vt2 are unchanged. Solving for the new Vn1 and Vn2 gives you:
code:
NewVn1 = (O1.Mass * Vn1 + O2.Mass*(Vn2 + E * (Vn2 - Vn1))) / (O1.Mass + O2.Mass);
NewVn2 = E * (Vn1 - Vn2) + NewVn1;
Where E is the coefficient of restitution. You set that yourself. Choose a number between zero and 1. If it's 1 no energy is lost in the collision, if it's zero it's all lost.

Lastly, project the new velocities back onto the x-y axis:
code:
O1.Vx = NewVn1 * nx + Vt1 * tx;
O1.Vy = NewVn1 * ny + Vt1 * ty;
O2.Vx = NewVn2 * nx + Vt2 * tx;
O2.Vy = NewVn2 * ny + Vt2 * ty;
Edit: Also, be careful about not letting objects overlap.

HappyHippo fucked around with this message at 17:51 on Apr 8, 2011

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply