Welcome, Guest. Please login or register. Did you miss your activation email?

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 - MrOnlineCoder

Pages: [1] 2 3 ... 6
Not coding with SFML for Android, but seems that you've done nice work. Did you make a pull request, so it can be added to main SFML repo?

Thanks for bumping the thread, because I've missed such a nice project  :P

I quite like the minimalistic graphics, and looking for more gameplay details.

Any info on when first playable alpha will be available? Also, is it a commerical project, and if no, is the source code available?

Good luck in future work.

Graphics / Re: Combining OpenGL stuff and graphics module
« on: January 03, 2019, 08:16:04 pm »
How it can cause errors, isn't that just "harmless" code?

Graphics / Re: Combining OpenGL stuff and graphics module
« on: January 03, 2019, 06:39:52 pm »
Solution found

1. In my project, from which I came here with this issue, I was setting shader uniforms to a wrong shader, that caused error.
2. What about my example, the solution is simple: do not use window.clear() when mixing with opengl. Seems that it internally unbinds texture (by binding texture with id 0) and this somehow causes problems in your code (at least my debugger thinks so :D ).
3. Also, calling window.resetGLStates() before pushing doesn't fix the problem, instead you have to reset gl objects manually:


//Application loop (while window.isOpen())

//If you start drawing your OpenGL (in my case 3d scene) before SFML, use glClear instead of window.clear
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //or your favourite color

//Drawing your stuff

//Switching to sfml

//Clearing objects
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);

//SFML drawing

Probably, I've missed something, because SFML is written and tested better than my code, but I don't know why it didn't help.

Anyway, thanks Laurent for your help.

Graphics / Re: Combining OpenGL stuff and graphics module
« on: January 03, 2019, 04:33:35 pm »
It didn't compile at start, but I downloaded glad with compatibility settings and now it works, the background and text are shown, and the cube is rotating, but it spams my console with errors:

An internal OpenGL call failed in RenderTextureImplFBO.cpp(192).
   GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, 0)
Error description:
   The specified operation is not allowed in the current state.

Graphics / Re: Combining OpenGL stuff and graphics module
« on: January 03, 2019, 04:12:19 pm »
If your code is truly minimal, then you'd better paste it directly on the forum. If you can't, it means that it's not really minimal ;)

For that kind of problem, I'd say you can easily setup a simple main() that opens a window and draws an OpenGL quad + some sfml-graphics entity. No need for a 34 kB zipped project.
The real Main is just 150 lines, 34 kB are made of glad headers, which are added for the sake of simplicity. :D

Graphics / [Solved] Combining OpenGL stuff and graphics module
« on: January 03, 2019, 03:46:05 pm »

I am trying to use both OpenGL 3.0+ drawing (for 3D) and SFML for texts and 2d stuff. Currently, I am stuck with it. It is possible to render one of them, but not both at once. I followed recommendations in the tutorial concerning mixing sfml with opengl: https://en.sfml-dev.org/tutorials/2.5/window-opengl.php#using-opengl-together-with-the-graphics-module and added push/pop calls to my code, but it still does not work.

To minimize amount of possible factors, I've created minimal example to test (attached in a zip).

Please, check out this code and tell me where I made the mistake or how can I figure it out. I will appreciate that.

My setup:
Windows 7
SFML 2.5.0 (pre-built binaries from sfml-dev.org)
Visual Studio 2017
glad OpenGL loader

ZIP file contains glad and the source code. In the source code, there are some #defines, which you can
 tweak to test different cases

Check Main.cpp comments for more details. (sorry for messy code and globals, I think it is fine for testing purposes)

Thanks in advance,

SFML projects / ZBreakout - unfinished 2D top-down zombie shooter
« on: August 14, 2018, 06:35:08 pm »
Hello. I want to publish source code and assets that we've used in unpublished game ZBreakout. We do not have enough time and wish to finish it, so I publish it, anyone can fork it and play around.

Basically the game intended to be a clone of Minecraft Hypixel Zombies gamemode.

There is a map (game level). There are 2-4 players, who must defend themselves from waves of zombies. Each next wave is stronger than previous one, includes other types of zombies with different stats and abilities. By killing zombies, players receive gold which they can spent to buy armor, weapons and open doors to new parts of the map. At the start of the game, only 1 part is open, and then players progress forward by opening the doors. The main aspect was hardcore, you should really not win in first attempt.

What's done:
- State machine
- Game/server architecture based on UDP
- Zombies with very basic A* pathfinding
- Weapons
- Doors
- Level loading (tiled .tmx levels)

What is NOT done:
- Zombie waves
- Levels themselves
- most of the game concerning cosmetic things like animations, GUI - ready-to-publish look basically :D

You can download test game build (tested on Windows 7 64bit, 77 MB) from Google Drive: https://drive.google.com/open?id=19KzF3VMIt4ICSnC4Q-vFadhGO0oHXC6M

