Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411525 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 07:29:02 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 21 22 [23] 24 25 ... 69
Print
Author Topic: General thread for quick questions  (Read 135518 times)
oahda
Level 10
*****



View Profile
« Reply #440 on: December 11, 2015, 10:20:05 AM »

I remember hearing about and seeing this game engine / IDE (like Unity) a few years ago, but I can't for the life of me seem to find it again.

Its main idea was that you could work online and chat with each other and see changes other people made immediately without having to synchronise stuff manually (I think). I remember the interface being sort of beige.

Does anyone know what engine I mean and if it still exists?
I found it! Someone had tweeted a screenshot of it under the #ludumdare hashtag and I recognised it immediately!

http://craftstud.io/

Looking around, it seems to be a voxel engine..? Or just based around simple shapes like boxes and pyramids?

Okay, someone who tried the alpha told me you can load .obj files too. And use Lua besides the visual system. Cool!
« Last Edit: December 11, 2015, 10:30:07 AM by Prinsessa » Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #441 on: December 11, 2015, 02:05:02 PM »

Game Maker Studio question: When I use the file_text_open_write() function in game maker to create a new file, what is the default directory that it uses? I can't seem to find the file anywhere, even if I create an executable and run it on my desktop. Furthermore, the desktop executable seems to still be able to read from the file even though I have no idea where it could be.

Help.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #442 on: December 11, 2015, 02:25:52 PM »

I remember hearing about and seeing this game engine / IDE (like Unity) a few years ago, but I can't for the life of me seem to find it again.

Its main idea was that you could work online and chat with each other and see changes other people made immediately without having to synchronise stuff manually (I think). I remember the interface being sort of beige.

Does anyone know what engine I mean and if it still exists?
I found it! Someone had tweeted a screenshot of it under the #ludumdare hashtag and I recognised it immediately!

http://craftstud.io/

Looking around, it seems to be a voxel engine..? Or just based around simple shapes like boxes and pyramids?

Okay, someone who tried the alpha told me you can load .obj files too. And use Lua besides the visual system. Cool!

Oh man that looks so fun. Tig should do a game jam with this some day.
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #443 on: December 11, 2015, 02:52:15 PM »

the devlog was here so ... they even are making a follow up engine
https://forums.tigsource.com/index.php?topic=22939.0

https://forums.tigsource.com/index.php?topic=46317.0
Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #444 on: December 11, 2015, 04:21:35 PM »

Game Maker Studio question: When I use the file_text_open_write() function in game maker to create a new file, what is the default directory that it uses? I can't seem to find the file anywhere, even if I create an executable and run it on my desktop. Furthermore, the desktop executable seems to still be able to read from the file even though I have no idea where it could be.

Help.
nvm found the answer. For future reference, things are always stored in %localAppData%/<game name>
Logged

CheeseCakeMan
Level 0
**


View Profile
« Reply #445 on: December 16, 2015, 06:41:30 AM »

Is there a way to prevent diagonal speedup without state? My event system sits on top of the input and only sends key hold events or mouse events. So if I move my camera diagonally I actually send two events, scroll_up and scroll_right. But now I don't know whether I'm supposed to scale the velocity or just add it to what is already there because both events are not correlated.

Or should I rather change my code to send up_right events in the first place?
Logged
Dacke
Level 10
*****



View Profile
« Reply #446 on: December 16, 2015, 06:51:57 AM »

I'm not sure exactly what you're asking. But maybe have a scroll event with vector data in it? Then you can normalize the vector before or after you send the event.

scroll{float x, float y} // x and y

scroll{double theta} // direction in radians
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
CheeseCakeMan
Level 0
**


View Profile
« Reply #447 on: December 16, 2015, 07:23:19 AM »

My camera is an entity with a velocity component (x, y) which moves just as any other entity in my game does. However I can take control of it by moving the mouse to the corners of the screen or via the keyboard. However my event system translates keys directly to actions like use_first_inventory_slot or scroll_right. My camera system receives the scroll_right event and adds velocity to the entity representing the actual camera in the world. Scrolling to the right would simply change velocity.x. However it has no notion of what happened during this frame, so scroll_right and scroll_up could be triggered during the same frame. Now both velocity.x and velocity.y would be increased, even though they would both need to be increased by a smaller amount, or sqrt(2) * velocity_to_add in this case.

Most games seem to solve this by checking the input state in a lot of places, or keeping a state of things that happened around for a while. I'm decoupling it so I'm losing the ability to do so. The second event doesn't know that we already added velocity this frame in another direction.
Logged
Cheesegrater
Level 1
*