WASD to move
Left Click to shoot
1,2,3,4,5 to switch inventory slots
F3 to show debug info
K to get all weapons
L to toggle zombies movement
P to spawn a zombie

I would like to thank all of you guys for helping in coding this game, especially:
  • therocode
  • Dbug
  • Rosme
  • Mario
  • eXploit3r
  • fallahn
  • jamesking
  • StephenLynx
  • BlueCobold
  • Johhny

License in all source code files should be considered outdated and inactive, now everything is licensed under MIT license. Do whatever you want :)

Note: most of the assets were taken from opengameart.org and other sites, their copyright rights belong to their respectful authors! (sorry, I am bad at law stuff in English)

GitHub: https://github.com/MrOnlineCoder/ZBreakout

SFML projects / Re: Space Colony - multiplayer strategy project
« on: February 11, 2018, 02:31:44 pm »
Thanks for information, I'll take it into account.

Ah, also I forgot to credit you for useful PhysFSStream class.  ;)

SFML projects / Space Colony - multiplayer strategy project
« on: February 11, 2018, 01:56:42 pm »
Hello. Me and my friend were developing one project - Space Colony, a multiplayer space turn-based strategy game. But, unfortunately, we do not have time to continue working on it. So, I decided to publish it's source code and assets.


Turn based strategy, up to 4-6 multiplayer players.
Each player owns a colony and can own some planets.

Planets contain useful resources - metal, oil and crystals, used to build different structures and objects. Each player has different ships, used to capture other planets.

Colony/player loses the game, if all their planets are captured by other colonies.

One gameplay aspect which we wanted to implement is motherships - special big ships, which are required to control other ships - so you, for e.g, make 10 small attacking ships and 1 mothership. Then you attach theese ships to the mothership, and by moving mothership you move your space fleet.

What we wanted to add:

  • Tech tree
  • Terra incognita (you only see a part of the map, which increases when you explore new areas)
  • Buildings on the planet
  • And, surely, epic space fights ! :)

Code structure

SFML is used for network, graphics, window, audio. Also I use PhysFS for loading resources from 1 zip file Resources.dat.

Game entry point is in Main.cpp, which just creates instance of Engine and then, it loads all resources, game states and starts the game by switching to IntroState.

GUIManager is responsible for GUI.

Game is the main game class, which just implements game logic. It is shared between client and server (I mean, like it is synced over network).

Initially, it was hardly inspired by Heroes of Might and Magic 3 and Starcraft

Code is avaliable at https://github.com/MrOnlineCoder/SpaceColony.

Working win32 release build is avaliable here (which also contains all assets, they are not included in the git repo): https://github.com/MrOnlineCoder/SpaceColony/releases/tag/v1.0

You can fork it, add pull requests, develop your own game based on it, shortly speaking, anything you want, but I'll be very happy if you include my name in credits :)


  • SFML by Laurent Gomila and contributors
  • PhysFS by Ryan C. Gordon
  • Some assets are downloaded from opengameart.org and belong to their respective owners

All music by Kevin MacLeod (incompetech.com), published under Creative Commons: By Attribution 3.0 License

General / Re: Using multiple views for level and entities
« on: February 01, 2018, 06:39:59 pm »
Well, generally, I  have the same situation:

  • Everything has 1 coordinate system (player sprite is drawn in the center, generally it's only a cosmetic feature, all game logic is built around real player position)
  • Everything except UI is rendered using levelView

But the main problem is that my level tileset is small and if I do not reduce (scale) levelView size -  my tiles become very small and character becomes very big.

Probably, the only solution is to increase tileset resolution and quality?

General / Re: Using multiple views for level and entities
« on: February 01, 2018, 06:10:31 pm »
I am doing the same  :)

But issue with drawing entities/enemies/items remains active.

General / Re: Using multiple views for level and entities
« on: February 01, 2018, 05:55:08 pm »
Thanks for reply! I don't have retro-style game, my graphics are in high/medium resoultion.

The problem that I need my player to be in screen center.

General / Using multiple views for level and entities
« on: February 01, 2018, 03:24:44 pm »
Hello. I need small tip on using views for my game.

Currently, I load and render Tiled (.tmx) level as a game level using one view called levelView, which represents "camera", so it is moved when the character moves. Also, that view is a little bit scaled, because my level tileset has tiles of size 16x16, so without lowering view size level appears really tiny on the screen.

Then, I have another view - playerView, which is the same as window default view, it is used to draw player UI and the player character sprite in the middle of the screen (the character is not moving, only camera (levelView) is moved).

Now, I need to draw entities: items, enemies. But how can I draw their positions correctly (moving along with the camera)? Which view should I use?

If I draw them with playerView - they appear statically on the screen, like an HUD element. And if I draw them with levelView - they appear really scaled (the quality of texture decreases).

Thanks in advance.

Nice project! Really will help me in 3D development, thanks!

Pages: [1] 2 3 ... 6