View Profile
« Reply #448 on: December 16, 2015, 08:50:57 AM »

Just normalize the velocity vector before you use it (when you're doing your game logic update would be a good time) and rescale to the proper speed.

If you want to change velocity from frame to frame (ramping speed up or down over time), then use your input events to sum into an impulse vector instead, and rescale that before adding it to the velocity at update time.
Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #449 on: December 16, 2015, 12:03:59 PM »

The way I handle this is to have key downs call a start_moving_left/start_moving_up/etc. function on the entity they affect, and have key ups call corresponding stop_moving_* functions. The entity keeps track of its intended move direction on each axis, and applies the appropriate change to its velocity every frame based on those variables. It is a little bit of extra state, and there are some complications (like handling key downs in opposite directions at the same time), but this pattern has served me well over the years. It wouldn't couple your camera directly to the input system, nor would the input system have to directly know anything about diagonal movement.
Logged

Sik
Level 10
*****


View Profile WWW
« Reply #450 on: December 16, 2015, 06:58:39 PM »

Huh yeah. Use the events only to update the status of the keys, then during normal game logic (i.e. not during event processing) check the keys and use that to tell the direction to scroll. In fact this is probably the best way to handle all input, since it gives you the chance to easily preprocess all the received input from all supported peripherals before you actually make use of it.
Logged
oahda
Level 10
*****



View Profile
« Reply #451 on: December 18, 2015, 06:24:45 AM »

Question about C++ development in/for OS X:

I tried replacing SDL2 frameworks with a compiled SDL2 static library (.a) in my engine so that a project using the engine shouldn't have to include SDL frameworks in order to link — after all, any project based on this engine should be independent from and unaware of whatever goes on under the hood of the engine.

However, doing so, it wouldn't link. Lots of missing references with names that clearly refer to the frameworks that were used when compiling SDL to a static library using the Xcode project that came with the SDL2 download.

Any way I can fix this? Everything SDL uses seems to be standard OS X stuff anyhow, so I'm surprised OS X doesn't just find the frameworks in the global directory automatically?



It should be noted that I'm getting the linker errors when compiling my game and not the engine, which is odd. Since the SDL static library is not a framework, it shouldn't have to be included with the game's project as well if the engine linked to it already?

I'm not getting any issues when doing the same with AngelScript and Box2D which have both been set up as separate targets that compile static libraries which the main engine target is then linked to. And the audio library, SoLoud, was compiled just like SDL, in a completely separate project to a static library and then the engine is linked to the resulting file.

So why is only SDL acting this way, and how do I fix it? Sad In the end I just want to be able to have a precompiled .a file + headers to be necessary for anybody who wants to use the engine for a new game.
Logged

eyeliner
Level 10
*****


I'm afraid of americans...


View Profile
« Reply #452 on: December 18, 2015, 09:58:42 AM »

Quick question for a Sine Wave movement

I've got this C# (adapted):

Code:
object.Position = new Vector2(amplitude * Math.Sin(Time.Time / 10), amplitude * Math.Cos(Time.Time / 10)) + initialPosition

It gives me a nice circular motion over the initialPosition.

But now I'd like to add a new object exactly 180 degrees from where the other one is and make it rotate as well.
Could someone help me out figuring out the values to tweak?

It's for a circular shield thing for a shmup. Or like GameBoy's Batman rotating batarangs or whatever they are.
Logged

Yeah.
dlan
Level 1
*



View Profile
« Reply #453 on: December 18, 2015, 10:32:21 AM »

The (Time.Time / 10) is the value you need to tweak, it represent the angle in radians of your rotation. In  your case, you need to add Math.PI to this value in order to add 180 degree to your initial rotation.
Logged
eyeliner
Level 10
*****


I'm afraid of americans...


View Profile
« Reply #454 on: December 18, 2015, 01:41:58 PM »

For some reason, it's not working. It moves the other object a bit sideways.

Possibly, my code is at fault, somewhere...

But thanks anyway.
Logged

Yeah.
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #455 on: December 18, 2015, 02:38:03 PM »

However, doing so, it wouldn't link. Lots of missing references with names that clearly refer to the frameworks that were used when compiling SDL to a static library using the Xcode project that came with the SDL2 download.

Any way I can fix this? Everything SDL uses seems to be standard OS X stuff anyhow, so I'm surprised OS X doesn't just find the frameworks in the global directory automatically?

[...]

It should be noted that I'm getting the linker errors when compiling my game and not the engine, which is odd. Since the SDL static library is not a framework, it shouldn't have to be included with the game's project as well if the engine linked to it already?

I'm not getting any issues when doing the same with AngelScript and Box2D which have both been set up as separate targets that compile static libraries which the main engine target is then linked to. And the audio library, SoLoud, was compiled just like SDL, in a completely separate project to a static library and then the engine is linked to the resulting file.

So why is only SDL acting this way, and how do I fix it? Sad In the end I just want to be able to have a precompiled .a file + headers to be necessary for anybody who wants to use the engine for a new game.

If a static library links to a dynamic library (which includes frameworks), any executable that links to that library will also need to link to its dependencies. I don't think there's a mechanism for a built library to specify what it needs, so you'll have to manually specify the necessary frameworks for each executable built with the library. (Maybe a framework can do this, and that's why you didn't need to add those when you were linking to SDL2 that way?)

I'd assume AngelScript and Box2D have no dependencies, or at least no additional ones beyond what you're already linking by default. I would have thought SoLoud would at least need CoreAudio.framework, so unless it's doing its audio I/O some other way, I don't have an explanation for that one...
Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #456 on: December 18, 2015, 10:20:44 PM »

Additional info from an IRC conversation:

Quote
<KatieHuber> ah, they have a .a not a framework
<KatieHuber> no way to autolink for a .a
<ThemsAllTook> Yes, but why would SDL2.framework work differently from SDL2.a?
<KatieHuber> because SDL2.framework is *already* linked to those things
<KatieHuber> they could do the same — build all their deps as static libs, link them into a framework, and link the framework to those system libraries
<KatieHuber> then they distribute a single binary framework [who would use such a thing?!] and all a user has to do is drag it onto Xcode
<ThemsAllTook> So SDL2.framework being dynamically linked to, say, CoreFoundation.framework means that an Xcode project using SDL2.framework doesn't explicitly need to link CoreFoundation.framework?
<ThemsAllTook> How does that work?
<ThemsAllTook> Does SDL2.framework store the absolute path to /System/Library/Frameworks/CoreFoundation.framework, or is some other trickery involved?
<KatieHuber> correct
<KatieHuber> in particular, just because SDL2.framework links to CoreFoundation.framework, does NOT mean that the executable that links SDL2.framework must link to CoreFoundation.framework
<KatieHuber> or know anything about that relationship
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #457 on: December 19, 2015, 01:33:47 AM »

A quick google tells me .frameworks are always dynamically linked. So I find your IRC conversation is a little confused.


Perhaps it would help to actually understand what linking is. It's the process of finding a reference to a symbol in some section of object code, and matching it with the definition that is in another bit of object code. Static linking a library means performing this linking at compile time. So you need the definition present at compile time. Dynamic linking means matching at runtime (the OS does it for you on startup), based on filenames recorded at compile/link time.

So when dynamically linking, the only libraries you need reference are the ones you directly depend upon - at runtime the OS will find the dependencies of your dependices based off their metadata, not what is in your executable.

But not so when statically linking. The matching process happens at compile time, so that works fine. But your just included all the libraries object code into the exe. That introduced a bunch new symbol references, which require linking just like the symbols in your exe code does. So you need to specify to the linker how to link those, which itself can be statically or dynamically.

tl;dr: .dll and .framework store how to find their dependencies, .a do not. Hence static linking requires you to list all dependencies recursively.

So when distributing .a files, you usually provide information to the programmer about what linker arguments will be needed to link it. Most build systems understand this implicitly and have a built in solution. You could read about pkg-config which is a simple way of exposing this information. Or you can simply document it and require programmers to deal with it manually. But there's no standardized way.
Logged
oahda
Level 10
*****



View Profile
« Reply #458 on: December 19, 2015, 04:08:44 AM »

Thanks for all the info, both of you!

I think I'll check if I can just link my engine with the static SDL lib and then see if it works to link my game using the engine with the other frameworks — the most important issue is that all of these frameworks are standard OS X ones while SDL is not, so if I did this I could at least set up a default Xcode project for the engine, with these frameworks in it, that will always work out of the box.
Logged

eyeliner
Level 10
*****


I'm afraid of americans...


View Profile
« Reply #459 on: December 19, 2015, 07:15:01 AM »

The (Time.Time / 10) is the value you need to tweak, it represent the angle in radians of your rotation. In  your case, you need to add Math.PI to this value in order to add 180 degree to your initial rotation.
Quick update:

Solved it.
It was indeed in my code, but you pointed me in the right direction. Thanks again.
Logged

Yeah.
Pages: 1 ... 21 22 [23] 24 25 ... 69
Print
Jump to:  

Theme orange-lt created by panic